mirror of https://github.com/dirtbags/moth.git
58 lines
827 B
Plaintext
58 lines
827 B
Plaintext
15 14 set-speed!
|
|
|
|
( Front )
|
|
5 sensor? {
|
|
get-turret 45 + 90 < { 15 15 } { 2 2 } ifelse set-speed!
|
|
0 set-turret!
|
|
} if
|
|
|
|
( Rear )
|
|
6 sensor? {
|
|
get-turret 45 + 90 < { 2 2 } { -15 -15 } ifelse set-speed!
|
|
180 set-turret!
|
|
} if
|
|
7 sensor? {
|
|
90 set-turret!
|
|
5 -5 set-speed!
|
|
} if
|
|
8 sensor? {
|
|
-90 set-turret!
|
|
-5 5 set-speed!
|
|
} if
|
|
|
|
1 sensor? {
|
|
get-turret 10 + set-turret!
|
|
} if
|
|
|
|
2 sensor? {
|
|
get-turret 10 - set-turret!
|
|
} if
|
|
|
|
3 sensor? {
|
|
get-turret 20 + set-turret!
|
|
} if
|
|
|
|
4 sensor? {
|
|
get-turret 20 - set-turret!
|
|
} if
|
|
|
|
0 sensor? {
|
|
0 0 set-speed!
|
|
get-turret set-turret!
|
|
fire!
|
|
} if
|
|
|
|
fire-ready? ! {
|
|
70 60 10 random +
|
|
get-turret 90 + 180 > { exch } if
|
|
set-speed!
|
|
} if
|
|
|
|
9 sensor? {
|
|
5 sensor? {
|
|
-100 -100
|
|
} {
|
|
100 100
|
|
} ifelse
|
|
set-speed!
|
|
} if |