Hi! I'm new to Bennu, but have been developing games in other languages for years, mostly in 3d, but now I want to try developing for handhelds like the Pandora. For the last 2 days or so, I've been reading up on the beginners tutorials and the syntax and functions in general, and got 2 questions so far which I didn't find help for in the tutorials.
1. How would I go about making a sprite animation of my player, say for walking etc. ? I guess I would be using strips, but I'm not sure how I would create a animation loop from one.
2. How do I target my player so that he is centered in view and the background view moves along as the player moves? Say, like in a RPG like Zelda.
wellcome,
First of all, you have several examples in bennupack for studying all of you sais.
http://bennupack.blogspot.com/
For the firs question, the animation, you need change in some frame the content of "graph" variable, for example an circled animation could be do with the next code:
procedure animation()
private
int current_index;
int num_images_of_amination = 5;
begin
file = load_fpg("my_fpg_file.fpg") ; // you need a fpg file with the five images of the animation, starting in the code 1 and ending in the code 5.
graph = 1;
// put the proccess in the position (100,100) of the screen.
X = 100;
Y= 100;
while(!key(_esc)) // it you press esc key the process break the loop and ends.
frame; // paint a frame in the screen
graph=graph+ 1; // advance to the next image
graph = (graph % (num_images_of_amination+1))+1 ; // if graph is greater than 6 we put the first image, 1. (because 6 mod 6 is 0 plus 1 is 1, 5 mod 6 is 5 plus 1 is 6, etc)
end
unload_fpg(file);
end
if you dont want change the image in each frame you need a counter. a list with the same number of images that contents the number of frames that the image keep in the screen and an if that change the graph variable only when the counter was greater than the number of frames.
For the second question, you need use a scroolled screen, to do it you need know the use of region, start_scroll, c_scroll and c_type.
http://wiki.bennugd.org/index.php?title=Start_scroll
Quote from: BlackCurtain on October 22, 2010, 02:25:37 PM
Hi! I'm new to Bennu, but have been developing games in other languages for years, mostly in 3d, but now I want to try developing for handhelds like the Pandora. For the last 2 days or so, I've been reading up on the beginners tutorials and the syntax and functions in general, and got 2 questions so far which I didn't find help for in the tutorials.
1. How would I go about making a sprite animation of my player, say for walking etc. ? I guess I would be using strips, but I'm not sure how I would create a animation loop from one.
2. How do I target my player so that he is centered in view and the background view moves along as the player moves? Say, like in a RPG like Zelda.
1. Creating an animation loop is very simple. Have a look at this example:
[code language="bennu"]
// main code
CONST
LOCAL
GLOBAL
int playerid;
int file1;
PRIVATE
BEGIN
main_id=id; // very important.
file1=load_fpg("player.fpg"); // load your gfx archive
playerid=player(50,50); // initiates the player process instance
LOOP
IF (key(_esc)) // quit the program, don't forget this.
BREAK;
END
FRAME;
END
END
PROCESS player(x,y);
PRIVATE
BEGIN
file=file1;
graph=1; // first frame of the animation
cytpe=c_scroll; // this is what keeps the player centered on the screen (in a scroll)
LOOP
IF (key(_up))
FRAME(100);
y=y-10;
END
IF (key(_down))
FRAME(100);
y=y+10;
END
IF (key(_left))
FRAME(100);
x=x-10;
END
IF (key(_right))
FRAME(100);
x=x+10;
END
graph+=1; // increase the frame
IF (graph>10) // last frame of your animation
graph=1; // return to the first frame
END
FRAME; // don't forget this, is very important.
END
END
[/code]
2. Keeping it centered on the screen is handled with the c_type variable. I'd recommend to look this up
in the wiki.
Hope this basic example will give you an idea.
Thanks for the quick replies. It was a lot easier than I thought, but I guess I'll first have to read up on this fpg-format. I haven't heard of it before. Is it some graphics archive file?
yes, it is a graphics container file, it goes of the spanish sentence "Fichero Para Graficos" ( file for graphics) invented for DIV for store several images with extra information (like control points) in a same file.
This file is not mandatory, you can load your images directly if they are "PNG" using "load_png" (http://wiki.bennugd.org/index.php?title=Load_png) function
You can do FPGs files with the same bennuGD [ur=http://wiki.bennugd.org/index.php?title=Tutorial:PNG_LoadDirectoryl]making your own tool[/url] or use the FPG editor made in BennuGD (http://forum.bennugd.org/index.php?topic=267.0) for and spanish user called PRG, or use FPG Edit 2009 (http://forum.bennugd.org/index.php?topic=619.0) (a windows tool to edit fpg files).
I think I get it. Thanks again.
Btw, how come there's so much activity on the Spanish side of the forum while the English side remains somewhat silent? And why is almost every single tutorial and example in spanish? I don't understand much of it and there seems to be some pretty useful and important stuff being posted there.. It's pretty deterrent for new users like myself.
Quote from: BlackCurtain on October 23, 2010, 04:33:55 AM
I think I get it. Thanks again.
Btw, how come there's so much activity on the Spanish side of the forum while the English side remains somewhat silent? And why is almost every single tutorial and example in spanish? I don't understand much of it and there seems to be some pretty useful and important stuff being posted there.. It's pretty deterrent for new users like myself.
There's only one reason:
(http://3.bp.blogspot.com/_DzlzsziynUM/THEv3L-Ls8I/AAAAAAAAA40/yv4qOzS41FA/s1600/Tucker+and+chicken.jpg)
People are too chicken to post in the English forums, or what? I would post in the Spanish forums if my Spanish was a little better.
I think the english people have afraid or mania to post in the bennu english forum, and there are many more spanish users.
The spanish people somethimes post the same news in both forums, but it's imposible replicate always the original spanish message to english, because it's not fun to do xDDD.
Anyway, the spanish users always help the english users with doubts in english forums, do not be afraid to ask :)
Quote from: BlackCurtain on October 23, 2010, 04:33:55 AM
I think I get it. Thanks again.
Btw, how come there's so much activity on the Spanish side of the forum while the English side remains somewhat silent? And why is almost every single tutorial and example in spanish? I don't understand much of it and there seems to be some pretty useful and important stuff being posted there.. It's pretty deterrent for new users like myself.
I think the reason for this is historical. DIV gamesstudio was spanish orginally. It was translated to english, and two years later it was
marketed in the netherlands, after that, a british company (the now defunct fasttrack) bought the rights.
I see. Well, I think I can manage anyway without the Spanish forum.
Quote from: handsource-dyko on October 23, 2010, 09:08:16 AM
I think the reason for this is historical. DIV gamesstudio was spanish orginally. It was translated to english, and two years later it was
marketed in the netherlands, after that, a british company (the now defunct fasttrack) bought the rights.
This is the reason for more spanish users. 90% of Bennu/Fenix users are from spain and latin america, they start with the original version 1 and 2 of Div Games Studios released in Spain/Italy/Portugal and some latin countries before english release by Hammer, when Hammer technologies still alive :)
All tutorials needs a translation... :-\
Quote from: Windgate on October 23, 2010, 09:04:10 PM
All tutorials needs a translation... :-\
Why not just make all tutorials in English from the start? English is pretty common in Spain too as well as most other European countries.
Myself am from Sweden and speak fluent English and can make myself somewhat understood in Spanish. But my Spanish is still a bit rusty to understand the complex level of Spanish used in the tutorials.
Because sometimes it's too hard for us to write in english. But don't be afraid to ask, sometimes we answer english questions (sometimes not, because if a tired member says dumb questions, in english... ;D (yes, it's for me :D)).
I saw english people don't like to use programs writen in spanish or made by an spanish guy, too. I don't know why (i think because they mistake us with "hoygans").
For us is too difficult to translate into english, especially with nobody who corrects us, but most of us can understand english perfectly, so don't be afraid ;)
...And tell your friends ;D
(http://2.bp.blogspot.com/_vEFXlL5iNj8/S9wAwb4O-iI/AAAAAAAAAoo/IOaEc_OKqWs/s1600/globish.jpg.bmp)
Btw, are there any FPG editors in English? I can get by with the GUI icons but it would be a lot more convenient with some English labels.
FPG Edit 2009
Quote from: DCelso on October 25, 2010, 12:57:33 PM
FPG Edit 2009
Oh, I didn't notice there was an option to switch the language. Thanks :)
Another quick question: is it possible to render simple shapes in mode 7 with Bennu? Like flat walls and boxes or anything other besides sprites and flat horizontal surfaces?
EDIT: Nvm, I read up on the limitations of mode 7 on wikipedia so I guess my walls and boxes are out.
Wall and boxes are only on mode8. M8 is not supported on Fenix/Bennu.
But we have similar libraries like Bennu3D, ETD, VSE or Yeti to do some 3D.
But if you want to still use mode7, look for "mod_expand" for simple 3D texture simulation, and it's very easy to port if you need.
Thanks :) Nah, I'm good with 3D atm. Been doing advanced 3d games for about 5-6 years and I already have a solid 3D engine, so now I want to kick it old-school on portable consoles ;)
Ok I'm back again with a problem I can't figure out. I'm currently working in Mode 7 and trying to get the players ship to shoot, it works but only if the player is located at 0,0. Here's my code
process shoot(x,y,angle)
begin
graph=1;
ctype=c_m7;
cnumber=c_0;
//x=father.x; //Tried this too, but then it only shoots from 0,0 regardless of the player location
//y=father.y; //Tried this too, but then it only shoots from 0,0 regardless of the player location
while (not out_region(id,0))
advance(16);
frame;
end
end
Player controls:
if (key(_w)) advance(100); end
if (key(_s)) advance(-100); end
if (key(_a)) angle+=2000; end
if (key(_d)) angle-=2000; end
if (key(_control)) shoot(x,y,angle); end
So how do I get the bullets to always shoot out from the players x/y position in a mode7 view?
I don't know if you can use OUT_REGION on mode7, try to change it to a simple LOOP, and don't move the shoots. You can see where they appear this way (and can debug easily).
And resolution must be the same as father, don't forget it.
And maybe... you don't set FILE variable of shoots, be carefull.
Quote from: Drumpi on October 27, 2010, 11:36:57 PM
I don't know if you can use OUT_REGION on mode7, try to change it to a simple LOOP, and don't move the shoots. You can see where they appear this way (and can debug easily).
And resolution must be the same as father, don't forget it.
And maybe... you don't set FILE variable of shoots, be carefull.
Don't move the shots? How should I make them move then? And why shouldn't I set the file variable on shots? What's a better way?
EDIT: The resolution thing fixed the problem. Thanks.
If you can't see a static shoot, how could you see a moving shoot? ;)
And i wanted to say that you MUST set the FILE variable every time you can. It's only a suggestion, but very usefull when you load more than one FPG.
I understand what you're getting at now, but I managed to fix it :) I appreciate all the suggestions. It was a long time I felt this noob. I perfectly understand the syntax of Bennu now but there's too many functions to learn in just a couple of days, what variables to use and where to put them, but I'll get there.
I understand that my sprites can have several control points which I find very convenient, but I don't quite understand how to access them, let say if I wanted my ship to shoot from 2 places at once. What does the INT POINTER x and INT POINTER y parameters do for get_point and how do I use the function properly to set the starting point for the shots? Do I need those parameters at all if the sprite already has control points?
Btw, sorry for all the questions, but the documentation is very slim and I don't understand much of the spanish forums and examples, so I very much appreciate your help.
EDIT: Nvm, I think I've got it. I just have to be patient and I'll get it right eventually :P Thanks for your help all!
The FPG Edit 2009, how come when it converts to 8-bit it turns every color blue/purple? Even if I make it with the proper 8-bit colors in Photoshop, it still turns blue in the editor.
When you create a new 8bits ftg, You need load a palette before press "accept" button, and after, you only can introduce images with colors that are in the loaded palette if you want have the same colors.
Quote from: DCelso on October 29, 2010, 05:48:11 PM
When you create a new 8bits ftg, You need load a palette before press "accept" button, and after, you only can introduce images with colors that are in the loaded palette if you want have the same colors.
I see. Though I found a work-around, if I checked the "Preserve exact colors" when indexing the sprite in Photshop, it turned up OK in the editor. Thanks for the tip btw!
I'm 8 years old with div-likes and still can't use all functions of Bennu ;D So don't worry. Absolutly noone could use all DIV/Fenix/Bennu full power.
Just work with functions you need and you will learn step by step ;)
you'r welcome.
Oh man, yet another problem, sorry for my noobishness but when my player's x-position goes past the 200000 pixel mark (the world is looping), the player suddenly disappears. Is this some region define thing?
what is your resolution value? X is an int, so it has a max value, if you overflow it, it reset to min value, so be carefull. I get same problem on mode7 and character desapear is because is on a different location than camera.
So try to using lower resolution or use "mod values".
Quote from: Drumpi on October 30, 2010, 06:00:34 PM
what is your resolution value? X is an int, so it has a max value, if you overflow it, it reset to min value, so be carefull. I get same problem on mode7 and character desapear is because is on a different location than camera.
So try to using lower resolution or use "mod values".
You mean the resolution-variable? I've set it to 100. Is there anyway to raise the max value of x or some other way to continue the world loop without doing
if(x>200000) x=0; end
?
If you don't use negative values, maybe you can use "unsigned int" (I remember there is this type, but i didn't use it). But, resolution=50 it's a good resolution for looooong maps (i used it for 2500x2000 pixels map). 100 is the best resolution for small maps, but if you play with some GBA games (like GT Advance) you can see that they use less than 30 and it works fine.
But if you are doing a looped world, maybe you must use "if(x>200000) x=0;", just think about it.
Quote from: Drumpi on October 30, 2010, 11:55:46 PM
But if you are doing a looped world, maybe you must use "if(x>200000) x=0;", just think about it.
I guess that'll work for now. Thanks again!
Removed my previous post to not fill the entire topic with double and tripple posts :P
I tried the method described in the MAC osx thread about running the game on Mac but that didn't work, nothing happens and when I try different options it complains about missing lib files. I did set the PATH:s though.