How to punch/kick in adventure game? [SOLVED]

Having trouble compiling code? Getting an unexpected error? Player not appearing on screen? Seeking answers on how to do a particular thing? This is the forum you're looking for, to ask other NESmaker users for assistance.
User avatar
PortableAnswers
Posts: 56
Joined: Wed May 02, 2018 11:52 am
Location: USA
Contact:

Re: How to punch/kick in adventure game?

Post by PortableAnswers » Sat Oct 06, 2018 11:28 am

jorotroid wrote:
Thu Oct 04, 2018 1:35 am
Can you share an image of what you are going for?
Here is a short video of what is happening:
https://streamable.com/l95os
User avatar
jorotroid
Posts: 152
Joined: Wed Aug 08, 2018 7:48 pm
Location: California
Contact:

Re: How to punch/kick in adventure game?

Post by jorotroid » Sun Oct 07, 2018 8:00 am

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.
User avatar
PortableAnswers
Posts: 56
Joined: Wed May 02, 2018 11:52 am
Location: USA
Contact:

Re: How to punch/kick in adventure game?

Post by PortableAnswers » Sun Oct 07, 2018 8:29 pm

jorotroid wrote:
Sun Oct 07, 2018 8:00 am
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.
Thank you for all the feedback! I have some Unity experience but this is my first game. I have watched almost every video on the New 8-Bit Heroes YouTube channel. I would have never made it as far as I've gotten without them. 6502 is still something that I am learning...slowly. Just taking it day by day. I will poke around in that script and report back if I make any progress. Perhaps version 4.1 will have something that will suit this situation. If not, I still have a lot of work to do on other aspects of the game so if the solution doesn't come immediately then I certainly have enough to keep me busy in the time being.

I'm glad you like Swamp Donkey :mrgreen:
User avatar
dale_coop
Posts: 1627
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: How to punch/kick in adventure game?

Post by dale_coop » Sun Oct 07, 2018 9:30 pm

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...
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
User avatar
PortableAnswers
Posts: 56
Joined: Wed May 02, 2018 11:52 am
Location: USA
Contact:

Re: How to punch/kick in adventure game?

Post by PortableAnswers » Mon Oct 08, 2018 12:11 pm

dale_coop wrote:
Sun Oct 07, 2018 9:30 pm
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...
This worked! Thanks!
It happens in the blink of an eye. How can it be configured so the attack animation is shown for longer? I adjusted the animation speed for the Player's Attack and the also Melee animation speed but no luck yet.
User avatar
dale_coop
Posts: 1627
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: How to punch/kick in adventure game?

Post by dale_coop » Mon Oct 08, 2018 12:19 pm

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
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
User avatar
PortableAnswers
Posts: 56
Joined: Wed May 02, 2018 11:52 am
Location: USA
Contact:

Re: How to punch/kick in adventure game?

Post by PortableAnswers » Mon Oct 08, 2018 12:44 pm

dale_coop wrote:
Mon Oct 08, 2018 12:19 pm
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
Got it to work! I had to give the attack animation at least 2 frames.
User avatar
dale_coop
Posts: 1627
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: How to punch/kick in adventure game?

Post by dale_coop » Mon Oct 08, 2018 12:48 pm

Great, good job!
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
Post Reply