var win1 : int
var num1, num2 : int
num1 := 380
num2 := 73
%Open window
win1 := Window.Open("nocursor;title;Gunner;graphics:800;600;position:center;top")
Draw.FillBox (360, 3, 400, 33, black)
Draw.FillOval (380, 33, 20, 23, black)
Draw.Oval (380, 33, 19, 22, brightred)
Draw.FillBox (360, 3, 400, 33, black)
Draw.FillBox (370, 3, 390, 13, brown)
Draw.Line (380, 3, 380, 13, black)
Draw.Dot (382, 8, black)
Draw.Dot (378, 8, black)
Draw.FillBox (365, 23, 395, 18, brightblue)
Draw.Line (400, 34, 360, 34, red)
Draw.FillOval (380, 35, 5, 5, gray)
Draw.Line (385, 40, 375, 30, black)
Draw.ThickLine (0, 0, maxx, 0, 5, green)
View.Set ("offscreenonly")
% Create cannon & movement process
%====================================================================
process tower
var move : array char of boolean
loop
Draw.ThickLine (380, 35, num1, num2, 7, white)
if (num1 > 380) then
Input.KeyDown (move)
if move (KEY_RIGHT_ARROW) then
num1 := num1 + 1
num2 := num2 - 1
elsif move (KEY_LEFT_ARROW) then
num1 := num1 - 1
num2 := num2 + 1
end if
elsif (num1 < 380) then
Input.KeyDown (move)
if move (KEY_RIGHT_ARROW) then
num1 := num1 + 1
num2 := num2 + 1
elsif move (KEY_LEFT_ARROW) then
num1 := num1 - 1
num2 := num2 - 1
end if
elsif (num1 = 380) then
Input.KeyDown (move)
if move (KEY_RIGHT_ARROW) then
num1 := num1 + 1
num2 := num2 - 1
elsif move (KEY_LEFT_ARROW) then
num1 := num1 - 1
num2 := num2 - 1
end if
end if
if (num1 = 420) then
num1 := num1 - 1
num2 := num2 + 1
end if
if (num1 = 340) then
num1 := num1 + 1
num2 := num2 + 1
end if
Draw.ThickLine (380, 35, num1, num2, 7, brightred)
Draw.FillOval (380, 33, 20, 23, black)
Draw.FillBox (360, 3, 400, 33, black)
Draw.FillBox (370, 3, 390, 13, brown)
Draw.Line (380, 3, 380, 13, black)
Draw.FillBox (365, 23, 395, 18, brightblue)
Draw.ThickLine (400, 34, 360, 34, 2, red)
Draw.FillOval (380, 35, 5, 5, gray)
Draw.Line (385, 40, 375, 30, black)
Draw.Dot (382, 8, black)
Draw.Dot (378, 8, black)
View.Update
delay (30)
end loop
end tower
%=========================================================================
%Create the firing mechanism
var gun1 : int
gun1 := 0
%=========================================================================
process shoot
loop
var fire : array char of boolean
Input.KeyDown (fire)
if fire (KEY_SHIFT) then
loop
gun1 := gun1 + 1
Draw.FillBox (num1 + gun1, num2 + gun1, num1 + 4 + gun1, num2 + 4 + gun1, black)
delay (100)
Draw.FillBox (num1 + gun1, num2 + gun1, num1 + 4 + gun1, num2 + 4 + gun1, white)
end loop
end if
end loop
end shoot
%==========================================================================
fork tower
fork shoot
|