Some newb questions

Started by BlackCurtain, October 22, 2010, 02:25:37 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

BlackCurtain

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.

DCelso

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
Monstruos Diabólicos

"A PAck of classic GAMEs For BennuGD" en desarrollo
http://code.google.com/p/apagame4be/

handsource-dyko

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.
   

BlackCurtain

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?

DCelso

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" 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 for and spanish user called PRG, or use FPG Edit 2009 (a windows tool to edit fpg files).
Monstruos Diabólicos

"A PAck of classic GAMEs For BennuGD" en desarrollo
http://code.google.com/p/apagame4be/

BlackCurtain

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.

FreeYourMind

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:


BlackCurtain

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.

FreeYourMind

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

handsource-dyko

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.

BlackCurtain

I see. Well, I think I can manage anyway without the Spanish forum.

FreeYourMind

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

Windgate

All tutorials needs a translation... :-\
Iván García Subero. Programador, profesor de informática, monitor de actividades culturales y presidente de TRINIT Asociación de Informáticos de Zaragoza. http://trinit.es

BlackCurtain

#13
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.

Drumpi

#14
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
Hala, como con 1001 procesos sólo va a 9 FPS, vamos a meterle 32 veces más, a ver si revienta.
(Drumpi epic moment)