This wiki is out of date, use the continuation of this wiki instead

Frame

From FenixWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 20:43, 25 June 2007 (edit)
87.177.23.239 (Talk)

← Previous diff
Revision as of 20:50, 25 June 2007 (edit) (undo)
87.177.23.239 (Talk)

Next diff →
Line 1: Line 1:
-The '''frame;''' command tells the interpreter when a process is done for one game cycle.+'''Bold text'''The '''frame;''' command tells the interpreter when a process is done for one game cycle.
When the '''frame;''' is reached, the screen is updated. When the '''frame;''' is reached, the screen is updated.
If there are several processes running, the screen is updated once every process has reached it`s If there are several processes running, the screen is updated once every process has reached it`s
Line 6: Line 6:
It is commonly used in loops of processes that should do something like moving around by a certain It is commonly used in loops of processes that should do something like moving around by a certain
amount of pixels per game cycle (or per frame). amount of pixels per game cycle (or per frame).
 +
 +Example:
 +
 +<pre>
 +process square()
 + begin
 + graph = new_map(5,5,16);
 + map_clear(0,graph,rgb(255,255,255));
 +
 + loop
 + if(key(_left))x-=2;end;
 + if(key(_right))x+=2;end;
 +
 + frame; //<-vital part
 + end;
 + end;
 +</pre>
 +
 +This example process would give you a square you can move around the screen by 2 pixel before it
 +gets showed again, before the game cycle is over, before the '''frame;''' happens.
 +If there would be no '''frame;''' in the loop, it would just run and run and the interpreter would wait
 +and wait and wait for the '''frame;''' which would just result in freezing.

Revision as of 20:50, 25 June 2007

Bold textThe frame; command tells the interpreter when a process is done for one game cycle. When the frame; is reached, the screen is updated. If there are several processes running, the screen is updated once every process has reached it`s frame; statement.

It is commonly used in loops of processes that should do something like moving around by a certain amount of pixels per game cycle (or per frame).

Example:

process square()
 begin
   graph = new_map(5,5,16);
   map_clear(0,graph,rgb(255,255,255));

   loop
     if(key(_left))x-=2;end; 
     if(key(_right))x+=2;end;

     frame; //<-vital part
    end;
  end;

This example process would give you a square you can move around the screen by 2 pixel before it gets showed again, before the game cycle is over, before the frame; happens. If there would be no frame; in the loop, it would just run and run and the interpreter would wait and wait and wait for the frame; which would just result in freezing.

Personal tools