Main Menu

So...

Started by MisterN, April 02, 2011, 07:24:16 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MisterN

I think I will switch to bennu right after I fix this (then that meand that work will be sid by side with a newer dreamcast coder i found), the problem I am having after I switched back to .png though is everything is floating up.
[code language="fenix"]
Program platform_engine; 
//these are global variables 
Global
 
    //initializes the player's sprites 
    int Player_graph[14];
 
    //initializes the enemy(s) sprites
    //letter of alphabet sorts out the enemies
    int enemy_x_graph[12];
 
   //initializes the collectibles sprites
   int pellet_graph[1];
 
    //initializes the levelmask
   int level;
    int levelmask; 
 
//this sets up things like the games resolution and whatnot     
Begin 
    Set_mode(320,240,16); 
    Set_fps(20,0);   
 
    Map_clear(0,0,RGB(0,0,0)); 
    Write (0, 64, 16, 1, "Platform Game");

   //Starts the scroller
   scroller();
   
   //starts the levelmask (par on with the scroller, but is the mask for the levels)
   level_mask();
   
   //players fpg, and position
    Player(50,100);
 
   //enemy(s) fpg, and position
    EnemyX(260,100);
   
   //collectibles fpg, and position
   pellet(100,200);
   pellet(116,200);
   pellet(132,200);
   pellet(148,200);
 
    Loop 
        If (key(_esc)) 
        Exit("Bye",0); 
        End 
        Frame; 
    End 
End

//This process is for all the levels, menu's, and cutscenes
Process scroller()
Begin
   level=load_png(".\sprites\level\image\testlevel.png");
   start_scroll(0,0,level,0,0,0);//starts the scroll, variables:
   /*
   0: number of scroll, 0-9 are possible, this is the first one, so 0 :)
   0: fpg library you use, i only laoded 1 fpg, so it's 0 (the first library) in this case :)
   level: the map in the library chosen
   0: a background for the scroll you can choose (kind of second image scrolling
      with the same parameters, but not necessarily the same way, and in behind the previously
      selected image
   0:is the part of the screen the scroll is shown in, 0 is default region, the entire screen
      you can use this if you want to limit the size of the scrol (not in behind a menu or so)
      for performance issues i guess, thigns on the scroll also won't show outside the region.
      make sure you give your new regiona number other than 0 or it won't work ;)
   0:the flags:
      1:horizontal scroll of the map
      2:vertical scroll of the map
      4:horizontal scroll of the background
      8:vertical scroll of the background
      use: these are powers of two, it's like 4 bits,1=0001;2=0010,4=0100,8=1000
      add the together to get all the scrolls you cant, so 1+2=3 is the map scrolling both ways
      1+2+4=7 is map scrolling both ways, the background only scrolling horizontal
      1+8=9= the map scrolling hotizontal, the background scrolling vertical
      etc...
   */
       //sets the levels background images 
End

Process level_mask();
Begin
   levelmask=load_png(".\sprites\level\mask\testlevelmask.png");
End
 
//This process is for the player, all code that belongs to him is in this part 
Process Player(x,y) 
Private
    xspeed=3; 
    yspeed=0; 
 
    y_start_acceleration=4; 
    y_acceleration=0; 
 
    int fall; 
    int falling;    //indicate if character is in falling mode or not 
 
    jump=0; 
 
    int i; 
    int ii;         //you must say: counter to test every pixel of movement of hardness map 
    int pixel; 
    int red,blue,green; 
 
    int player_status; //0 is standing, 1 is walking, 2 is jumping, 3 is falling 
 
 
Begin
   //PlayerWalk Animations; it a good idea to repeat the same sprite 3 times so it doesn't 
    //look sped up unless you have many detailed frames, you can add as many as you want, just 
    //be sure to change int Player_graph[X] to the number of sprites you have (0 included, so 
    //its one number higher than the last Player_graph[X] you have 
    Player_graph[0]=load_png(".\sprites\player\Walk1.png");
    Player_graph[1]=load_png(".\sprites\player\Walk1.png");
    Player_graph[2]=load_png(".\sprites\player\Walk1.png");
    Player_graph[3]=load_png(".\sprites\player\Walk2.png");
    Player_graph[4]=load_png(".\sprites\player\Walk2.png");
    Player_graph[5]=load_png(".\sprites\player\Walk2.png");
    Player_graph[6]=load_png(".\sprites\player\Walk3.png");
    Player_graph[7]=load_png(".\sprites\player\Walk3.png");
    Player_graph[8]=load_png(".\sprites\player\Walk3.png");
    Player_graph[9]=load_png(".\sprites\player\Walk2.png");
    Player_graph[10]=load_png(".\sprites\player\Walk2.png");
    Player_graph[11]=load_png(".\sprites\player\Walk2.png");
    Player_graph[12]=load_png(".\sprites\player\Stand.png");
    Player_graph[13]=load_png(".\sprites\player\Jump.png");
    ctype=c_scroll; 
    Loop 
        //Player Movement 
        if (key (_left)) 
            flags = 1; 
            ii = 0; 
            while (ii <4) 
                pixel = map_get_pixel(0, levelmask, x-16, y);   
                get_rgb (pixel, & red, & green, & blue); 
                if (blue<201) 
                    ii = 0; 
                    break; 
                else 
                    if (player_status!=2 and player_status!=3) player_status=1; end 
                end 
                ii = ii + 1; 
            end 
            x = x-ii; 
        end 
        if (key (_right)) 
            flags = 0; 
            ii = 0; 
            while (ii <4) 
                pixel = map_get_pixel(0, levelmask, x + 16, y); 
                get_rgb (pixel, & red, & green, & blue); 
                if (blue<201) 
                    ii = 0; 
                    break; 
                else 
                    if (player_status!=2 and player_status!=3) player_status=1; end 
                end 
                ii = ii + 1; 
            end 
            x = x + ii; 
        end 
 
        if (!key(_left) and !key(_right) and player_status==1) 
            player_status=0; 
        end 
 
        // Jumping 
        if (key (_space)) 
            player_status=2; 
            falling=true; 
            pixel = map_get_pixel(0, levelmask, x, y +1 +15);   
            get_rgb (pixel, & red, & green, & blue);   
            if (blue<201) 
                fall =- 20;   
            end   
        end 
        // Implementation of fall.   
        ii = fall;   
        if(ii > 0)   
            while(ii != 0) 
                pixel=map_get_pixel(0, levelmask, x, y + (fall-ii) +15);
                get_rgb (pixel, & red, & green, & blue);   
                if (blue<201) 
                    ii = ii + 1; 
                    falling=false; 
                    say("I'm in ground now"); 
                    break; 
                end 
                ii = ii - 1; 
            end   
        else   
            ii = 0; 
        end   
        // Move the fall until we can.   
        y = y + (fall-ii); 
 
        //Ending of jumping and falling status 
        say("FALLING: "+falling+"   Player status: "+player_status); 
        if (player_status==2 and !key(_space)) player_status=3; end 
        if (player_status==3 and !falling) player_status=0; end 
 
 
        // Acceleration of gravity   
        if (ii == 0)   
            fall = fall + 3;   
            falling=true; 
        else   
            fall = 0; 
        end 
 
        //Player Status 
        //say(player_status); 
        switch (player_status) 
        case 0: graph=Player_graph[12]; end 
        case 1: 
            graph=Player_graph
            i=(i+1)%12; 
        end 
        case 2: graph=Player_graph[13]; end 
        case 3: graph=Player_graph[13]; end 
        end
 
        //say("frame"); 
        Frame;
      end
end
 
Process EnemyX (x,y) 
private 
int i;
int ii; 
int Xini;
int fall; 
int falling;
int pixel; 
int red,blue,green;
int inactive; 
begin
   //animations for the enemy
    enemy_x_graph[0]=load_png(".\sprites\enemies\x1.png");
    enemy_x_graph[1]=load_png(".\sprites\enemies\x1.png");
    enemy_x_graph[2]=load_png(".\sprites\enemies\x1.png");
    enemy_x_graph[3]=load_png(".\sprites\enemies\x2.png");
    enemy_x_graph[4]=load_png(".\sprites\enemies\x2.png");
    enemy_x_graph[5]=load_png(".\sprites\enemies\x2.png");
    enemy_x_graph[6]=load_png(".\sprites\enemies\x3.png");
    enemy_x_graph[7]=load_png(".\sprites\enemies\x3.png");
    enemy_x_graph[8]=load_png(".\sprites\enemies\x3.png");
    enemy_x_graph[9]=load_png(".\sprites\enemies\x2.png");
    enemy_x_graph[10]=load_png(".\sprites\enemies\x2.png");
    enemy_x_graph[11]=load_png(".\sprites\enemies\x2.png");
   Xini = x; 
   ctype = c_scroll; 
   loop 
      if(flags == 0) 
            ii = 0; 
            while (ii <3) 
                pixel = map_get_pixel(0, levelmask, x + 16, y); 
                get_rgb (pixel, & red, & green, & blue); 
                if (blue<201) 
                    ii = 0;
                    flags = 1; 
                    break; 
                end 
                ii = ii + 1; 
            end 
            x = x + ii;   
      else
         if(flags == 1) 
            ii = 0; 
            while (ii <3) 
                pixel = map_get_pixel(0, levelmask, x-16, y); 
                get_rgb (pixel, & red, & green, & blue); 
                if (blue<201) 
                    ii = 0;
                    flags = 0; 
                    break; 
                end 
                ii = ii + 1; 
            end 
            x = x-ii; 
        end
        end 
      i = i +1; 
      graph = enemy_x_graph [i%12];
      falling=true;
      if (inactive==0) 
            falling=true;   
        end 
        // Implementation of fall.   
        ii = fall;   
        if(ii > 0)   
            while(ii != 0) 
                pixel=map_get_pixel(0, levelmask, x, y + (fall-ii) +15); 
                get_rgb (pixel, & red, & green, & blue); 
                if (blue<201) 
                    ii = ii + 1; 
                    falling=false; 
                    say("I'm in ground now"); 
                    break; 
                end 
                ii = ii - 1; 
            end   
        else   
            ii = 0; 
        end   
        // Move the fall until we can.   
        y = y + (fall-ii);   
 
        // Acceleration of gravity   
        if (ii == 0)   
            fall = fall + 3;   
            falling=true; 
        else   
            fall = 0; 
        end   
      frame; 
   end
end
 
process pellet(x,y)
begin
   //loads the fpg
   graph=load_png(".\sprites\collectibles\pellet.png");
   ctype=c_scroll;
   loop
      if(collision(type player))
         break;
      end
      frame;
   end
end  [/code]
werg

josebita

I'm not sure I understand what your problem is...
I do see a small thing, though: if you want your code to be portable, be sure to change those "\" into "/". Otherwise file loading won't work on most operating systems apart from windows.

SplinterGU

me neither understand the problem...
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

l1nk3rn3l

#3
there other fenix distro , can be usefull for this problem..


http://www.dc-swat.ru/page/fenix/

forum fenix (new dreamcast version) creators
http://www.dc-swat.ru/forum/forum-29-page-1.html

handsource-dyko

Also for portibilty, remember that some filesystems are case sensitive. So, avoid mixing upper and lowercase letters. This isn't much of a problem on windows, but it is on linux. (I learned the hard way). I see that some filenames start with a uppercase character, so make sure that this is also the case for the filename on the disk. I once had a filename with only uppercase characters, but I had written it in all lowercase in the program, and on linux it the file would not load. One I renamed all the files the problem was gone.

MisterN

I fixed it all after talking to this russian guy (in russian)
werg

handsource-dyko

So, you now use fenix 0.93 instead of that old 0.84 version or is it a proper dc port of bennu?

MisterN

i use 0.94 fenix but im trying to convince him to make it auto load like .84 was, he told me hes been working on it and bennu is awhiles away but still in development. personally splinter (if he got the dreamcast already) could probably port it sooner and stuff. And I ehard about this 3D plugin for bennu that makes the games 3D. Dreamcast homebrew will soar if that is accomplished seeing as though every homebrew since then (for the most part) has been 2D.
werg

SplinterGU

I don't have dreamcast yet... I don't have news about the guy that will be send it to me...
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

MisterN

hmmmm..... my friend from agentina told me its like 40% to send to argentina. and dreamcasts are now $19.99 at the store i go to.
werg

SplinterGU

a dreamcast are $19.99??? here a dreamcast are start from 120$ (american dollar)!

I don't understand that you said about 40%.
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

MisterN

something about a 40% tax to send it im not sure. but seriously? even used? still worth it though, dreamcasts are awesome.
werg

SplinterGU

#12
yes, 40% is if you use a courrier, if you use the normal post and you send it as gift, then I don't must pay tax.

if you use a courrier then they don't reclaim pay about your declared product value, but they calculate the tax from local product value or value that they consider.
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

SplinterGU

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

MisterN

thats a brand new dreamcast. theres a mom and pop store i found on craigslist.
werg