English Forums > Helpdesk

I just can't get into Bennu :(

(1/3) > >>

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.


--- Código: ---// 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

--- Fin del código ---

hope that helps.

Darío

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.

Navegación

[0] Índice de Mensajes

[#] Página Siguiente

Ir a la versión completa