Enemy following specific route - smooth movement

  • Hi all

    At the moment I am messing around with a tower defense-like game. I have an 'Enemy' sprite which should follow a specific path through the layout.

    The solution I came up with this far is creating some invisible 'Pointer' sprites and on collision (between Enemy and Pointer) setting the angle of the Enemy equal to that of the Pointer. This allows the enemy to guide through the layout (using the Bullet behavior). However, this does not result in a smooth movement at all, and doesn't look good when the game is played.

    Does anyone have an idea how I can make the Enemy sprite follow a specific path through the layout in a "smooth" movement?

    Thanks!

  • I recently had to make a tower defense game in a two-week period for a class of mine, and that's the exact method I used. It worked fine for me... If you post your capx file, I can take a look at it and see if we did something differently. <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Sure, here's an example <img src="smileys/smiley1.gif" border="0" align="middle">

    EnemyMovement.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Did you do anything to make their movement look more smooth? Other than just adding a lot of pointers?

    Thanks for your response!

  • What I did was actually... much less involving than that! <img src="smileys/smiley36.gif" border="0" align="middle" /> Rather than rotate them the way you're trying to, in my game I just made them snap instantly to the new angle. It wasn't pretty, but with such a short deadline, "pretty" wasn't my focus.

    Anyway! I found a pretty simple solution for you. Rather than use individual pointers to guide the enemy along the turn, we can use the "rotate __ degrees" actions to take care of all that for us. It took a wee bit of tweaking to get the pointers at the proper places, but it seems to be working just fine!

    db.tt/G1cwwylb

  • Hehe, yea, I thought there would be a more simple method for something like this. Your example seems to work fine for what I want to create <img src="smileys/smiley1.gif" border="0" align="middle" />

    I'll move on with something like that, thanks a lot for your help! <img src="smileys/smiley20.gif" border="0" align="middle" />

  • No problem! By the way, do you want the enemies to spin on their heads the way they currently do? There's a simple way around that if you'd rather they stay rightside-up. <img src="smileys/smiley17.gif" border="0" align="middle" />

  • I'll probably be using a different animation later on. Something viewed from above, so it won't matter.

    Still curious tho ;) Thinking of the flip/unflip action?

  • Haha, not quite. <img src="smileys/smiley2.gif" border="0" align="middle" />

    What we were doing before is changing the whole angle, when you also have the option of only changing the angle of motion, which won't affect the sprite's orientation.

    dl.dropbox.com/u/19702035/EnemyMovement5.capx

    Here's the way to do it if you don't want the actual sprite to rotate at all. But if you're using a top-down perspective, I guess the original way is better!

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