FBA The Creator

The True Multiplatform PC / PocketPC Opensource Development Tool - Read Only Mode - Kept only for historical purposes - Thank you all ;)
It is currently Thu Jun 04, 2026 4:58 am

All times are UTC




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Apr 03, 2009 6:06 am 
Offline

Joined: Sun Jan 18, 2009 11:06 pm
Posts: 2
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


Top
   
PostPosted: Tue Apr 21, 2009 7:24 pm 
Offline
Tutorials Contributor
Tutorials Contributor
User avatar

Joined: Tue Jun 17, 2008 3:39 am
Posts: 59
Location: Midwest, US
You can look at my submission for the Ramen Timer. I animated the characters for that using FBA, not C++.

_________________
Don't look at me. I'm new here.


Top
   
PostPosted: Thu May 21, 2009 5:14 pm 
Offline

Joined: Tue May 12, 2009 1:31 pm
Posts: 7
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 :)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited