%**************************************************************************************************
%*************************************** Variable Declaration *************************************
%**************************************************************************************************
%Ryu Player 1 Punch
var pic1
: int := Pic.FileNew ("RyuPunch1.jpg")
var pic2
: int := Pic.FileNew ("RyuPunch2.jpg")
var pic3
: int := Pic.FileNew ("RyuPunch3.jpg")
%Ryu Player 1 Walk
var PicWalk1
: int := Pic.FileNew ("RyuWalk1.jpg")
var PicWalk2
: int := Pic.FileNew ("RyuWalk2.jpg")
var PicWalk3
: int := Pic.FileNew ("RyuWalk3.jpg")
var PicWalkL1
: int := Pic.FileNew ("RyuWalkL1.jpg")
var PicWalkL2
: int := Pic.FileNew ("RyuWalkL2.jpg")
%Yang Player 2 Walk
var yangwalk1
: int := Pic.FileNew ("yangwalk1.jpg")
var yangwalk2
: int := Pic.FileNew ("yangwalk2.jpg")
var yangwalk3
: int := Pic.FileNew ("yangwalk3.jpg")
var yangwalk4
: int := Pic.FileNew ("yangwalk4.jpg")
var yangwalk5
: int := Pic.FileNew ("yangwalk5.jpg")
%Yang Player 2 Punch
var yangpunch1
: int := Pic.FileNew ("yangpunch1.jpg")
var yangpunch2
: int := Pic.FileNew ("yangpunch2.jpg")
var yangpunch3
: int := Pic.FileNew ("yangpunch3.jpg")
var yangpunch4
: int := Pic.FileNew ("yangpunch4.jpg")
%Ryu Punch Create Sprites
var sprite1
: int := Sprite.New (pic1
)
var sprite2
: int := Sprite.New (pic2
)
var sprite3
: int := Sprite.New (pic3
)
%Ryu Walk Create Sprites
var SpriteWalk1
: int := Sprite.New (PicWalk1
)
var SpriteWalk2
: int := Sprite.New (PicWalk2
)
var SpriteWalk3
: int := Sprite.New (PicWalk2
)
var SpriteWalkL1
: int := Sprite.New (PicWalkL1
)
var SpriteWalkL2
: int := Sprite.New (PicWalkL2
)
%Yang Walk Create Sprites
var spritewalk1
: int := Sprite.New (yangwalk1
)
var spritewalk2
: int := Sprite.New (yangwalk2
)
var spritewalk3
: int := Sprite.New (yangwalk3
)
var spritewalk4
: int := Sprite.New (yangwalk4
)
var spritewalk5
: int := Sprite.New (yangwalk5
)
%Yang Punch Create Sprites
var spritepunch1
: int := Sprite.New (yangpunch1
)
var spritepunch2
: int := Sprite.New (yangpunch2
)
var spritepunch3
: int := Sprite.New (yangpunch3
)
var spritepunch4
: int := Sprite.New (yangpunch4
)
% Declare other variables
var x, y
: int := 50
var x2, y2
: int
var centered
: boolean := false
var chars
: array char of boolean
x2
:= 400
y2
:= 50
%**************************************************************************************************
%******************************************* Set Sprite Height ************************************
%**************************************************************************************************
%Ryu Player 1 Sprite Height
Sprite.SetHeight (sprite1,
1)
Sprite.SetHeight (sprite2,
1)
Sprite.SetHeight (sprite3,
1)
%Ryu Player 1 Walk Sprite Height
Sprite.SetHeight (SpriteWalk1,
1)
Sprite.SetHeight (SpriteWalk2,
1)
Sprite.SetHeight (SpriteWalk3,
1)
Sprite.SetHeight (SpriteWalkL1,
1)
Sprite.SetHeight (SpriteWalkL2,
1)
%Sprite Initial Position
Sprite.SetPosition (sprite1, x, y, centered
)
Sprite.Show (sprite1
)
Sprite.SetPosition (spritewalk1, x2, y2, centered
)
Sprite.Show (spritewalk1
)
%**************************************************************************************************
%******************************************* Procedure Creation ***********************************
%**************************************************************************************************
proc Player1Punch
Sprite.Hide (sprite1
)
Sprite.Animate (sprite2, pic2, x, y, centered
)
Sprite.Show (sprite2
)
delay (120)
Sprite.Animate (sprite3, pic3, x, y, centered
)
Sprite.Hide (sprite2
)
Sprite.Show (sprite3
)
delay (120)
Sprite.Hide (sprite3
)
Sprite.Show (sprite2
)
delay (120)
Sprite.Hide (sprite2
)
Sprite.Show (sprite1
)
delay (120)
end Player1Punch
proc Player1Walk
Sprite.Hide (sprite1
)
Sprite.Animate (SpriteWalk1, PicWalk1, x, y, centered
)
Sprite.Show (SpriteWalk1
)
delay (120)
Sprite.Animate (SpriteWalk2, PicWalk2, x, y, centered
)
Sprite.Hide (SpriteWalk1
)
Sprite.Show (SpriteWalk2
)
delay (120)
Sprite.Animate (SpriteWalk3, PicWalk3, x, y, centered
)
Sprite.Hide (SpriteWalk2
)
Sprite.Show (SpriteWalk3
)
delay (120)
Sprite.Hide (SpriteWalk3
)
Sprite.Show (sprite1
)
end Player1Walk
proc Player1WalkL
Sprite.Hide (sprite1
)
Sprite.Animate (SpriteWalkL1, PicWalkL1, x, y, centered
)
Sprite.Show (SpriteWalkL1
)
delay (120)
Sprite.Animate (SpriteWalkL2, PicWalkL2, x, y, centered
)
Sprite.Hide (SpriteWalkL1
)
Sprite.Show (SpriteWalkL2
)
delay (120)
Sprite.Hide (SpriteWalkL2
)
Sprite.Show (sprite1
)
end Player1WalkL
procedure YANGWALK
Sprite.Hide (spritewalk1
)
Sprite.Animate (spritewalk2, yangwalk2, x2, y2, centered
)
Sprite.Show (spritewalk2
)
delay (100)
Sprite.Animate (spritewalk3, yangwalk3, x2, y2, centered
)
Sprite.Hide (spritewalk2
)
Sprite.Show (spritewalk3
)
delay (100)
Sprite.Animate (spritewalk4, yangwalk4, x2, y2, centered
)
Sprite.Hide (spritewalk3
)
Sprite.Show (spritewalk4
)
delay (100)
Sprite.Animate (spritewalk5, yangwalk5, x2, y2, centered
)
Sprite.Hide (spritewalk4
)
Sprite.Show (spritewalk5
)
delay (100)
Sprite.Hide (spritewalk5
)
Sprite.Show (spritewalk4
)
delay (100)
Sprite.Hide (spritewalk4
)
Sprite.Show (spritewalk3
)
delay (100)
Sprite.Hide (spritewalk3
)
Sprite.Show (spritewalk2
)
delay (100)
Sprite.Hide (spritewalk2
)
Sprite.Show (spritewalk1
)
end YANGWALK
proc YANGWALKBACK
Sprite.Hide (spritewalk1
)
Sprite.Animate (spritewalk5, yangwalk5, x2, y2, centered
)
Sprite.Show (spritewalk5
)
delay (100)
Sprite.Animate (spritewalk4, yangwalk4, x2, y2, centered
)
Sprite.Hide (spritewalk5
)
Sprite.Show (spritewalk4
)
delay (100)
Sprite.Animate (spritewalk3, yangwalk3, x2, y2, centered
)
Sprite.Hide (spritewalk4
)
Sprite.Show (spritewalk3
)
delay (100)
Sprite.Animate (spritewalk2, yangwalk2, x2, y2, centered
)
Sprite.Hide (spritewalk3
)
Sprite.Show (spritewalk2
)
delay (100)
Sprite.Hide (spritewalk2
)
Sprite.Show (spritewalk1
)
delay (100)
Sprite.Hide (spritewalk1
)
Sprite.Show (spritewalk2
)
delay (100)
Sprite.Hide (spritewalk2
)
Sprite.Show (spritewalk3
)
delay (100)
Sprite.Hide (spritewalk3
)
Sprite.Show (spritewalk4
)
delay (100)
Sprite.Hide (spritewalk4
)
Sprite.Show (spritewalk5
)
delay (100)
Sprite.Hide (spritewalk5
)
Sprite.Show (spritewalk1
)
end YANGWALKBACK
procedure YANGPUNCH
Sprite.Hide (spritewalk1
)
Sprite.Animate (spritepunch1, yangpunch1, x2, y2, centered
)
Sprite.Show (spritepunch1
)
delay (100)
Sprite.Animate (spritepunch2, yangpunch2, x2, y2, centered
)
Sprite.Hide (spritepunch1
)
Sprite.Show (spritepunch2
)
delay (100)
Sprite.Animate (spritepunch3, yangpunch3, x2, y2, centered
)
Sprite.Hide (spritepunch2
)
Sprite.Show (spritepunch3
)
delay (100)
Sprite.Animate (spritepunch4, yangpunch4, x2, y2, centered
)
Sprite.Hide (spritepunch3
)
Sprite.Show (spritepunch4
)
delay (100)
Sprite.Hide (spritepunch4
)
Sprite.Show (spritewalk1
)
end YANGPUNCH
%*************************************************************************************************
%******************************************** Key Controls ***************************************
%*************************************************************************************************
loop
Input.KeyDown (chars
)
if chars
('d') and x <
550 then
x +
= 15
Sprite.SetPosition (sprite1, x, y, centered
)
Sprite.SetPosition (SpriteWalk1, x, y, centered
)
Sprite.SetPosition (SpriteWalk2, x, y, centered
)
Sprite.SetPosition (SpriteWalk3, x, y, centered
)
delay (10)
Player1Walk
elsif chars
('a') and x >
10 then
x -
= 15
Sprite.SetPosition (sprite1, x, y, centered
)
Sprite.SetPosition (SpriteWalkL1, x, y, centered
)
Sprite.SetPosition (SpriteWalkL2, x, y, centered
)
delay (10)
Player1WalkL
elsif chars
(' ') then
Player1Punch
elsif chars
(KEY_LEFT_ARROW) and x2 >
10 then
x2 -
= 20
Sprite.SetPosition (spritewalk1, x2, y2, centered
)
Sprite.SetPosition (spritewalk2, x2, y2, centered
)
Sprite.SetPosition (spritewalk3, x2, y2, centered
)
Sprite.SetPosition (spritewalk4, x2, y2, centered
)
Sprite.SetPosition (spritewalk5, x2, y2, centered
)
YANGWALK
elsif chars
(KEY_RIGHT_ARROW) and x2 < 550then
x2 +
= 20
Sprite.SetPosition (spritewalk1, x2, y2, centered
)
Sprite.SetPosition (spritewalk2, x2, y2, centered
)
Sprite.SetPosition (spritewalk3, x2, y2, centered
)
Sprite.SetPosition (spritewalk4, x2, y2, centered
)
Sprite.SetPosition (spritewalk5, x2, y2, centered
)
YANGWALKBACK
elsif chars
('0') then
YANGPUNCH
end if
View.Update
end loop
Sprite.Free (sprite1
)
Sprite.Free (sprite2
)
Sprite.Free (sprite3
)
Sprite.Free (SpriteWalk1
)
Sprite.Free (SpriteWalk2
)
Sprite.Free (SpriteWalk3
)
Sprite.Free (SpriteWalkL1
)
Sprite.Free (SpriteWalkL2
)