const fileName1 := "spawnwalkingwest.gif"
const fileName := "spawnwalkingeast.gif"
const fileName2 := "spawnattackwest.gif"
const fileName3 := "spawnattackeast.gif"
var numFrames : int := Pic.Frames (fileName)
var numFrames1 : int := Pic.Frames (fileName1)
var numFrames2 : int := Pic.Frames (fileName2)
var numFrames3 : int := Pic.Frames (fileName3)
var stand:int:= Pic.FileNew ("spawnstanding.bmp")
var x:int
var y:int
var sora_x, sora_y:int
% Load the picture
var sora_stand: int
sora_stand:=Sprite.New(stand)
var delayTime : int
var pics : array 1 .. numFrames of int
var pics1 : array 1 .. numFrames1 of int
var pics2 : array 1 .. numFrames2 of int
var pics3 : array 1 .. numFrames3 of int
Pic.FileNewFrames (fileName, pics, delayTime)
Pic.FileNewFrames (fileName1, pics1, delayTime)
Pic.FileNewFrames (fileName2, pics2, delayTime)
Pic.FileNewFrames (fileName3, pics3, delayTime)
% Display the pictures
x:=100
y:=10
loop
sora_x:= x+2
sora_y:= y-1
Sprite.SetPosition (sora_stand,sora_x,sora_y,false)
Sprite.Show (sora_stand)
var chars : array char of boolean
Input.KeyDown (chars)
if chars ('a')and chars(KEY_RIGHT_ARROW) then
Pic.DrawFrames (pics3, x, y, picMerge, upper (pics3), 70, true)
end if
if chars ('a')and chars(KEY_LEFT_ARROW) then
Pic.DrawFrames (pics2, x, y, picMerge, upper (pics2), 70, true)
end if
if chars (KEY_LEFT_ARROW) then
x:=x-10
Pic.DrawFrames (pics1, x, y, picMerge, upper (pics1), 55, true)
end if
if chars (KEY_RIGHT_ARROW) then
x:=x+10
Pic.DrawFrames (pics, x, y, picMerge, upper (pics), 55, true)
end if
end loop
|