PDA

View Full Version : Hadoken



Saffith
12-06-2008, 03:45 PM
Down, down-forward, forward, A. But you knew that already, right?
Demo (http://depositfiles.com/files/arrpo8jqt)
Demo (alternate location) (http://www.megaupload.com/?d=OJ1UMYTF)
Should work as is in build 884+. Change fireball->Step=200; to fireball->Step=2; for older builds.


import "std.zh"
const int SFX_HADOKEN=60;
const int HADOKEN_TILE_LEFT=300;
const int HADOKEN_TILE_RIGHT=302;
const int HADOKEN_CSET=7;

ffc script Hadoken
{
void run()
{
int step=0;
int counter=0;
int direction;
bool stillHoldingA=false;

while(true)
{
// Step 0: Wait for down to be pressed
if(step==0)
{
if(Link->InputDown && !(Link->InputUp || Link->InputLeft || Link->InputRight || Link->InputA))
{
step=1;
counter=0;
}
}
// Step 1: Wait for left or right to be pressed in addition to down
else if(step==1)
{
// If down isn't still held, or if another button is pressed, reset.
// Left and right are okay, as long as it's just one of them.
if(!Link->InputDown || Link->InputUp || Link->InputA || (Link->InputLeft && Link->InputRight))
step=0;
// Down is still held; check for left
else if(Link->InputLeft)
{
step=2;
counter=0;
direction=DIR_LEFT;
}
// Check for right
else if(Link->InputRight)
{
step=2;
counter=0;
direction=DIR_RIGHT;
}
// Nothing new, keep waiting
else
{
counter++;
// Waited too long, reset.
if(counter>10)
step=0;
}
}
// Step 2: Wait for down to be released
else if(step==2)
{
// Restart if an invalid button is pressed
if(Link->InputUp || Link->InputA || (Link->InputLeft && direction!=DIR_LEFT) || (Link->InputRight && direction!=DIR_RIGHT))
step=0;
// Move on if down isn't still being held
else if(!Link->InputDown)
{
step=3;
counter=0;
}
// Still held, keep waiting
else
{
counter++;
// Enough waiting.
if(counter>10)
step=0;
}
}
// Step 3: Wait for A to be pressed
else
{
// Restart if an invalid button is pressed, or if left or right aren't held anymore
if(Link->InputDown || Link->InputUp || !(Link->InputLeft || Link->InputRight) ||
(Link->InputLeft && direction!=DIR_LEFT) || (Link->InputRight && direction!=DIR_RIGHT))
step=0;
// Pressed A yet?
else if(Link->InputA)
{
// Finally!
DoHadoken(direction);
stillHoldingA=true;
step=0;
}
// Nope. Just wait.
else
{
counter++;
// Too late.
if(counter>10)
step=0;
}
}

// Without this, Link'll use his sword afterward if A is held.
if(stillHoldingA)
{
if(Link->InputA)
Link->InputA=false;
else
stillHoldingA=false;
}
Waitframe();
}
}

void DoHadoken(int direction)
{

Game->PlaySound(SFX_HADOKEN);
Link->Action=LA_ATTACKING;

lweapon fireball=Screen->CreateLWeapon(LW_SCRIPT1);

if(direction==DIR_LEFT)
{
fireball->OriginalTile=HADOKEN_TILE_LEFT;
fireball->X=Link->X-8;
}
else
{
fireball->OriginalTile=HADOKEN_TILE_RIGHT;
fireball->X=Link->X+8;
}
fireball->Y=Link->Y;
fireball->CSet=HADOKEN_CSET;
fireball->NumFrames=2;
fireball->Dir=direction;
fireball->Step=200;
fireball->Damage=8;
}
}

lucas92
12-06-2008, 03:57 PM
lol

It doesn't seems to hurt much the boss though...

Misopesaminos
12-06-2008, 05:02 PM
lol

It doesn't seems to hurt much the boss though...

You have to jump and hadoken the head it's the only way! lol

Great script! :P

Gleeok
12-06-2008, 09:47 PM
This makes me want to shape-change into something small and furry so I can hump your leg Saffith.


PS: Link+Hurricane Kick+Sound Effect = Certified Gold. XD


...And now we have yet another reason why a update needs to be done on the control scheme of Zelda Classic.

lucas92
12-06-2008, 10:08 PM
Why didn't you put the sound anyway? :p

You just proved that fighting games are possible with Zelda Classic lol.
Just kidding.