home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Beyond the 3rd Dimension
/
BEYOND3D.bin
/
ai
/
aiplane1.ait
< prev
next >
Wrap
Text File
|
1997-12-09
|
3KB
|
87 lines
: Flying AI / smooth taking off and landing up-dwon
: STATE Init // initialization STATE
: RUN SAVEPOS 3 0 // save current posiition to reg 3-5
: RUN SAVEPOS 6 0 // save current posiition to reg 6-8
: RUN SETREG 4 TIME // used for timer
: RUN ADDREG 4 3000
: RUN RNDREG 0 1000
: RUN SUBREG 0 500
: RUN ADDREG 4 REG0
: RUN SETSTATE FindPlace 0
: STATE FindPlace
: RUN SAVEPOS 6 0 // save current posiition to reg 3-5
: IF GT REG4 TIME THEN RETURN 0 0 ENDIF // wait first
: RUN RNDREG 0 40
: RUN SUBREG 0 20 // x = -10..10
: RUN ADDREG 0 REG3 // center x
: RUN RNDREG 2 40
: RUN SUBREG 2 20 // x = -10..10
: RUN ADDREG 2 REG5 // center z
: IF OUTRANGE REG0 REG2 THEN RETURN 0 0 ENDIF
: IF OPENSPACE REG0 REG2 THEN GOTOLABEL found 0 ENDIF
: RUN RETURN 0 0
* found
: RUN SETREG 1 REG0 //calculate mid point
: RUN ADDREG 1 REG6
: RUN MULREG 1 0.5
: RUN SETVAL POSX REG1
: RUN SETREG 1 REG2
: RUN ADDREG 1 REG8
: RUN MULREG 1 0.5
: RUN SETVAL POSZ REG1
: RUN SETVAL POSY 5
: RUN MOVE 2500 0 // use POSX-Z as goal osistion and duration -1
: RUN SETREG 1 REG0
: RUN SUBREG 1 REG6
: RUN SETVAL POSX REG1
: RUN SETREG 1 REG2
: RUN SUBREG 1 REG8
: RUN SETVAL POSZ REG1 // y is the same
: RUN SETVAL POSY 5
: RUN SETVAL ORNX 0
: RUN SETVAL ORNY 1.0
: RUN SETVAL ORNZ 0
: RUN ORIENT 1000 0 // orient to new driection in 1 sec using ORN+POS
: RUN SETREG 4 TIME
: RUN ADDREG 4 2501
: RUN SETSTATE Land 0
: RUN RETURN 0 0
: STATE Land
: RUN SAVEPOS 6 0 // save current posiition to reg 3-5
: IF GT REG4 TIME THEN RETURN 0 0 ENDIF
: RUN SETVAL POSX REG0
: RUN SETVAL POSY 0
: RUN SETVAL POSZ REG2
: RUN MOVE 2500 0 // use POSX-Z as goal osistion and duration -1
: RUN SETREG 1 REG0
: RUN SUBREG 1 REG6
: RUN SETVAL POSX REG1
: RUN SETREG 1 REG2
: RUN SUBREG 1 REG8
: RUN SETVAL POSZ REG1 // y is the same
: RUN SETVAL POSY 0.0
: RUN SETVAL ORNX 0
: RUN SETVAL ORNY 1.0
: RUN SETVAL ORNZ 0
: RUN ORIENT 1000 0 // orient to new driection in 1 sec using ORN+POS
: RUN SETREG 4 TIME
: RUN ADDREG 4 3500 // wait one second after landing and take off again
: RUN RNDREG 0 1000
: RUN SUBREG 0 500
: RUN ADDREG 4 REG0
: RUN SETSTATE FindPlace 0
: RUN RETURN 0 0
: END