PortableAnswers
New member
Hello, how can I make my player punch or kick in my adventure game? I have the animations and I tried using the Melee_H and Melee_V game objects but no success. Thanks!
jorotroid said:Can you elaborate on what you have tried doing so far? Punching and kicking could mean different things for different games, so it's hard to give advice when I don't know what sort of punching and kicking your are going for.
jorotroid said:Oh, I just remember one aspect to the adventure module that you might have skipped. Go into Project>Info and make sure that Weapons 1 and 2 are unlocked. The melee and projectile scripts won't work unless you have those checked.
jorotroid said:You're welcome! I hope we can get this all sorted out for you.
Hm, I think I am getting a better picture of what you are going for. It sounds like your sprite for the kick is a completely redrawn version of you player sprite with body and all. If what you are going for is for the leg your kick to be outside of the normal confines of the size of the player sprite, then you'll want the kick melee sprite to be of just the leg. And with the player set up an animation of the player kicking with the leg cut off.
For a bit of a visual reference check out the gif in this tutorial I made. In it, I am not replacing the entire player object when punching, I am changing the player's state to the attacking animation state and placing an arm object in front of the player.
http://nesmakers.com/viewtopic.php?f=3&t=1018
jorotroid said:You're welcome! I hope we can get this all sorted out for you.
Hm, I think I am getting a better picture of what you are going for. It sounds like your sprite for the kick is a completely redrawn version of you player sprite with body and all. If what you are going for is for the leg your kick to be outside of the normal confines of the size of the player sprite, then you'll want the kick melee sprite to be of just the leg. And with the player set up an animation of the player kicking with the leg cut off.
For a bit of a visual reference check out the gif in this tutorial I made. In it, I am not replacing the entire player object when punching, I am changing the player's state to the attacking animation state and placing an arm object in front of the player.
http://nesmakers.com/viewtopic.php?f=3&t=1018
jorotroid said:Can you share an image of what you are going for?
jorotroid said:Hm. I'm not sure what the best advice for you would be. So you seem to be going in a bit of a different direction than how melee object offset was intended to be used. Also you have a sort of unusual character. It looks like your intention is to have the melee object appear over the player object, but the issue you are having is that it's appearing off to the side. If I remember right, this is probably because the script that determines where the melee object appears was sort of built to handle smaller melee objects, so the math is off when you try to use such a big object for the melee attack. You can compensate for this by editing some values in the melee script. That said, if you go the way you're going, you'll probably end up with being able to see the regular player object underneath the melee object whenever you attack. You're also setting yourself up for some additional challenges by having a character that is wider when going left and right than when it goes up and down. I'm not saying that what you are going for is impossible, but you are heading down a road of having to customize more code, and I thought I should at least point that out. Have you gone through the video tutorial for the adventure module yet? I highly recommend getting to know how the tool is intended to be used before going off script in the way you seem to be going.
Aside from all that, for the attack state I would maybe look into making the front of the donkey use the player object and the kicking legs be the melee object. That would be more in line with what the melee object offset was built for. Or maybe the whole player object can handle all the different animations and you could overlay an invisible melee object to handle the attack collision.
I'm not sure how comfortable you are with code, so I'm a bit reluctant to go into too much detail. But if you want to dip your toes in, I can tell you that where to fix the offset. Go in the b_create_melee script and around line 45 you should see the number #$08 and little further down #$10. These numbers represent the dimensions of the expected melee object in hexidecimal. In other words it's expecting an object that is 8x16 pixels (the size of the sword in the adventure tutorial). You'll have to change this numbers to reflect the size of the melee object you use.
That's a nice looking donkey, by the way.
dale_coop said:The melee object will never "replace" your player graphics. It's just an add-on.
But when you use the weapon, you player change its animation (action step 2, if I remember well... cf the adventure tutorial).
So your PLAYER should have the attacking graphics animation, used in its action step2. And your Melee object should just be invisible (with a bounding box), at the same spot than your player foot/leg maybe...
dale_coop said:Yeah, I think, you could slow down your animation (the "animation speed" for the "action step 2", for example "08") and don't forget to set the "End of animation" to "GoTofirst" (the "End of action" remains to "Null").
And take a look at that topic: http://nesmakers.com/viewtopic.php?f=3&t=1018