Autor Tema: Mode 7 horizon issues  (Leído 532 veces)

Breadcaster

  • Newbie
  • *
  • Mensajes: 41
  • Karma: 2
Mode 7 horizon issues
« en: Marzo 13, 2019, 02:49:26 am »
Hey everyone

Ive got some issues setting up mode 7 with Bennu. I set up a quick program and got everything set up with the right coordinates and height etc for the game Im making, but i cant get the horizon to work - no matter how much the value is changed, it wont seem to raise or lower? I dont know if Im doing anything wrong but nothing will work. I included the code below (its not very long) so you can see what I'm talking about...

Is this possibly to do with my version of bennu? is it broken in an old build?

Citar

IMPORT "mod_say";
IMPORT "mod_debug";
IMPORT "mod_proc";
IMPORT "mod_grproc";
IMPORT "mod_map";
IMPORT "mod_text";
IMPORT "mod_key";
IMPORT "mod_video";
IMPORT "mod_screen";
IMPORT "mod_draw";
IMPORT "mod_m7";
IMPORT "mod_scroll";

GLOBAL


gfx_floortest;
gfx_bgtest;

horizon_height=70;

cam_height=165;
cam_angle=90000;
world_focus=900;
cam_x=36150;
cam_y=105475;
 
color;
   
 
PROCESS int main();

PRIVATE

BEGIN

    set_mode(800,600, 16);
    set_fps(30,0);
   
    // load the fpg file with the graphics
    gfx_floortest=png_load("roadtest.png");
    gfx_bgtest=png_load("citybackground.png");

    put_screen(gfx_bgtest, gfx_bgtest);

    start_mode7(0, 0, gfx_floortest, -1, 0, 64); // last 0 possibly broken? :/
   
    say("mode7_window1 status: "+mode7_window1);
   
    m7[0].color=15;     // sets the color of the mode7 border (no. 0) to color #15.
   
    m7[0].camera=id;    // assign the camera of the first (no. 0) mode7 plane to the "main"
                        // process.
   
    m7[0].height=9;     // Lower the height of the camera, this is 32 by default.
   
    m7[0].distance=20;  // Place the position of the camera slightly closer to the process it
                        // follows. This is value is 64 by default.
                       
    m7[0].focus=900;    // standard value of the camera focus.

    m7[0].horizon=250;

    ctype=c_m7;         // set the ctype of the "main" process to the mode7 type.
   
   
    resolution=100;
   
    m7[0].height=165;
    angle=90000;
    m7[0].focus=900;
    x=36150;
    y=107425;
   
    // write instructions
    write(0 ,20,30,ALIGN_CENTER_LEFT,"Mode 7 test demo");
   
    write(0 ,20,50,ALIGN_CENTER_LEFT,"Current settings:");
    write(0 ,20,60,ALIGN_CENTER_LEFT,"Height:");
    write_int(0 ,80,60,ALIGN_CENTER_LEFT, &m7[0].height);
    write(0 ,20,70,ALIGN_CENTER_LEFT,"Horizon:");
    write_int(0 ,80,70,ALIGN_CENTER_LEFT, &m7[0].horizon);
    write(0 ,20,80,ALIGN_CENTER_LEFT,"Focus:");
    write_int(0 ,80,80,ALIGN_CENTER_LEFT, &m7[0].focus);
    write(0 ,20,90,ALIGN_CENTER_LEFT,"X and Y:");
    write_int(0 ,80,90,ALIGN_CENTER_LEFT, &X);
    write_int(0 ,150,90,ALIGN_CENTER_LEFT, &y);

    write_int(0 ,80,100,ALIGN_CENTER_LEFT, &angle);

    write(0 ,20,70+50,ALIGN_CENTER_LEFT,"W S A D to steer");
    write(0 ,20,80+50,ALIGN_CENTER_LEFT,"Up and down arrows to adjust height");
    write(0 ,20,90+50,ALIGN_CENTER_LEFT,"Y and H to adjust horizon");     
    write(0 ,20,100+50,ALIGN_CENTER_LEFT,"I and K to adjust focus");
   
   
    WHILE (NOT key(_esc))
       
        // advance main object
        IF (key(_w));
           advance(250);
        END
       
        // advance main object
        IF (key(_s));
           advance(-250);
        END
       
        // change angle of main object
        IF (key(_a));
           angle+=5000;
        END
       
        // change angle of main object
        IF (key(_d));
           angle-=5000;
        END
        If (key(_up));
           m7[0].height+=5;
        End
        If (key(_down));
           m7[0].height-=5;
        End       
 
        If (key(_Y));
           m7[0].horizon+=100;
        End
        If (key(_H));
           m7[0].horizon-=100;
        End       
        If (key(_I));
           m7[0].focus+=5;
        End
        If (key(_K));
           m7[0].focus-=5;
        End       
       
        FRAME;
    END
   
    stop_mode7(0);
   
    // kill all processes, execpt the "main" process.
    let_me_alone();
END

Any help or ideas would be appriciated - thanks a lot! :)

x