- This wiki is out of date, use the continuation of this wiki instead
 
Angle
From FenixWiki
(Difference between revisions)
												
			
			| Revision as of 01:50, 12 May 2007 (edit) Sandman (Talk | contribs) m ← Previous diff  | 
				Current revision (18:51, 3 April 2008) (edit) (undo) Sandman (Talk | contribs) m  | 
			||
| (5 intermediate revisions not shown.) | |||
| Line 1: | Line 1: | ||
| [[category:variables]] | [[category:variables]] | ||
| + | [[category:predefined]] | ||
| [[category:local variables]] | [[category:local variables]] | ||
| + | |||
| + | [[Local variables|'''Up to Local Variables''']] | ||
| + | |||
| + | ---- | ||
| + | |||
| == Definition == | == Definition == | ||
| - | '''INT''' angle | + | '''INT''' angle = 0 | 
| - | Angle is a predefined [[local variable]] which holds the angle (measured in 1/1000 of a degree) at which the [[graphic]] of that [[process]] (assigned by the [[graph]] [[ | + | '''Angle''' is a predefined [[local variable]] which holds the angle (measured in 1/1000 of a degree) at which the [[graphic]] of that [[process]] (assigned by the local variable [[graph]]) will be drawn. It also influences the result of the [[function]] [[advance]](). | 
| + | |||
| + | An angle of 0 means to the right, 90000 means up, 180000 means left and 270000 and -90000 mean down. | ||
| == Example == | == Example == | ||
| To make the graphic of a process spin: | To make the graphic of a process spin: | ||
| <pre> | <pre> | ||
| - | + | Program spinning_graphic; | |
| Begin | Begin | ||
| - |     graph =  | + | graph = new_map(100,100,8); //Create a cyan square and assign it to 'graph' | 
| - |     x =  | + | map_clear(0,graph,rgb(0,255,255)); | 
| - |     y = 100;     // | + | x = 160; //Position the graphic's center | 
| + | y = 100; //in the center of the screen | ||
| Loop | Loop | ||
| angle += 1000; //increase the angle of graphic by 1000 each frame. 1000 = 1 degree. | angle += 1000; //increase the angle of graphic by 1000 each frame. 1000 = 1 degree. | ||
| Line 21: | Line 30: | ||
| End | End | ||
| </pre> | </pre> | ||
| - | This process will spin the  | + | This process will spin the cyan square by 1 degree each frame. | 
| + | |||
| + | {{Locals}} | ||
Current revision
[edit] Definition
INT angle = 0
Angle is a predefined local variable which holds the angle (measured in 1/1000 of a degree) at which the graphic of that process (assigned by the local variable graph) will be drawn. It also influences the result of the function advance().
An angle of 0 means to the right, 90000 means up, 180000 means left and 270000 and -90000 mean down.
[edit] Example
To make the graphic of a process spin:
Program spinning_graphic;
Begin
    graph = new_map(100,100,8);  //Create a cyan square and assign it to 'graph'
    map_clear(0,graph,rgb(0,255,255));
    x = 160;     //Position the graphic's center
    y = 100;     //in the center of the screen
    Loop
        angle += 1000;    //increase the angle of graphic by 1000 each frame. 1000 = 1 degree.
        frame;
    End
End
This process will spin the cyan square by 1 degree each frame.
| Local variables | |
| • Angle • Bigbro • Father • File • Flags • Graph • Id • Region • Reserved • Resolution • Size • Size_x • Size_y • Smallbro • Son • X • Y • Z • | |
