Enemies on paths

0 favourites
  • 8 posts
From the Asset Store
Pixel Enemies for SHMUP consists of 45 enemy ship sprites to be used in your game.
  • Hello,

    I'm pretty new to Construct but I've been playing around with it all weekend and there's just one big thing that still eludes me:

    How do I put multiple instances of an enemy on different patrol paths?

    I have a number of enemies in my layout and I now want them to start patrolling along fixed, pre-determined paths, I just can't figure out a way to do it.

    How do I designate points on the path, how do I tell an enemy to move from point to point, how do I make sure each enemy is patrolling the right path and put them back on the right one if they get aggro'ed?

    Most editors I'd used have a pre-built patrolling behavior and path builder tools so I'm unsure how to approach this.

    Any help would be appreciated :)

    Thanks!

  • i dont know if this will help but....you could just create a sprite for the enemy's path and then set the enemy to that path using set to position.(set the enemy to pathsprite.x, pathsprite.y)

    you will need to use other sprite as contact markers so that the enemy turns and such. that should work!

  • I recall rexrainbow has plugin for that. If I'm not mistaken it is called rex_move.

    Maybe you can check it out. I havent try it so I cant tell if that is what you need.

  • Thanks for the information!

    I'll see if I can find the plugin and give it a try.

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

  • You may also be able to use the new pathfinding behaviors in r117 and set the enemy to find a certain sprite, then when they reach it, set it to the next sprite, this way you could control your route.

    Maybe have an instance variable that tracks the current/next target, and on collision with the waypoint sprite, update it to the next target...

  • Here's one approach - create three instance variables, to record the start waypoint, end waypoint, and current waypoint of each enemy.

    Then just set each enemy to head towards their current waypoint. When they reach it, increment their current waypoint by 1. If that is their maximum waypoint, reset the marker back to their first waypoint again.

    <img src="http://i49.tinypic.com/2vadr1l.jpg" border="0">

    EXAMPLE CAPX

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I was looking at the Pathfinding behavior, i was thinking it would be my best bet, but Tanoshimis solution looks pretty good too. I'm just unfortunately dealing with a different incredibly stubborn problem so I haven't even gotten a chance to try any of this yet :(

  • Thanks to all of you, with knowledge gleaned from your suggestions I was able to build a system that automatically assigns my instances to the proper paths and tracks their progress.

    Cheers!

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