and use code boxes, LOL
Rem Project: lion
Rem Created: 1/18/2007 7:12:40 PM
Rem ***** Main Source File *****
global SPR_LION as word = 1
global IMG_LION as word = 1
global EAST as integer = 1
global WEST as integer = 3
global NORTH as integer = 5
global SOUTH as integer = 9
global NORTHEAST as integer = NORTH + EAST
global NORTHWEST as integer = NORTH + WEST
global SOUTHEAST as integer = SOUTH + EAST
global SOUTHWEST as integer = SOUTH + WEST
`variables
sync on
sync rate 30
hide mouse
`set transparent color to pink
set image colorkey 255,0,255
`load the animated sprite from a single bitmap file
create animated sprite SPR_LION, "lionwalking.bmp",8,8,IMG_LION
`make sure all drawing goes to the screen
set current bitmap 0
do
`update the sprite frame each time thru the game loop
`draw the current sprite frame at x,y
horizontal = EAST
vertical = 0
mx = mousemovex()
my = mousemovey()
if abs(mx) < 1 and abs(my) < 1
set sprite frame SPR_LION,1
else
if mx > 0 then horizontal = EAST
if mx < 0 then horizontal = WEST
if my > 0 then vertical = NORTH
if my < 0 then vertical = SOUTH
play sprite SPR_LION,GetStartFrame(horizontal,vertical),GetEndFrame(horizontal,vertical),40
endif
sprite SPR_LION,mousex(),mousey(),IMG_LION
sleep 20
sync
loop
`*****************Get Start Frame************************************************************
`get the start frame for play sprite
`@parameter horizontal direction
`@parameter veritcal direction
`@ return starting frame
Function GetStartFrame(horizontal as integer, vertical as integer)
direction = horizontal + vertical
select direction
case 1: `EAST
startframe = 1
endcase
case 5: `NORTH
startframe = 8
endcase
case 6: `NORTHEAST
startframe = 17
endcase
case 8: `NORTHWEST
startframe = 24
endcase
case 9: `SOUTH
startframe = 32
endcase
case 10: `SOUTHEAST
startframe = 40
endcase
case 12: `SOUTHWEST
startframe = 48
endcase
case 3: `WEST
startframe = 56
endcase
endselect
endfunction startframe
`***********************Get End Frame******************************************************
`get the start frame for play sprite
`@parameter horizontal direction
`@parameter veritcal direction
`@ return starting frame
Function GetEndFrame(horizontal as integer, vertical as integer)
direction = horizontal + vertical
select direction
case 1: `EAST
endframe = 7
endcase
case 5: `NORTH
endframe = 16
endcase
case 6: `NORTHEAST
endframe = 23
endcase
case 8: `NORTHWEST
endframe = 31
endcase
case 9: `SOUTH
endframe = 39
endcase
case 10: `SOUTHEAST
endframe = 47
endcase
case 12: `SOUTHWEST
endframe = 55
endcase
case 3: `WEST
endframe = 63
endcase
endselect
endfunction endframe