'make screen a bit zoomed
SCREEN 250,188,0,cbsizable
FrameLimit 40 'limit game speed
'load animation for both directions, but hide them
zeroright=LoadAnimObject("Media\zerorun1.bmp",47,51,0,12)
MaskObject zeroright,cbmagenta
ShowObject zeroright,OFF
zeroleft=LoadAnimObject("Media\zerorun2.bmp",47,51,0,12)
MaskObject zeroleft,cbmagenta
ShowObject zeroleft,OFF
'default direction
zero=CloneObject(zeroright)
Color cbblack
AddText "Try arrows"
ClsColor cbwhite
'MAIN LOOP
Repeat
'run right!
If RightKey() Then
PaintObject zero,zeroright
PlayObject zero,2,12,0.25 'animate at speed 0.25
'run left!
ElseIf LeftKey() Then
PaintObject zero,zeroleft
PlayObject zero,2,12,0.25 'animate at speed 0.25
Else
'nothing is pressed so freeze
PlayObject zero,0
EndIf
Text 0,140,"Playing? "+ObjectPlaying(zero)
Text 0,160,"Frame: "+ObjectFrame(zero)
DrawScreen
Until EscapeKey()
|
|