I just can't get into Bennu :(

Started by Toxic_death, August 31, 2009, 01:41:26 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Toxic_death

Hi.

I want to start programming with Bennu but there's only one huge problem annoying me.

There are no real tutorials. :(
I already read through the beginners tutorial found on the wiki (what does "frame;" do?...) but that doesn't really help. I already know about Integers, Strings, variables and stuff from TurboPascal. The tutorial doesn't explain how to realize something, like for example loading a sprite and moving it around with buttons.
I know there's already a shoot-em-up tutorial but I don't understand it, yet.

So could somebody please help me starting with Bennu?

Huge thanks in advance :D

darío

Hi, yes, lack of tutorials is a problem to get started in Bennu but with some effort and help it is not impossible.

I've written this code for you (is a how-to-load-sprite-and-move-it), try to understand it and post your questions. Also search for functions used in Bennu wiki.

You need to create a "myball.png" file in the same folder than your bennu code.


// Bennu functions are grouped into different modules. With the import
// command you tell Bennu to load those modules.
import "mod_video"
import "mod_key"
import "mod_proc"
import "mod_map"

// Entry point of the application (main process)
begin
// Initialize the video mode to a 640x480 and 16bpp depth
set_mode(640, 480, 16);

// Call another process
MyBall();

// Loop that will repeat until we press the ESC key
repeat
frame; // Frame sentence tells bennu that we are done with
       // this process and that it should update the screen,
       // and let's other processes to execute
       // If you have an infinite loop without it, it will
       // seem as if the program is freezed.
until (key(_esc)) // key function returns true if a key is being
  // pressed

let_me_alone(); // destroys all processes except this
end

process MyBall()
begin
// Load an sprite from a PNG file
// The load_png loads a png file and returns a 'MAP identifier'.
// By assigning this identifier to the local variable 'graph' of
// a process, we are making the process to use this sprite as the
// 'sprite of the process'
graph = load_png("./myball.png");

// Set the position of the process. If you don't do this, you won't
// see anything.
x = 320;
y = 240;

// Loop of the process. It is necessary because otherwise
// the end of the process will be reached and it will be destroyed
// Herein we also do the Keys detection.
loop
// Use A, D, W, S to move the process
if (key(_a)) x--; end
if (key(_d)) x++; end
if (key(_w)) y--; end
if (key(_s)) y++; end

frame;
end
end


hope that helps.

Darío
My sites:
Smart Fpg Editor - Painless FPG Edition for Bennu and PixTudio
fenixlib - .NET support for manipulating PixTudio, Bennu and Div graphic formats

josebita

There is a very recent tutorial made by Windgate @ http://bennu.ayudaprogramacion.net/, but it's in Spanish.

Most probably it will get translated into English at some point. In the meantime, you might be able to follow it will google translate.
We're working on the documentation, but it takes time, sorry for that :(

Anyway, feel free to ask for anything you don't understand.

Toxic_death

Awesome darío, thanks. That really helped. :)
But why do you have to execute the Myball process twice? At first, you declared it, and with "process Myball();" you started it or do you have to start it twice?

@ josebita:
No need to apologize, it's in my opinion better to translate the tutorial into a decent English instead of a quick and dirty translation, so I'll wait and maybe ask for some help if I get stuck :).

Windgate

Translate it to English... I dind't count with it by now... And my english is a little bit odd...

Maybe with an automatic translation system you could be helped.

Anyway I will think about translate my tutorial when I finish my exams...

Toxic_death:

First you declare the process with PROCESS MyBall(), only one time.

Then you can "summon" the PROCESS with MyBall(); as many times as you want.
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

josebita

@Windgate: I was kind of offering myself to do it, but later this month.

Toxic_death

Quote from: Windgate on August 31, 2009, 03:53:26 PM
Translate it to English... I dind't count with it by now... And my english is a little bit odd...

Maybe with an automatic translation system you could be helped.

Anyway I will think about translate my tutorial when I finish my exams...

Toxic_death:

First you declare the process with PROCESS MyBall(), only one time.

Then you can "summon" the PROCESS with MyBall(); as many times as you want.
Good luck for your exams. And thanks for clearing that process thing out :).
I think I'll give the google translation a try. :)

Quote from: josebita on August 31, 2009, 03:54:52 PM
@Windgate: I was kind of offering myself to do it, but later this month.
The month's over tomorrow. ;) (Just kidding.)

osk

Bennu is a concurrent language. You define some code for "processes", but the only code that is executed from de beginning is the main program. And from this, if you call a specific process, then its code starts executing at the same time the code of main program is executing too. The frame command is the signal for all process to show on the screen the results of the execution of their particular code in a syncronized manner...all processes must have at least one frame command at the end of its main loop.

Windgate

Quote@Windgate: I was kind of offering myself to do it, but later this month.

Cool Josebita, send me a private msg whenever you are ready for action, I have to develop a Credits document for the tutorial, you will be there xD
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

josebita

Quote from: Toxic_death on August 31, 2009, 04:18:35 PM
Quote from: josebita on August 31, 2009, 03:54:52 PM
@Windgate: I was kind of offering myself to do it, but later this month.
The month's over tomorrow. ;) (Just kidding.)

XD Well, for me it's exams time, therefore it's september :)

darío

Hehe, well sometimes it's also easy to help if you are specific with what you want :)
My sites:
Smart Fpg Editor - Painless FPG Edition for Bennu and PixTudio
fenixlib - .NET support for manipulating PixTudio, Bennu and Div graphic formats