(sorry for my english ;) )
Hi, i'm quite new to Bennu, read tutorials, got a lot of examples, but I'm not sure how I can do my project.
I want to make a game & watch ( like Mario / Donkey Kong ...) on Caanoo. I have all the GFX, the sounds, all I need is to code it.
I know how to make my character move BUT in G&W, they don't have animations, they skip from one picture to another.
I think I can do like this :
[code language="bennu"]process player()
begin
file = FPG_id;
graph = 2;
x = 30;
y = 175;
loop
if (key(_right)) graph++; x+=40; end
if (key(_left)) graph--; x-=40; end
frame(500);
end[/code]
but i'm sure it won't work when the character will go up or down. I think this is not the right way.
Can someone give me a hint or advice, thanx.
Your code does not check if the last frame of the animation has been reached.
Then, it should return to the default graph.
Try this:
process player()
begin
file = FPG_id;
graph = 2;
x = 30;
y = 175;
loop
if (key(_right))
graph++;
x+=40;
end
if (key(_left))
graph--;
x-=40;
end
if (graph>10) // assing graph 10 is the last frame of the animation
graph=2;
end
frame(500);
end
Also, a tip, use indentation in your code instead of putting stuff on one line, indented code
is easier to read and reflects the logic flow.