Making knives stick in objects.

0 favourites
  • 6 posts
From the Asset Store
This is a twin stick shooter similar to Enter the gungeon,Nuclear Throne, Helldivers & Soul knight for the mobile device
  • 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 =]

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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:


    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)


    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)

  • 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.


  • 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 =]

  • 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

  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)