Bullet behaviour - Follow sprite

Get help using Construct 2

Post » Sat Mar 02, 2013 7:12 pm

Hey!
Now I'm trying to make enemies in my game follow the character and try to kill him. I want to do this with bullet behaviour so they'll keep the same speed etc. I tried Yunn's FairyStalker capx but it was accelerating if it was to far away and decelerating when it was closer. I want the enemy to maintain the same speed and just change directions.
Solutions?
Website Twitter Indie Developer
B
20
S
5
G
4
Posts: 201
Reputation: 2,884

Post » Sat Mar 02, 2013 7:47 pm

- Every Tick (Or you can use Every X seconds)
-> Set Angle towards position OR Rotate towards position if you want it to be a slower turn
B
40
S
12
G
7
Posts: 603
Reputation: 7,646

Post » Sat Mar 02, 2013 8:02 pm

Now the whole enemy rotates, I want the angle to stay 0 but it to change directions.
Website Twitter Indie Developer
B
20
S
5
G
4
Posts: 201
Reputation: 2,884

Post » Sat Mar 02, 2013 11:45 pm

I'm new to construct, so i may be wrong about this; i believe the bullet behavior is made so that a sprite will always move in a set direction at a specific angle, or in a set direction while rotating the sprite.

What you are after may be the behavior named "Custom movement", however it feels like the monster is running on ice, perhaps it is possible to tweak it so it is more like the bullet movement.
Here is a capx where i used the custom movement.
https://www.dropbox.com/s/10rwjvz6pzx5g1s/movement.capx?m

You might be able to use the path finding behavior but i do not know how to use it yet.Caffi2013-03-02 23:47:03
B
6
Posts: 3
Reputation: 738

Post » Sun Mar 03, 2013 12:45 am

Awesome! Works great.
Next question, is it possible to make the enemy get pushed back a little bit when hit by bullets? Like pushed back 5 pixels (smoothly) and start going towards me again?
Website Twitter Indie Developer
B
20
S
5
G
4
Posts: 201
Reputation: 2,884

Post » Sun Mar 03, 2013 3:47 am

If you want the object to follow the player but not actually rotate towards it, in the bullet settings change "set angle" to No and then use Object.Bullet -> Set Angle of Motion
B
40
S
12
G
7
Posts: 603
Reputation: 7,646

Post » Sun Mar 03, 2013 9:26 am

but what should be the angle then? "Sprite.X&Sprite.Y" doesn't work, neither replacing & to ,
Website Twitter Indie Developer
B
20
S
5
G
4
Posts: 201
Reputation: 2,884

Post » Sun Mar 03, 2013 9:28 am

Use the expression: angle(Player.X,Player.Y,Bullet.X,Bullet.Y) (replace Player and Bullet with the two sprites)
B
26
S
8
G
3
Posts: 210
Reputation: 5,973

Post » Sun Mar 03, 2013 1:04 pm

Redirected my next question to a new topic: http://www.scirra.com/forum/topic64402_post394854.html#394854

Thanks theubie for the help btw!
Website Twitter Indie Developer
B
20
S
5
G
4
Posts: 201
Reputation: 2,884


Return to How do I....?

Who is online

Users browsing this forum: MarkThomas, Yahoo [Bot] and 0 guests