New Problem With The Scrolling


Quiest

I like turtles!
Joined
Sep 2, 2004
Messages
3,411
Age
38
Location
Dteuschland ;)
The following is the code I use for the scrolling af my new test level.

Code:
Process levelcam(x); //levelcam, so you can only scroll to the right
 Begin
   ctype=c_scroll;
   Loop     
     if(level1a=true)
       cam_x=x;
       if(key(_right) and x<412 and player_x>159 and not key(_left))keepposition=1;x+=playerspeed;end;
       if(player_x<160 or x>411)keepposition=0;end;
      end;
     Frame;
    End;
  End;


Process level1a(z); //process for the background
 Begin
   level1aforeground(1);
   parachute(10,-50,2);
   
   level1a=true;

   file=level1afpg;
   
   start_scroll(0,0,1,0,0,0);
   scroll.camera=idcam;
  End;

Process level1aforeground(z); //process for the foreground
 Begin
   file=level1afpg;
   
   start_scroll(1,0,2,0,0,0); //*
   scroll.camera=idcam; //**
  End;

* and ** should make the foreground scroll in the same way as the background.
But it doesn`t scroll, it just stay in the middle of the screen...
What is wrong? The 1 should mean scroll# 1 (as the other one is #0) and the 2 is the second graph in the fpg...
 

Moogle

.
Joined
Apr 27, 2004
Messages
283
Age
36
Location
Netherlands
Website
Visit site
scroll is actually a struct, and so if you want to change any variable on #1 you need to call scroll[1].camera. When you use scroll[0] you don't have to put the 'index', since if you don't Fenix assumes you mean #0.
 

Quiest

I like turtles!
Joined
Sep 2, 2004
Messages
3,411
Age
38
Location
Dteuschland ;)
Thanks, Moogle, again :)

Now it works perfectly. I don`t know how to use structs yet, and I don`t know what the benefits are using them in certain tasks. I saw it on devlkore`s Megarun, he used structs for the animations, and they can also be used for maptiles.
 

Moogle

.
Joined
Apr 27, 2004
Messages
283
Age
36
Location
Netherlands
Website
Visit site
They are one of the neatest features Fenix has, comparing a normal variable with a struct is like comparing blunt code to Fenix' processes. Once you know them you can't live without them :)
 
Top