Duck Animation Suggestion for 2D Platforms

maxman

Well-known member
I was playing Naruto awhile ago and I've known that playable characters from most mods play idle animation while releasing and after holding a duck button. We know that some characters duck with one sprite frame in an animation with pressing, holding, and releasing it, and it's no problem. The problem is that when using more than 1 frames in a duck anim like 2-4 or over, you can see that how many frame played in that anim for holding, but when you release it, it reverts back to anim idle instead of playing something like an anim unduck (for standing up for ducking; no such word for "unduck" in OpenBOR). Example, when you hold down, then frame 1 ("I'm about to get down") plays, then frame 2 ("I'm half way to get down"), and lastly frame 3 ("OK. Here I'm down here!"). But when releasing it, it's back to idle anim ("Hey that's funny. I was down here and then all of a sudden I'm back to standing up without moving up from being down here. That's probably because the engine isn't interactive enough for the duck").

anim duck

offset 23 50
delay 5
frame data/chars/mikey/duck1.png
frame data/chars/mikey/duck2.png
frame data/chars/mikey/duck3.png
frame data/chars/mikey/duck4.png #frame 4 should refer to be played all the way to frame 1 after releasing a down button from ducking and should NOT revert to anim idle after releasing it
frame data/chars/mikey/duck5.png
 
Sadly, I don't see a duck animation in code, nor unduck or whatever animation from your collab mod of Castlevania for the main Maria.txt in it though. There seems to be no anim duck for her. I see some have theirs. Playing anim duck again while holding down after playing a duckattack anim as we know, seems to be default in OpenBOR.
 
Even still. It doesn't stop the player from performing the entire DUCK animation after every action performed from said position. IE:
If the Player duck anim = 3 frames, the first 2 are transitional. the last frame is the actual DUCK.
If you perform an attack it starts back at frame 1. :/
 
In Mugen, the duck animation is splitted in 3 animations:
-10 stand-to-crouch
-11 crouch
-12 crouch-to-stand

If this could be emulated in OpenBOR, it would be great. I think we can use 3 follow anims with cancels to simulate the attacks.
 
Correcto, Saint Judas! That's how the anim duck goes for starting the first frame after doing any duck attacks. We know that releasing a down button from duck anim returns to idle anim instead of performing a get-up/crouch-to-stand anim.

O, I've been trying to create scripts for three follow anims for crouch, stand-to-crouch, and crouch-to-stand, but I keep failing to do them (except crouch (with a follow anim) which I did one time). I think I discussed with you and Bloodbane probably in PM about that I created a script for crouching after performing any "duck" attack. Too bad I completely forgot how I did it 'cause I deleted it. :/ I only remembered that I used changeentityproperty and/or performattack for animations.

I added @cmd keyint under duckattack anim for switching to duck anim. I'm trying to make it skip to a different frame in a different animation. Two problems for example: with loopstart and loopend I added in anim duck, you perform a duckattack anim once and switch back to the first frame of duck anim, but then, you cannot perform it again. Without loopstart and loopend, because there's a duck anim that's in keyint under duckattack anim, the player ducks twice and you can duck-attack again.

Code:
anim	duckattack
	delay	4
	bbox	7 1 46 68
	offset	22 65
	frame	data/chars/ryu/278.gif
	attack	43 5 46 21 3 0 1 0 0 0
	frame	data/chars/ryu/279.gif
	frame	data/chars/ryu/280.gif
	@cmd	keyint "ANI_DUCK" 2 "D" 0 0
	offset	23 66
	frame	data/chars/ryu/281.gif
	delay	2
	frame	data/chars/ryu/281.gif
	frame	data/chars/ryu/281.gif

I might fix up the crouch script with a specific follow anim again which I had forgotten about.

EDIT:

I forgot to show what my duck animation was like here before I changed the animation name to a specific follow:
Code:
anim	duck
	bbox	4 0 46 95
	offset	24 91
	delay	5
        loop 1 2 4
	frame	data/chars/ryu/0001000000.gif
	bbox	3 1 49 75
	offset	22 72
	frame	data/chars/ryu/0001000001.gif
	bbox	3 0 49 73
	offset	23 66
	frame	data/chars/ryu/0001000002.gif
	bbox	3 0 49 73
	offset	23 66
	delay	2
	frame	data/chars/ryu/0001000002.gif
	frame	data/chars/ryu/0001000002.gif

Currently I already switch from duck to one follow anim for crouching (stand-to-crouch that is).

EDIT 2: I forgot to mention that I added loop 1 2 4 for trying out before I edited and mentioned in this post.
 
I use 6 freespecial anims for crouch attacks and I never use cancel because I'm using a script that I copied for moving down from a Kung-Fu Master mod. Example:

Low punch:
Code:
anim	attack1
@script
void self = getlocalvar("self");
if(playerkeys(getentityproperty(self, "playerindex"), 0, "movedown"))
{
    changeentityproperty(self, "animation", openborconstant("ANI_FREESPECIAL20"));
}
	@end_script
	delay	4
	offset	24 99
	bbox	5 0 56 101
	frame	data/chars/ryu/161.gif
	attack	50 6 46 20 4 0 1 0 0 0
	frame	data/chars/ryu/162.gif
	frame	data/chars/ryu/163.gif
	frame	data/chars/ryu/164.gif
	offset	25 99
	frame	data/chars/ryu/165.gif

Crouch low punch:
Code:
anim	freespecial20
	delay	4
	bbox	7 1 46 68
	offset	22 65
	frame	data/chars/ryu/278.gif
	attack	43 5 46 21 3 0 1 0 0 0
	frame	data/chars/ryu/279.gif
	frame	data/chars/ryu/280.gif
	offset	23 66
	frame	data/chars/ryu/281.gif
	delay	2
	frame	data/chars/ryu/281.gif
	frame	data/chars/ryu/281.gif

I don't know if cancel would work, but I don't think it would because I'm worried it would play the first frame of duck anim if it switches after a freespecial move.
 
I really struggle with script so it likely sounds really dumb or badly uninformed, but shouldn't there be a simpler way? either way, here goes mine idea.
if the anim had, maybe 5 frames right?
duck transition down (frame01-02) / actual duck (frame03) / duck rise (frame04-05)
Direction Down held, play frame 01-03 initially, loop frame03 (as long as Direction down held)
if (a) pressed, while Direction Down held, perform duck attack, revert to frame03 loop.
Direction Down released, play frame 04-05, revert to idle.
I would have no idea where to begin coding this sadly. It's just a line of thought that may or may not be helpful. :/

On a side note, I was trying to put together a script to distinguish between standard duck attack (D+A) and Forward duck attack (D+F+A), and wound up inadvertent making a duck walk script. I'm sure there are important parts missing but if you want it, I'll post.
 
I agree, this is over complicated for a basic thing, it needs to be in the engine.  Pretty basic thing that any 2d/platform game is going to need.  And if anyone is ever going to make a 1on1 fighter with openbor this is also one of the issues.
 
SaintJudas said:
I really struggle with script so it likely sounds really dumb or badly uninformed, but shouldn't there be a simpler way? either way, here goes mine idea.
if the anim had, maybe 5 frames right?
duck transition down (frame01-02) / actual duck (frame03) / duck rise (frame04-05)
Direction Down held, play frame 01-03 initially, loop frame03 (as long as Direction down held)
if (a) pressed, while Direction Down held, perform duck attack, revert to frame03 loop.
Direction Down released, play frame 04-05, revert to idle.
I would have no idea where to begin coding this sadly. It's just a line of thought that may or may not be helpful. :/

On a side note, I was trying to put together a script to distinguish between standard duck attack (D+A) and Forward duck attack (D+F+A), and wound up inadvertent making a duck walk script. I'm sure there are important parts missing but if you want it, I'll post.

hum, you are right. We can use a keyscript with a updateframe to change the animation, I will make some tests.
About the duck walk, please share it.

And if anyone is ever going to make a 1on1 fighter with openbor this is also one of the issues.
For 1vs1, OpenBOR needs a lot of things to be cared about.
 
I have duck walk on my project

key.c

Code:
if(vAniID == openborconstant("ANI_DUCK")){	// Duck?
		if (iRight){ // New key status of right pressed
			performattack(vSelf, openborconstant("ANI_FOLLOW8")); // Change anim to duck walk
			changeentityproperty(vSelf, "direction", 1); // Change to right facing
			changeentityproperty(vSelf, "velocity", 0.5, 0, 0); //Move
		}
		if (iLeft){	// New key status of left pressed
			performattack(vSelf, openborconstant("ANI_FOLLOW8")); // Change anim to duck walk
			changeentityproperty(vSelf, "direction", 0); // Change to left facing
			changeentityproperty(vSelf, "velocity", -0.5, 0, 0); //Move
		}
}
 
This is the go back anim when you release the key:

Code:
if(vAniID == openborconstant("ANI_FOLLOW8")){ // Duckwalk anim?
		if (iDownR){ // Down key released?
			changeentityproperty(vSelf, "velocity", 0, 0, 0); //Stop
			setidle(vSelf, openborconstant("ANI_IDLE")); //Set idle
		}
		else if (iRightR || iLeftR){ // Right ot Left key releassed?
			changeentityproperty(vSelf, "animation", openborconstant("ANI_DUCK"));
			// Change to duck anim
			changeentityproperty(vSelf, "velocity", 0, 0, 0); //Stop
		}
		else if (iAttack){ // Attack key press?
			changeentityproperty(vSelf, "animation", openborconstant("ANI_DUCKATTACK"));
			// Change to duckattack anim
			changeentityproperty(vSelf, "velocity", 0, 0, 0); //Stop
		}
	}

On pain, yes it plays stand pain. But for platform game like shinobi it does not matter, cos pain allways  leaps player over the ground, i think you are talking abouth more combat oriented games.
 
bWWd said:
what if you get hit while being in duck anim? You go to standing pain animation? That would look wrong.

You can detect and handle this with onpain, but as said above, it isn't needed for platform games because they all have a generic pain animation anyway.

DC
 
bWWd said:
what if you get hit while being in duck anim? You go to standing pain animation? That would look wrong.

For 1vs1, you should go to a crouch pain animation. But for 2D games, in most of time you go to a generic standing pain animation or a fall animation.
 
Back
Top Bottom