How do I make my enemy have movement in a top down shooter?

  • Hi,

    So far I have figured out so that the enemy is destroyed by my bullets, but how do I do it so that the enemy has some sort of pre-defined movement, e.g. move left and right by 5px or something constantly/looping? Do I use an instance variable like I did with the health? Any example code / project file would be much appreciated!!!!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For constant looping movement you can try addingthe sine behaviour to your enemy. It really helps me with those repetitive loops. You can pre set it and even turn it on and off with the events. Changing and playing with the different parameters will get you interesting ressults.

  • Any chance you can show me a working example, screenshot or something? I am still learning, I can't visualise what you are telling me?

  • I just tried sine, problem is although that makes them go left to right, I need some of them to go up and down? How would I change how different entities are moving, at the moment they go through solid walls?

  • SomeT Just made you small example of what you can do with it. The rest is up to your imagination.

    You can change the sine movement and what it affects in the events.

    [updte] - I modified the version so that the enemy stops on hitting the ground to address your other question on solid objects.

  • Many thanks will check it out later!

  • Checked it out, I although your project is nothing like mine from looking through your code figured out what I was doing wrong on mine.

  • Yeah this is just a sample project to just test out the basics. I am glad it helped you a bit though.

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