Need Some More Help As Well...


Quiest

I like turtles!
Joined
Sep 2, 2004
Messages
3,411
Age
40
Location
Dteuschland ;)
I started to make the levels.
Now, scrolling doesn`t work like I want it to.

I use the scrolling type that follows the player, when he`s in the middle of the screen.

But as usual in Metal Slug, most levels only scroll to the right (or only one direction), so can someone tell me, how to make this work (only to the right in this case)?

I know there has to be a little command or something has to be changed.


Here is the code I used to test the scrolling:

Code:
Process player(x,y,z,flags);
 Begin
   file=charfpg;
   graph=1;
   ctype=c_scroll;
   Loop
     if(key(_right) and not key(_left))flags=0;dir=flags;x+=10;end;
     if(key(_left) and not key(_right))flags=1;dir=flags;x-=10;end;
        
     if(x>1830)x=1839;end;
     if(x<10)x=10;end;
     Frame;
    End;
  End; 


Process level1a(z);
 Begin
   file=level1afpg;
  
   if(dir==0)start_scroll(0,0,1,0,0,0);end;
   if(dir==1)stop_scroll(0);end; //tried to stop scrolling with this, but it didn`t work
   scroll.camera=idplayer;
  End;
 
there is no such thing for that. You'd have to improvise, for example use another process as the camera:

Code:
Process scrollLevel(cam,scrNum)
Begin
  scroll[scrNum].camera = id;

  while(exists(cam))

    //Y value can be normally traced, maybe with a maximum(bottom line)
    y = cam.y;
    if(y > 0) y=0;end

    //Only move forward
    if(x<cam.x)
      x = cam.x;
    end

    frame;
  end

End
 
Moogle posted on Mar 23 2005 at 08:24 PM said:
there is no such thing for that. You'd have to improvise, for example use another process as the camera:

Code:
Process scrollLevel(cam,scrNum)
Begin
  scroll[scrNum].camera = id;

  while(exists(cam))

    //Y value can be normally traced, maybe with a maximum(bottom line)
    y = cam.y;
    if(y > 0) y=0;end

    //Only move forward
    if(x<cam.x)
      x = cam.x;
    end

    frame;
  end

End


have you looked here quiest?

http://www.flamingbird.com/public_html/sta...030823121629101

hope theres something you can use!

sPaCe :D
 
Last edited by a moderator:
Hey thanks Moogle.
And special thanks to you, spaceboy, cause this tut already answers another question I was about to ask!

(I really love the Fenix board! :))


EDIT:

Okay Moogle, I got the idea, but as I found your code a bit too complicated (for me atleast :)), I did a simpler version: (I posted it just in case anyone is interested)

Code:
Program scrolltest;

Global;
 idcam;
 player_x;
 keepposition;
  
 charfpg;
 level1afpg;

Begin
 set_mode(320,240,16);

 level1afpg=load_fpg("level_1_a.fpg");
 charfpg=load_fpg("player.fpg");
 
 player(80,190,2,0);
 level1a(4); 
End;


Process player(x,y,z,flags);
 Begin
  file=charfpg;
  graph=1;
  
  idcam=levelcam(160);
  
  Loop
    if(key(_right) and not key(_left) and keepposition==0)flags=0;x+=10;end;
    if(key(_left) and not key(_right))flags=1;x-=10;end;
        
    if(x>310)x=310;end;
    if(x<10)x=10;end;
    
    player_x=x;
    
    Frame;
   End;
 End;
 
process levelcam(x);
 Begin
   ctype=c_scroll;
   Loop
     if(key(_right) and x<1687 and player_x>159 and not key(_left))keepposition=1;x+=10;end;
     if(player_x<160 or x>1686)keepposition=0;end;
     Frame;
    End;
  End;


Process level1a(z);
 Begin
   file=level1afpg;
   start_scroll(0,0,1,0,0,0);
   scroll.camera=idcam;
  End;

That was your idea, mostly, was it?
 
Back
Top