RTS movement problem

This forum is currently in read-only mode.
From the Asset Store
For problem solving, puzzles, bubbles, platforms and other adventures.
  • I am using LOS and RTS for enemy AI, but I have a problem that after my character moves a couple times enemy is on the top of another enemy it is real problem for my game. How to make them move close to each other if they are following same object, but not to collide between eachother?

    <img src="smileys/smiley11.gif" border="0" align="middle" />

  • One of the RTS actions should be "Set Object Type To Avoid" - that will make the character avoid the object and its instances. AFAIK, you do not need to refresh the pathfinding grid for it to work.

    You could also alter the RTS behaviour manually based on distance checks to have avoidance, but I prefer the first method - much simpler...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hmm doesnt help.. I guess I'll better post a cap, here it is: cap. I need to make enemies not collide...

  • Ah, I see the issue. I've run into it before...

    It seems that custom obstacles don't work reliably/at all...

    Switch the Pathfinding type to Around "Solid" and give Sprite4 the "Solid" attribute. If you need to toggle the collision, remove the attribute when needed via System actions and regenerate the pathfinding grid.

  • Already tried, this doesnt work well for me... can you edit the cap and post the link to the project here? This would be amazing! :D

    link to cap

  • sendspace.com/file/xobe0a

    I switched the RTS behaviour from Custom to Avoid "Solid" and made Sprite and Sprite4 have the Solid attribute. Based on the way your game is set up, do not give Solid to the actual character sprites. Since they overlap the red sprites, they won't move, as to RTS, they are in a blocked cell.

  • When player stops enemies just start to move around themselves...

  • Is the code in the cap yours or are you adapting someone elses example?

    The enemies move constantly because of the events that adjust the speed of the sprites - the RTS behaviour works against that, thus creating a loop.

    Once these are disabled, the enemies stop eventually, but not close to the player - your grid size is set to 60 pixels - as soon as the enemies get within 60 pixels of the cell the player is in they will stop.

    Lower the grid size for more precision, but not to less than the enemy size - if you do, the enemies may stop moving at all due to the way the grid is calculated.

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