When a bullet hit in the character.

For questions about using Classic.

Post » Tue Jul 07, 2009 10:48 am

Hello!

How to make that when a bullet hit in character, it throws him a little bit back? (in the opposite direction of bullet). Note,the character has 8Direction behavour.
B
3
S
2
G
3
Posts: 146
Reputation: 1,567

Post » Tue Jul 07, 2009 11:56 am

I would try move at angle.
bullet: On collision between bullet and Sprite
> SpriteMove 10 pixels at (bullet 0 .Angle degrees)
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Tue Jul 07, 2009 12:37 pm

newt Thank you! It works! :D
B
3
S
2
G
3
Posts: 146
Reputation: 1,567

Post » Tue Jul 07, 2009 1:22 pm

Remember to check for obstacles and such, or else the sprite might get shot THROUGH the wall. ;)
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Tue Jul 07, 2009 2:10 pm

yeah you wouldn't want yourself to move through walls :cry:
B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

Post » Tue Jul 07, 2009 2:15 pm

Yep
something like
bullet: On collision between bullet and Sprite
Sprite is not overlapping terrain.family
> SpriteMove 10 pixels at (bullet 0 .Angle degrees)

should work, you might even try offset.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Wed Jul 08, 2009 4:42 pm

You want to check that you're not being moved in to terrain - not that you aren't already in terrain :P 'Is overlapping at offset' can check that.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Thu Jul 09, 2009 10:28 am

Or you can move first, check for overlap, then move back... that would appear like bouncing off the wall (ouch).
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Thu Jul 09, 2009 10:42 am

Heh you must think like the bullet, be the bullet.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Thu Jul 09, 2009 10:33 pm

I thought about changing 8-direction speed and angle based on a small calculation to have physics-like reaction, but then realized that changing the angle would make the character turn.
So bleh. Nevermind that idea.
(it would work with a proxy though :P)
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests