Stop the sprite when it hits a solid object.

Get help using Construct 2

Post » Sun Nov 20, 2016 5:47 pm

Hey guys,

I'm trying to achieve this (sorry about the glitch)

Image

I want to stop the object when it hits a solid while it's going forward/backward or rotating.

I tried to use 8 Direction and Car behavior but they don't work so I tried Custom Movement.

Image

This is what I achieved so far it's almost same as Car behavior.

Is there any way to make this movement in C2? I thought it's an easy thing to do before I start. I still can't believe how hard it is :)

Thank you!
Image
B
66
S
31
G
39
Posts: 430
Reputation: 24,562

Post » Sat Dec 03, 2016 9:48 am

Try adding an event that goes something like either one of these

On collision with wall.object -->

Set Tank speed to 0
wait 1-2 secs
Set Tank speed to (normal speed) or play around with acceleration

or maybe even better

On collision with wall.object -->
start ignoring input
wait 1-2 secs
stop ignoring input

just test it and see what works best and tweak it from there

hope that helps

;)
When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
35
S
13
G
8
Posts: 318
Reputation: 7,685

Post » Sat Dec 03, 2016 1:38 pm

@mystazsea Thank you for replying!

I figured out how to make it. I added 4 sprites every corner of the tank and check their collisions separately.
Image
B
66
S
31
G
39
Posts: 430
Reputation: 24,562

Post » Tue Dec 06, 2016 10:51 am

@bilgekaan, you don't need placeholders, you can use the checking overlapping at offset instead and you'll improve your performance, because placeholders increase significantly the number of collision checks. I'm working in a sandbox of my template where I was using placeholders and now it's all checking with offset, the improvement is huge.
Image
B
108
S
24
G
18
Posts: 1,372
Reputation: 22,817


Return to How do I....?

Who is online

Users browsing this forum: Blendi1223, kellehk, TRMG and 25 guests