rem -- Click on the plane to fire a missile at it. When the crosshair rem -- is on target, a "*Lock*" message will appear. The plane drops rem -- bombs at your bunker which shows an "x" for each hit. If you rem -- get over 3 bomb hits, you lose the game. If you destroy 25 rem -- planes before your bunker goes, you win the game. rem -- When you destroy the plane, it's bomb will disappear. This rem -- could prevent a bomb hit if you're fast enough... rem -- When you miss a "*Lock*", your missiles don't destroy the plane. rem -- If you can't handle the standard game, you can upgrade your rem -- missile speed with the "Missile Upgrade" checkbox. When you get rem -- 3 bomb hits, it's probably a good idea to do this anyway... rem -- Code Notes: Some things are moved off screen instead of using rem -- DIALOG HIDE/SHOW. Some styles are used by 2 or more elements, rem -- some use the foreground, some use the background, some use both. OPTION SCALE, 96 OPTION DECIMALSEP, "." %x = 5 %y = 40 %%missx = 232 %%missy = 345 TITLE By Mac DIALOG CREATE,"Anti-Aircraft",-1,0,500,400 rem -> If you don't have "Wingdings" font, rem this line -- DIALOG ADD,STYLE,Style1,Wingdings,12,BC,,BLACK DIALOG ADD,STYLE,Style2,Arial,12,C,,BLACK DIALOG ADD,STYLE,Style3,Arial,8,C,CYAN,BLACK DIALOG ADD,STYLE,Style4,Arial,12,B,LTBLUE,RED DIALOG ADD,STYLE,Style5,Arial,12,B,BROWN,LTGREEN DIALOG ADD,STYLE,Style6,Arial,8,C,BLACK,YELLOW DIALOG ADD,TEXT,Sky,25,0,500,275,,CROSS,CLICK,Style3 DIALOG ADD,TEXT,Ground,300,0,500,100,,CROSS,CLICK,Style5 DIALOG ADD,TEXT,Lock,0,600,36,,"*Lock*",Style3,TRANSPARENT DIALOG ADD,TEXT,BunkerBase,355,228,44,10,,Style6 DIALOG ADD,TEXT,Bunker,350,230,40,15,,Style6 DIALOG ADD,TEXT,RadarMast,335,240,40,20,"|",Style2,TRANSPARENT DIALOG ADD,TEXT,Radar,332,240,40,20,,Style3,TRANSPARENT DIALOG ADD,TEXT,Missile,%%missy,%%missx,,,"*",Style4,TRANSPARENT DIALOG ADD,TEXT,Bomb,0,600,5,2,,Style6 DIALOG ADD,TEXT,BunkerXXX,330,220,60,40,,Style5 DIALOG HIDE, BunkerXXX rem -> If you don't have "Wingdings" font, rem this line and use the following line -- DIALOG ADD,TEXT,Target,%y,%x,12,15,@chr(81),Style1,TRANSPARENT,CROSS,CLICK rem -> DIALOG ADD,TEXT,Target,%y,%x,12,15,">",Style2,TRANSPARENT,CROSS,CLICK DIALOG ADD,TEXT,Star1,0,500,,,"*",Style2,TRANSPARENT DIALOG ADD,TEXT,Star2,0,500,,,"*",Style2,TRANSPARENT DIALOG ADD,TEXT,Star3,0,500,,,"*",Style2,TRANSPARENT DIALOG ADD,TEXT,TX1,5,5,,,"Speed" DIALOG ADD,BUTTON,Slow,2,40,16,20,"<" DIALOG ADD,BUTTON,Fast,2,57,16,20,">" DIALOG ADD,TEXT,TX2,5,100,,,"Hits: Missed: Games Won: Games Lost:" DIALOG ADD,CHECK,CK1,5,400,,14,"Missile Upgrade",,CLICK DIALOG SHOW rem -- hits, misses, games won, games lost -- %h = 0 %m = 0 %w = 0 %l = 0 %s = 200 %%drop = 5 %%incoming = 1 %%bx = %x %%by = %y %%mspeed = 1 :EVLOOP REPEAT rem -- Get approx mouse pos on program window -- PARSE "%%mx;%%my", @mousepos() %%mx = @diff(@diff(%%mx, @winpos("Anti-Aircraft", L)), 3) %%my = @diff(@diff(%%my, @winpos("Anti-Aircraft", T)), 22) rem -- Show Target Lock -- if @both(@greater(%%mx, %x), @greater(@sum(%x, 12), %%mx)) if @both(@greater(%%my, %y), @greater(@sum(%y, 15), %%my)) DIALOG SETPOS, Lock, @sum(%%my, 10), @diff(%%mx, 15) else DIALOG SETPOS, Lock, 0, 600 end else DIALOG SETPOS, Lock, 0, 600 end if @greater(500, %x) %x = @succ(%x) else GOSUB Reset GOSUB Random %y = @prod(20, %r) %x = 1 %%drop = %r end if @equal(@mod(%x, 25), 0) DIALOG SET, Radar, "oo" end if @equal(@mod(%x, 50), 0) DIALOG SET, Radar, "o" end DIALOG SETPOS,Target,%y,%x if @equal(%%drop, %x) %%incoming = 1 %%bx = %x %%by = %y end rem -- Drop bomb, check for hit on bunker -- if %%incoming DIALOG SETPOS,Bomb,%%by,%%bx %%bx = @succ(%%bx) %%by = @succ(%%by) if @greater(%%by, 355) %%incoming = "" DIALOG SETPOS,Bomb,0,600 if @both(@greater(%%bx, 220), @greater(270, %%bx)) %%bombed = %%bombed"x" DIALOG SET, Bunker, %%bombed rem -- 4 hits and you're history -- if @greater(@len(%%bombed), 3) DIALOG SHOW, BunkerXXX INFO The bunker was destroyed.@cr()@cr()Your next of kin will be notified...@tab() %l = @succ(%l) DIALOG CLEAR, Bunker GOSUB NewGame DIALOG HIDE, BunkerXXX end end end end DIALOG SETPOS,Missile,%%missy,%%missx rem -- Have missile chase plane -- if %%fire if @greater(%%missx, %x) %%missx = @diff(%%missx, 1) end if @greater(%x, %%missx) %%missx = @sum(%%missx, 2) end if @greater(%%missy, %y) %%missy = @diff(%%missy, %%mspeed) else %%missy = %y end end rem -- Check for missile hit -- if @both(@equal(%%missx, %x), @equal(%%missy, %y))@both(@equal(@sum(%%missx, 1), %x), @equal(%%missy, %y)) if %%lock GOSUB DestroyPlane else %%fire = "" %m = @succ(%m) %%missx = 232 %%missy = 345 DIALOG SETPOS,Missile,%%missy,%%missx end end GOSUB Delay DIALOG SET, TX2,Hits:%h" "Missed:%m" "Games Won:%w" "Games Lost:%l %e = @event() UNTIL %e goto %e :SlowBUTTON %s = @sum(%s, 20) goto EVLOOP :FastBUTTON %s = @diff(%s, 20) if @greater(0, %s) %s = 0 end goto EVLOOP :CK1CLICK if @dlgtext(CK1) %%mspeed = 2 else %%mspeed = 1 end goto EVLOOP :TargetCLICK if @not(%%fire) DIALOG SETPOS, Lock, 0, 600 %%lock = 1 %%fire = 1 end goto EVLOOP :SkyCLICK %%fire = 1 goto EVLOOP :GroundCLICK goto EVLOOP :CLOSE EXIT rem --------- GOSUB ------------ :DestroyPlane GOSUB Reset DIALOG HIDE, Target %h = @succ(%h) %i = 0 REPEAT %y = @succ(%y) DIALOG SETPOS, Star1, %y, @diff(%x, %i) DIALOG SETPOS, Star2, %y, %x DIALOG SETPOS, Star3, %y, @sum(%x, %i) if @equal(@mod(%y, 25), 0) DIALOG SET, Radar, "oo" end if @equal(@mod(%y, 50), 0) DIALOG SET, Radar, "o" end %i = @succ(%i) GOSUB Delay UNTIL @greater(%y, 200) DIALOG SETPOS, Star1, 0, 600 DIALOG SETPOS, Star2, 0, 600 DIALOG SETPOS, Star3, 0, 600 GOSUB Random %y = @prod(20, %r) %x = 1 rem -- Check for player win -- if @greater(%h, 24) if @equal(%%mspeed, 1) INFO "You Won Commander!"@tab() else INFO "So you needed a missile upgrade to win..."@tab() end %w = @succ(%w) GOSUB NewGame end DIALOG SHOW, Target exit :NewGame DIALOG CLEAR, Bunker %%bombed = "" %h = 0 %m = 0 :Reset %%lock = "" %%fire = "" %%incoming = "" DIALOG SETPOS,Bomb,0,600 %%missx = 232 %%missy = 345 DIALOG SETPOS,Missile,%%missy,%%missx exit :Delay %d = %s REPEAT %d = @pred(%d) UNTIL @greater(1, %d) exit :Random rem -- Get random number using @datetime() with no parameters. %r = @datetime() rem -- Get last digit (use as random number) %r = @substr(%r, @len(%r)) rem -- We want 2 minimim -- if @greater(2, %r) goto Random end exit