How do I push sprite away two questions

Get help using Construct 2

Post » Wed Dec 03, 2014 10:54 am

I have player sprite with 8 direction move behavior now when projectile hit the player from right side player shuld be push to left side for example 50 pixels even if sprite angle is 270' ( looking up)

Second question
its possible to simulate control more direction than up,down,left,right?
B
113
S
29
G
48
Posts: 1,883
Reputation: 36,580

Post » Thu Dec 04, 2014 8:41 pm

Just check the impact of the bullet. For example x position or direction. then move the victim to the the opposite direction.
For animations you can write some code on "every tick" or use position plugins like "moveTo".
B
13
S
4
G
1
Posts: 107
Reputation: 1,337

Post » Fri Dec 05, 2014 2:10 pm

@DAG you have right "r example x position or direction. then move the victim to the the opposite direction." but how do this?
i need this in all directions not only x and y
B
113
S
29
G
48
Posts: 1,883
Reputation: 36,580

Post » Sat Dec 06, 2014 12:30 am

Just use the direction of the bullet.
For example calculate the angle(xprev,yprev,x,y) or x/y separately (dx = xprev-x; dy = yprev-y).
On collision - move the the object towards to the angle.
B
13
S
4
G
1
Posts: 107
Reputation: 1,337


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests