Making knives stick in objects.

Get help using Construct 2

Post » Thu Aug 22, 2013 3:33 am

Ok firstly please excuse me if this has already been posted but i cant for the life of me find an instance of it.

My question is as follows;

If i have a 'catapult' this is to say, a launcher, and my object launched is a sprite with physics, this being a knife, how would i get this knife, upon coming into contact with a target, to stick in at the angle of contact?

Any help on this would be much appreciated.

Thanks in advance =]
B
2
Posts: 6
Reputation: 187

Post » Thu Aug 22, 2013 4:07 am

All you need to do is put an event in that disables the physics behaviour of the knife as soon as it collides with the target. So your events would be something like:

(Event)
For Each Knife
Knife is overlapping Target at offset -10 (this will ensure the knife overlaps the target by 10 pixels and looks like it has pierced it)

(Action)
Knife Set Physics Disabled

That should stop the object but retain the angle etc.

The only issue with this method is it is indiscriminate about which part of the knife sticks into the object (so if the handle hits the object it will still stick in)
B
66
S
25
G
4
Posts: 212
Reputation: 7,059

Post » Thu Aug 22, 2013 4:10 am

Thanks for the speedy reply dude, yeah i read this in another post, as im an absolute noob to the layout, i cant seem to locate the option to set physics to disabled? :P

Also i did factor in the fact that it is indiscriminate on which side hits, i assume i could pin the physics part of the "blade" to a solid "handle" ?? im totally not sure, ive been playing with construct 2 for a few days and im still grasping basics.

=]
B
2
Posts: 6
Reputation: 187

Post » Thu Aug 22, 2013 4:17 am

do you per chance mean "set immovable"? as im playing with this and it seems to be what im looking for, just need to reset it afterwards =]
B
2
Posts: 6
Reputation: 187

Post » Thu Aug 22, 2013 1:53 pm

You can find it directly above "set immovable". Immovable is a bit different from disabled - physics objects set to immovable simply don't move but other physics objects still interact with them. If you actually disable the physics on an object however then other physics objects will no longer interact with it and this can sometimes be beneficial as a lot of physics objects on screen at once can slow the game down. It all just depends what you need anyway I did a quick example which shows you how it works with physics disabled on collision example
B
66
S
25
G
4
Posts: 212
Reputation: 7,059

Post » Sat May 31, 2014 8:51 am

Hey signal jacker this is possibly the latest reply you have ever had but i wanted to say thanks for the info and the demo for this. I worked on this project for a little while and it turned out quite funny, then the laptop died and ive not salvaged it from my hard drive yet. But thanks again dude
B
2
Posts: 6
Reputation: 187


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 39 guests