Create moving object towards player position

Get help using Construct 2

Post » Sun Aug 07, 2016 3:28 pm

Hi all,

I've been searching and fiddling but can't figure this one out.

I have an object that has bullet behavior that moves to the right when created from a random Y position and fixed X position.

I also have a player controlled object that can move freely with the arrow keys.

I'd like the bullet to move towards the last position of the player when the bullet is created, however, not follow it. So basically the bullet would spawn and move in a straight line to the right and pass the player outside the window.

Sorry if I'm overlooking something really simple. In my previous attempts the objects move towards Player.X but I'd like the bullet to pass the player by in a straight horizontal line.

Thanks in advance for any replies.
B
13
S
7
G
3
Posts: 131
Reputation: 3,057

Post » Sun Aug 07, 2016 4:11 pm

I'll just give 2 examples. One with the every second condition & one using the on created condition:
I hope this helps:

Every Second Condition:

*Every (3) seconds...
->Create Object (Bullet) at Layer ("Layer"); at X = 0 ; Y = Player.Y ;
->Bullet -> Set angle of motion to 0.

---------------------------------------------

On created condition:

*On (Bullet) Created...
->Bullet -> Set Y to (Player.Y).
->Bullet -> Set angle of motion to 0.


On the every Second condition, replace the X with what you want.
The Every Second & On created condition are both triggers. That causes each bullet to only have the player's altitude at the moment the bullets are created/
at the moment the timer triggers
Image



The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
55
S
17
G
90
Posts: 1,111
Reputation: 59,145

Post » Mon Aug 08, 2016 2:25 pm

Hi chadorireborn,

thanks so much. It's working perfectly now.

Regards R
B
13
S
7
G
3
Posts: 131
Reputation: 3,057


Return to How do I....?

Who is online

Users browsing this forum: varr and 4 guests