• Advertisement
Sign in to follow this  

help with input (updated showing video)

This topic is 4148 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi in my scrolling beat em up i need some help on how to get the player punch to work. At the moment the player can can punch but when pressing forward he moves abit, this the code at the moment;

if(DXUCheckKeyPressed((*iPlayer)->ATTACK_KEY()) && !isJump
				&& state != ATTACK1 && state != JUMPFORWARD && state != ATTACK2)
			{
				DXUPlaySFX((*iPlayer)->PUNCHSFX);
				(*iPlayer)->getAttack1()->setCurrentFrame(0);
				(*iPlayer)->setState(ATTACK1);	
			}


// If punch state alive and move is finished, set state back to default
		if((*iCharacter)->getState() == ATTACK1 && (*iCharacter)->getAttack1()->getCurrentFrame()
				>= (*iCharacter)->getAttack1()->getFrames() - 1)
		{
			(*iCharacter)->getAttack1()->setCurrentFrame(0);
			(*iCharacter)->setState(STANCE);
		}



I got a flag on the move keys so that it knows not to move when i am in punch animation but it still keeps moving forward any ideas how to properly implement it? VIDEO LINK: http://rapidshare.de/files/36717860/YEY.avi.html OR YOUTUBE LINK:
[Edited by - lodoss118 on October 14, 2006 10:21:08 AM]

Share this post


Link to post
Share on other sites
Advertisement
First, try to get an assertion that says "we moved forward and we didn't mean to".

Ie: if we are in the middle of an ATTACK, and our position has changed, then there is an error.

The code that checks for this doesn't have to be clean, or work in every situation -- it is debugging code only, so you can track down the bug.

Call that "erronious movement" code your "ATTACK ASSERT".

Now move the ATTACK ASSERT closer and closer to the point where you accidentally move your character. Hopefully you will eventually find the line where your character's position is changed, and you can figure out what is wrong with your logic on that line.

Alternatively, you could bottleneck the code that is allowed to move the character forward, and hack in code there to detect an erronious forward movement during an attack. Once you have it detected, use break points and figure out why it is happening. Fix the reason why it is happening, and then remove the hack to detect it. :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement