get a sprite to move towards you

Get help using Construct 2

Post » Mon Jan 14, 2013 1:34 pm

So basically I am trying to test C2 by making a very very simple sort of bullet hell shooter.

Working out okay so far figured out shooting and movement for the player but i can't figure out how to get an "enemy" sprite to spawn and then always be trying to reach the players sprite?
B
3
S
2
G
5
Posts: 301
Reputation: 2,302

Post » Mon Jan 14, 2013 1:38 pm

for example every 1 seconds get the enemy ship to create another sprite that has the behavior bullet and then set that buttlets angle to that of the player ship. I use angle(x1, x2, y1, y2) X is the bullet and Y is the Player.

I think that should do it :)
B
32
S
9
G
3
Posts: 275
Reputation: 8,063

Post » Mon Jan 14, 2013 1:46 pm

Thanks but i don't get this bit:
I use angle(x1, x2, y1, y2) X is the bullet and Y is the Player.

Bear in mind this is my first proper time using it.
B
3
S
2
G
5
Posts: 301
Reputation: 2,302

Post » Mon Jan 14, 2013 5:50 pm

Correct me if I'm wrong.

Just as KSLR said, but:

Event: Every tick -> Enemy -> Set angle toward position ->
X = Player.X
Y = Player.Y

And for the spawn "ship" thingy

Event:
Every X seconds -> Ship -> Spawn another object -> Enemy

Hope this cleared things a bit.
B
13
S
5
G
2
Posts: 64
Reputation: 3,012

Post » Mon Jan 14, 2013 6:30 pm

and......

every 0.01 sec move "enemy" 1 pixel toward position player.x player.y
B
20
S
8
G
2
Posts: 122
Reputation: 3,202


Return to How do I....?

Who is online

Users browsing this forum: a1oleg, DemantDigitalArt, GSquadron, jeffige, MarkThomas, newt, paala and 18 guests