alias spin { set %go 1 window -p @spin -1 -1 600 400 drawtext -nc @spin 4 Tahoma 20 250 250 500 500 Press enter to start! } alias start { drawrect -f @spin 1 1 1 1 1000 1000 drawtext -n @spin 3 Tahoma 20 20 600 Score: $iif(%score,$v1,0) unset %go hmake spin 12 var %y 1 while %y <= 12 { hadd spin %y 1 inc %y } var %x 1 while %x <= 12 { drawrect -nf @spin 4 1 $boxes(%x) 20 40 40 inc %x } set %upos 370 Set %c 0 drawrect -nf @spin 3 5 %upos 550 40 40 set %boxhe 20 .timermove 0 3 movebox drawdot @spin } alias movebox { inc %boxhe 60 if %boxhe > 500 { gameover } var %x 1 while %x <= 12 { if ($hget(spin,%x)) { drawrect -nf @spin 1 1 $boxes(%x) $calc(%boxhe -60) 40 40 drawrect -nf @spin 4 1 $boxes(%x) %boxhe 40 40 } inc %x } drawdot @spin } alias boxes { if ($1 = 1) return 20 if ($1 = 2) return 90 if ($1 = 3) return 160 if ($1 = 4) return 230 if ($1 = 5) return 300 if ($1 = 6) return 370 if ($1 = 7) return 440 if ($1 = 8) return 510 if ($1 = 9) return 580 if ($1 = 10) return 650 if ($1 = 11) return 720 if ($1 = 12) return 790 } on *:keydown:@spin:*: { if ($keyval = 13) && (%go) { start } if (!%go) { if ($keyval = 37) { if (%upos <= 0) { halt } dec %upos 10 drawrect -nf @spin 1 5 $calc(%upos +10) 550 40 40 drawrect -nf @spin 3 5 %upos 550 40 40 drawrect @spin } elseif ($keyval = 39) { if (%upos >= 800) { halt } inc %upos 10 drawrect -nf @spin 1 5 $calc(%upos -10) 550 40 40 drawrect -nf @spin 3 5 %upos 550 40 40 drawrect @spin } elseif ($keyval = 32) { bullet } } } alias bullet { inc %c set $+(%,bulpos.,%c) 530 drawdot -n @spin 2 5 $calc(%upos +20) 530 $+(.timerbullet,%c) 0 0.7 /bullet1 %c $calc(%upos +20) drawdot @spin } Alias bullet1 { drawdot -n @spin 1 5 $2 $($+(%,bulpos.,$1),2) dec $+(%,bulpos.,$1) 10 drawdot -n @spin 2 5 $2 $($+(%,bulpos.,$1),2) if ($($+(%,bulpos.,$1),2) < 0) { $+(.timerbullet,$1) off } var %x 1 while %x <= 12 { if ($inrect($2,$($+(%,bulpos.,$1),2),$boxes(%x),%boxhe,45,40)) { drawrect -fn @spin 1 5 $boxes(%x) %boxhe 40 40 if (!%bul.yo.,$1) { set $+(%,bul.yo.,$1) 1 inc %score 10 } redoscore hadd spin %x 0 checkbox } inc %x } drawdot @spin } alias redoscore { drawrect -nf @spin 1 1 20 600 100 100 drawtext -n @spin 3 Tahoma 20 20 600 Score: %score } alias checkbox { var %x 1 while %x <= 12 { if ($hget(spin,%x)) { goto notdone } inc %x } .timerbullet* off .timermove off .timershoot off hfree spin unset %bulpos* drawrect -nf @spin 1 1 1 1 1000 1000 drawtext -n @spin 4 Tahoma 72 200 20 YOU WIN!!!! drawtext -n @spin 4 Tahome 20 200 100 press enter to play again set %go 1 :notdone } alias gameover { .timerbullet* off .timermove off .timershoot off hfree spin unset %bulpos* drawrect -nf @spin 1 1 1 1 1000 1000 drawtext -n @spin 4 Tahoma 72 200 20 GAME OVER! drawtext -n @spin 4 Tahome 20 200 100 press enter to play again set %go 1 } on *:close:@spin: { .timerbullet* off .timermove off .timershoot off if ($hget(spin)) hfree spin unset %bul* }