Line of Sight and Enemy movement work.

0 favourites
  • 6 posts
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • I have started to make a procedural Roguelike and am struggling to work out player movement.

    So far the movement is tile based and works on a turn based system, where once the player moves, a global Boolean is set to false. if the boolean is false then the enemies can move.

    if the enemies do not have LOS to player than the movement direction is random (this works fine).

    if the enemies do have LOS to player then the enemy will move in the direction of the player.

    I made an instance boolean variable to toggle if an enemy has LOS to player, to check in debug layout, if the LOS is working and it isnt.

    here are some relevant pictures of the programming.

  • Here is a link to the game

    1drv.ms/u/s!AgLvvr9zxjifkGMWR1S295_pHnRz

  • There are two playerbox instances you need to delete the one on the outside of the layout. Because they don't have line of sight of that they are set to false.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • There are two playerbox instances you need to delete the one on the outside of the layout. Because they don't have line of sight of that they are set to false.

    Thank you very much, that has solved the LOS problem. however now when enemies have los they only move left. hopefully I can figure out how to solve this problem,

    thanks again. :)

  • You compare the angle of playerbox but the angle is always 0. There are other ways to compare like X,Y position or the tilemovement grid position.

  • You compare the angle of playerbox but the angle is always 0. There are other ways to compare like X,Y position or the tilemovement grid position.

    thank you that makes sense. I shall look into it. :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)