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

Get help using Construct 2

Post » Fri Mar 27, 2015 7:29 pm

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!!!!
B
9
S
3
Posts: 103
Reputation: 1,043

Post » Fri Mar 27, 2015 7:54 pm

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.
Freefall Bird
B
47
S
9
G
5
Posts: 280
Reputation: 5,781

Post » Fri Mar 27, 2015 8:26 pm

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?
B
9
S
3
Posts: 103
Reputation: 1,043

Post » Fri Mar 27, 2015 8:33 pm

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?
B
9
S
3
Posts: 103
Reputation: 1,043

Post » Fri Mar 27, 2015 10:26 pm

@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.
Freefall Bird
B
47
S
9
G
5
Posts: 280
Reputation: 5,781

Post » Sat Mar 28, 2015 10:50 am

Many thanks will check it out later!
B
9
S
3
Posts: 103
Reputation: 1,043

Post » Sat Mar 28, 2015 8:27 pm

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.
B
9
S
3
Posts: 103
Reputation: 1,043

Post » Mon Mar 30, 2015 2:32 pm

Yeah this is just a sample project to just test out the basics. I am glad it helped you a bit though.
Freefall Bird
B
47
S
9
G
5
Posts: 280
Reputation: 5,781


Return to How do I....?

Who is online

Users browsing this forum: ankas, tetuan and 11 guests