A custom enemy movement

Get help using Construct 2

Post » Thu Mar 28, 2013 10:31 pm

Hello everyone,

This is my first post in your great forum...

I am testing the SCIRRA software to create a HTML 5 game.

I would like to ask you a question:

How to apply to custom movement for a enemy (which is normally a sprite object) based on the X axis(= I mean horizental move)?

I couldn't find a simple tutorial and I am a newbie with SCIRRA


Thanks in advance
B
3
Posts: 3
Reputation: 281

Post » Thu Mar 28, 2013 10:52 pm

Hello newgamer

Here is a great patrolling example made by JohnnySix showing you how you can achieve this:

Patrolling Example

There is a download link for the example .capx in the description.

Welcome to Scirra
B
50
S
11
G
8
Posts: 479
Reputation: 9,911

Post » Fri Mar 29, 2013 12:04 am

You can also simply assign the bullet behavior to your enemy which will automatically give them a linear movement which you can then use your events and logic to tweak.
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,418

Post » Fri Mar 29, 2013 9:48 pm

Thank you very much both of you gentel men!

I tried to implement BluePhaze solution, indeed I asseigned the bullet behaviour to my enemy(which is supposed to move above a wall), then I added a condition just like that:

(to perform the left movement)
System -> Every tick -> myenemy : Move 3 pixels at angle 180
until now, it works!!!

Then, I want to make it back when he arrived to the wall limit( the right movement), I want to compare the wall X and my enemy X coordinates:

myenemy -> X <= wall.X : myenemy: Move 3 pixels at angle 0

but the problem is that myenemy object didn't turn back :(

What was my mistake?
B
3
Posts: 3
Reputation: 281

Post » Sun Mar 31, 2013 4:54 pm

Is there any other solution to make my enemy goes back when he arrived to the wall limit?
B
3
Posts: 3
Reputation: 281


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 25 guests