FBA The Creator
http://www.fbacreator.com/fbaforum/

How to make walking character
http://www.fbacreator.com/fbaforum/viewtopic.php?f=5&t=159
Page 1 of 1

Author:  ginger [ Fri Apr 03, 2009 6:06 am ]
Post subject:  How to make walking character

hi all,

I am studying FBA to create a game for my final project. I get difficulties when making moving character. I want to make the character to be able to walk. actually I already read and download the lesson from lazy Foo, but it is still difficult for me to understand the animation part because it in C++.

can somebody help me, give the sample of moving sprite for FBA .

Please help me to solve this issue

Thanks before :D

Author:  phrebh [ Tue Apr 21, 2009 7:24 pm ]
Post subject:  Re: How to make walking character

You can look at my submission for the Ramen Timer. I animated the characters for that using FBA, not C++.

Author:  napco [ Thu May 21, 2009 5:14 pm ]
Post subject:  Re: How to make walking character

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 :)

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/