moth/packages/tanks/examples/insane/BoomStick/program

57 lines
1.1 KiB
Plaintext
Raw Normal View History

2012-07-23 16:33:40 -06:00
0 sensor? { 0 0 mset fire! }if
0 9 mset
8 sensor? {-36 get-turret + set-turret! 1 9 mset} if
4 sensor? { 36 get-turret + set-turret! 1 9 mset} if
2 sensor? {-18 get-turret + set-turret! 1 9 mset} if
1 sensor? { 18 get-turret + set-turret! 1 9 mset} if
7 sensor? { 0 get-turret + set-turret! 1 9 mset} if
fire-ready?
{
6 sensor?
{
9 mget ! { 0 set-turret! } if
100 100 set-speed! 5 0 mset
}
{
5 sensor? { 100 -80 set-speed! 5 0 mset} if
8 sensor? { -80 100 set-speed! 5 0 mset } if
}
ifelse
}
{
6 sensor? { 1 set-led! -100 -100 set-speed! 3 0 mset } if
5 sensor? { 1 set-led! -75 -100 set-speed! 3 0 mset } if
8 sensor? { 1 set-led! -100 -75 set-speed! 3 0 mset } if
}
ifelse
0 mget 0 =
{
0 set-led!
0 set-turret!
1 mget 0 =
{
0 set-turret!
3 random
dup 0 = {90 90 set-speed! 20 random 1 mset } if
dup 1 = {00 90 set-speed! 3 random 1 mset } if
dup 2 = {90 00 set-speed! 3 random 1 mset } if
}
{
1 mget 1 - 1 mset
}
ifelse
}
{
0 mget 1 - 0 mset
}
ifelse
3 sensor? { -10 -10 set-speed! 1 0 mset } if