Experience Bennu

Started by SplinterGU, October 19, 2008, 03:48:45 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

SplinterGU

Sample and new mod_wm, with get_window_pos, get_window_size functions...

WIP14 is requiered...

changing this code


    initial_velocity_y=rand(-80,-(SCR_H-80));


for this


    initial_velocity_y=rand(-80,-(SCR_H-32));


the effects is better
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

SplinterGU

Better effect


import "mod_rand";
import "mod_wm";
import "mod_video";
import "mod_map";
import "mod_text";
import "mod_key";
import "mod_proc";

/* --------------------------------------------------------------------------- */

#define MAX_PROC    1

#define SCR_W   640
#define SCR_H   480

GLOBAL
    count;
    int ball;
    down, lateral;
    wposx, wposy;

/* --------------------------------------------------------------------------- */

process bounce_x_window(velocity)
begin
    while (velocity)
        set_window_pos(wposx+=velocity, wposy);
        lateral += velocity;
        velocity/=2;
        frame;
    end
end

process bounce_y_window(velocity)
begin
    while (velocity)
        set_window_pos(wposx, wposy+=velocity);
        down += velocity;
        velocity/=4;
        frame;
    end
end

/* --------------------------------------------------------------------------- */
   
process ball();
private
    velocity_x;         
    velocity_y;         
    initial_velocity_y;
begin
    x=0; y=(SCR_H-32)*10;
    resolution=10; 
    velocity_x=rand(10,80);
    initial_velocity_y=rand(-80,-(SCR_H-32));
    velocity_y=initial_velocity_y;
    graph = ball;
    loop
        x=x+velocity_x;
        if (x<0 or x>SCR_W*10)
            bounce_x_window(velocity_x/2);
            velocity_x=-velocity_x;
        end
        y=y+velocity_y;
        if (-velocity_y<=initial_velocity_y)
            bounce_y_window(velocity_y/8);
            velocity_y=-velocity_y;
        else
            velocity_y=velocity_y+20;
        end
        frame; 
    end
end

/* --------------------------------------------------------------------------- */

begin

    set_mode(SCR_W,SCR_H,32,MODE_WAITVSYNC);

    ball = load_png ("soccer.png");

    write_float(0, SCR_W/2, 10, 4, &frame_time);
    write_int(0, SCR_W/2, 20, 4, &speed_gauge);
    write_int(0, SCR_W/2, 30, 4, &fps);
    write_int(0, SCR_W/2, 40, 4, &count);
    write_int(0, 30, 10, 4, &wposx);
    write_int(0, 30, 20, 4, &wposy);

    for (count=0; count < MAX_PROC; count++)
        ball();
    end

while (!key(_ESC))
    get_window_pos(&wposx, &wposy);

        if (down>0)
            set_window_pos(wposx, wposy-=8);
            down-=8;
        end
        if (lateral > 0)
            set_window_pos(wposx-=4, wposy);
            lateral-=4;
            if (lateral < 0) lateral = 0; end
        else if (lateral < 0)
                set_window_pos(wposx+=4, wposy);
                lateral+=4;
                if (lateral > 0) lateral = 0; end
            end
        end
        frame;
end
let_me_alone();

end
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

MythomizeR

Cool sample, this is a more realistic game experience :-)

Sandman

I like this example; good work on the window manager module. :)
-- Sandman

blostec

Incredible! Its a cool effect, let's moving windows.  ;D

Prg

Wow. ¡¡¡Felicidades!!! Gran efeto para cuando los monstruos caminan o retumba la música

Y con vibración en un joystick cómo sería  :) ... Me imagino...  :o
en humos puedes mover la camara con los cursores. es necesario para los niveles a partir del dos :)