Pinning weapon to character and stabbing

0 favourites
  • 14 posts
From the Asset Store
2d mushroom sprite 2d game mushroom character enmy sprite game art
  • Hello, I got a little problem over there.

    I have 2 separate sprites: a character and a long stick that player is supposed to hold in both hands and stab when chosen key is pressed.

    I don't know how to do it though, because I got some problems. First of all I tried to pin weapon to character but when it comes to stabbing, position of weapon doesn't change (it's supposed to go forward and back then, but it's pinned to character and won't go anywhere so this method won't work).

    I also tried to "Set position to another object" every tick and chose image point set to hand but when character starts moving the position of weapon weirdly "delays" and doesn't follow up the image point too precisely..

    Help (maybe examples?) would be really, really appreciated, thanks in advance. :)

  • Does the weapon have to be a separate sprite? Would it be an option to just make 1 sprite and have an animation of the stabbing?

  • Yes I want it to be separate sprites because there will be multiple weapons probably.

  • When the key is pressed the stick gets unpinned, it moves forward, waiting x seconds, then moves backwards again and pin. There is action groups for pinning, unpinning, waiting x seconds and move position.

    I hope it helps.

  • I know there are such options but when unpinned and attacking while character jumps the weapon stays down under character's last position.

  • Maybe this will help?

    https://www.scirra.com/tutorials/205/making-a-sword-character

    Just replace the sword with the stick.

  • I tried this, but it's still not that because it only changes angle and I need stick to go forward and then back to original position. With pin it is not possible because when attacking and jumping stick stays down as I said and when I try "set position to another object" position of stick weirdly delays and doesn't stick to the image point actually..

  • Then I dont know, sorry.

  • Capx or screenshot of events?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you don't want to use pin, (and are familiar with setting objects to imagepoints) use on Whipping = true -> Set object to image point.

    Now you need to go into all of your animations and set the origin for that specific image point. It should stay with you regardless of movement.

  • Here is the screenshot of all events connected with movement.

    scr.hu/0w7c/saosa

    Stabbing works okay etc. but weapon still doesn't follow up my character properly, for example when jumping, position of weapon weirdly "delays" as I said by like 1 second and doesn't look natural. I got no idea what to do.. I set the imagepoint precisely for every frame and still it's the same.

  • youtube.com/watch

    Here is the video with this problem, so I get sure you understand me :D

  • That does look funny doesn't it. I am interested to see your code because I cant imagine why it would be doing that, unless your image points are off for the jump animation.

    A good thing to do whenever you run into a problem like this is to isolate it from your project. Start fresh with nothing but the code needed to display the problem. If it still occurs in that project post it and I will help you.

    A lot of the time though in doing so you find it yourself and is much easier than debugging your whole wip.

  • I tried isolating it and doing in other projects and the problem still occurs. It is really weird, maybe it is a Construct 2 bug but I don't think so.. I sent you the .capx on pm though.

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