- This wiki is out of date, use the continuation of this wiki instead
Process
From FenixWiki
A process is a subroutine to which one or more of the following apply:
- it received parameters
- it acts on the parameters
- it processes data located elsewhere
- it returns a value
In addition to these possibilities, a process always has a frame; statement. The difference between a function and a process is a process is treated as a seperate thread. This means one can't let a process return a value, as the father process continues its code as well. When a process comes to its first frame; statement, the process 'returns' its ProcessID and continues the code (in the next frame).
In earlier Fenix versions (2005 and earlier) there is no difference in syntax, however, a process is treated like a function when there is no frame; statement in the code.
Example
Process SpaceShip( int file , int graph , int x , int y , int angle , int maxspeed , int maxturnspeed ) Private int speed; Begin Loop speed+=key(_up)*(speed<maxspeed)-key(_down)*(speed>-maxspeed); angle+=(key(_up)-key(_down))*maxturnspeed; advance(speed); frame; End End
Now one can call this process for example by doing:
Private int map; Begin map = new_map(20,20,16); map_clear(0,map,rgb(0,255,255)); SpaceShip(0,map,100,100,0,20,5000); End