How do I Make My Thrown Axe Pin To Objects Reliably?

0 favourites
  • 14 posts
From the Asset Store
Throw daggers and hit the most fruit! Watch out for the wind, if you run out of daggers you'll lose the game!
  • I am working on a project for my Midterm which is due in 4 days. One of the integral parts of my game is the ability for my character to throw his axe and have it pin to things, and have him pick it up when he runs over it. However, when pinned to objects sometimes the axe tends to wait a few seconds and before "slipping" down and eventually off of the screen. Also, at times the axe tends to embed itself too deeply to be picked up, and other times it refuses to be picked up at all! I have also tried to make it stick blade first into objects to make it more realistic but, I could only figure out how to make it stick at a 145 Degrees, which means that it only acts realistically when thrown onto the top of a horizontal object. Keep in mind that I have been mainly working on the events and game mechanics, so everything else is rough. Any and all help in smoothing out this troublesome problem is appreciated !

    I have a new issue now . Last night stopped working on the test.capx file from before and started my work from the swordthrow.capx file. However when i downloaded it from Firefox I opened it with construct 2 but I did not save it. I got a ton of work done and I saved a lot, but this morning when i went to open the file it was nowhere to be found. The only traces I could find of it was the .capx.autosave file in my temp folder. When I try to open that I get a message that says "The file maybe invalid. Try checking the file in a text editor (Projects are saved in XML format).", but the file isn't empty and I don't wish to redo multiple hours worth of work. Also, it does not seem that Scirra will allow me to post files with the .autosave extension. If anyone has any experience with this sort of problem, please share it with me. I would really appreciate it.

  • your project requires a plugin, "scml", can you remove it or give us a link for download?

  • No problem

  • Whoops, it won;t allow to me post the link.. I will remove the plugin from the .capx and reupload it

  • I think this should do it.

  • The fact that the Axe is referred to as a sword is confusing, I intend to change that I've just been negligent.

  • You should use the Edit function instead of quadruple-posting.

  • Good advice, thank you

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just so you know, I'm having a look at it and trying to solve your problem. Also cleaning it up a bit, so things are easier to understand.

    Will let you know if I get things working.

    Anyway I'll post the result here

  • Thank you, that sounds great!

  • Ok, here comes the big text.

    Basically I made a new EventSheet called SwordControl and put some basic stuff in there. I guess that will get you going, You can use my project and complete it with your other stuff.

    You were going to deep where there wasn't much need. Sometime it's simpler than you imagine.

    Something I wrote down while messing with your project:

    Sword > On animation "Throw" finished > Set animation to "Throw"

    This makes no sense. Just set the animation as a loop. (I did it)

    The variable SwordGone is the opposite of HasSword, so there's no need for both of them. It just complicates stuff,

    just use the inverse instead. ( So I deleted SwordGone).

    Collisions get all buggy when you change the polygon shape of an object (especially physics ones), you need to set a single

    collision shape for the whole animation.(preferably all the animations)

    Added

    On start of layout> Sword> Destroy (check SwordControl sheet)

    Change on collision with sword to overlapping (so in case I throw it at my feet, there's no need to move away and back to it).

    I'm using 2 variables to control sword pickup, canPickup is delayed by a half a second to be set to true after the release,

    this way it has time to leave the collision area with the player, otherwise you would pick it up right after release,

    meaning it wouldn't fly away.

    Removed the physics behaviour of the sword, there's no need for it as it already has Bullet behaviour with gravity.

    Also the Pin behaviour doesn't work well when used together/along with physics.

    That's it, let me know if you still need help. Read all the comments on the event sheet to understand what I did.

    ps: just tag me with caiorosisca in case you need an answers. Makes it easier to keep track of the topic.

  • Thank You, that is amazingly helpful! I am just starting out with construct 2, and I tend to out think myself when it comes to minute details and general logic (whoops) so outside clarification is immensely useful. As for the Attacking animation.. I spent some time drawing my protagonist and was originally was using Spriter to make my animations. However due to an error on my part the images i have been animating turned out to be humungous when exported to construct 2. But the main problem was that when I exported my animations to Construct 2 I found that all of the body parts where thrown on top of each other in a pile, not structured like in Spriter. So i had to use spriter to chop them up frame by frame in order to use them. However since I was then working with a ton of frames I couldn't figure out how to make the axe an independent sprite. Nevermind.. I think I just thought of a solution . Nvm again, I see that you fixed the attack animation function. Also, why doesn't the screen on Layout 2 scroll to my player? That's all, thank you so much for your time, is there a way that I can give you more reputation or something? I'm new to this system.

  • I see your problem, I'm also very new to construct 2 and using bones animation sounded like a good ideia for me, unfortunatelly I haven't looked at it at all until now. I think as a solution you could pin it to the character and make it run an animation of itselft when you attack (just a quick workaround).

    About layout 2, to be honest I only had a glance at what it was, but haven't looked into it at all. Try making a new layout and copying stuff, so you can find what is bugging it.

    I'm quite sure there's nothing like rep or anything, no need for it tho.

    Have fun

  • No problem, you've already helped enough and I'll try that.

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