Detachable weapon on character sprite

0 favourites
  • 6 posts
From the Asset Store
JBoB Sound Studio AAA Quality Sound Effect "Weapon Master" Pack contain royalty-free stock sound effects.
  • Hi, sorry I don't really have example images, but basically, my player-character is suppose to use a spear that can be thrown at enemies. When thrown, it's suppose to then stick to whatever enemy/ground it hits, and the player-character will no longer hold a spear till they go over and pick it up.

    The thing is I'm not sure which is the best way to set-up the sprite, I'm thinking the following ways:

    1) Make spritesheets for holding the spear and without. When spear is thrown, switch character sprites with no-spear ones, spawn a cloned spear to be the actual projectile. Then switch back to regular sprites after 'regaining' the spear.

    Or

    2) Make spear fully detachable and independent of player-sprite. Pin it to image point on hand of player-character. Apply Bullet behavior as before.

    Personally I'm hoping option 2 is possible, but I'm concerned with how 'floaty' and odd-angled the spear sprite would look attached to the player-character. I feel I might have to adjust it's rotation frame-by-frame indepently of the player-character, and I'm not sure if that's possible?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It would be easy just to do an animation like in number 1, and use bools to switch between "spear held" and "not spear held" states.

    2 is possible though. Just set an image point to his hand and every frame, if spear held is true, set the x and y to the image points x and y. You can also force the angle to be set at a certain way. Then once you throw it, set spear held to false so the spear is free, and then do your magic with the spear.

    An animation would still help though for throwing just to make it look snazzy.

  • Option two is the best way to go, and it's probably the easier of the two.

    As sushin said, on collision with spear have it set to an image point...give the spear rotation and you can set the angle, dependant on animation frame.

  • like Sushin said option 2 is the best way to do it, with Imagepoints. That is what I have seen mostly in tutorials and is the best reccomended way to do what your asking.

  • Couldn't you pin the spear to the player, then when "space bar" is clicked, player unpins spear, apply physics impulse on spear?

  • I'm trying to not have to use physics if I can. Mostly because if I do, I'll have to make more of my platform game physics based than originally prepared for.

    I thought the Bullet behavior with the right gravity settings would work pretty much the same.

    Anyway, thanks for all the feedback! It'll help to streamline what I need to do for the player sprite and weapon now. My only concern now is the same animations for both with/without spear would actually look all right, but that's something I'll handle when it comes.

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