Hello! Here's the code:
sprite_direction = 0
sprite_frame = 1
sprite_count = 0
sprite_x = 160
sprite_y = 120
spriteset = loadimage("spriteset.png")
function draw_sprite()
local x = sprite_x - 12
local y = sprite_y - 32
local rx = sprite_frame * 24
local ry = sprite_dir * 32
drawimage(spriteset, x, y, rx, ry, rx + 24, ry + 32)
end
function frame_increase()
if sprite_count < 31 then
sprite_count = sprite_count + 1
else
sprite_count = 0
end
if sprite_count < 32 then sprite_frame = 2 end
if sprite_count < 24 then sprite_frame = 1 end
if sprite_count < 16 then sprite_frame = 0 end
if sprite_count < 8 then sprite_frame = 1
end
function onmainloop()
clear(0, 0, 0)
draw_sprite()
frame_increase()
if numkeypress(keyup()) > 0 then
sprite_y = sprite_y - 1
elsif ... repeat the branch for other directionalkeys
end
end
I hope that this script will help you... For the spriteset.png you can use a 72 * 128 png file divided in 12 24 * 32 rects. The first three rects are your character's up direction frames, the second are the right direction frames, the third are the down direction frames and the last three are the left direction frames. If you try google and type RPGMaker 2000 charaset you can find a lot of them.
To improve the script you should add a collision-check function.
Sorry for the bad english
