View.Set ("offscreenonly;graphics:600;250;nobuttonbar;position:100;100")
var xPos, yPos : real
var Angle : int := 0
var Move : array char of boolean
var xAim, yAim : real
var xBul, yBul : real
var Shoot1 : boolean := false
xPos := maxx div 2 - 10
yPos := 60
xAim := xPos
yAim := yPos
xBul := round (xPos)
yBul := round (yPos)
procedure Movement
Input.KeyDown (Move)
Draw.FillBox (round (xPos - 13), round (yPos), round (xPos + 13), round (yPos - 29), red)
Draw.ThickLine (round (xAim), round (yAim), round (xAim + cosd (Angle) * 30), round (yAim + sind (Angle) * 30), 9, red)
if Move (KEY_RIGHT_ARROW) then
if Angle > 0 then
Angle -= 2
end if
end if
if Move (KEY_LEFT_ARROW) then
if Angle < 180 then
Angle += 2
end if
end if
end Movement
procedure Shoot
if Move (KEY_ENTER) then
if yBul > maxy or yBul < 0 or xBul > maxx or xBul < 0 then
xBul := round (xPos)
yBul := round (yPos)
end if
Shoot1 := true
end if
if Shoot1 = true then
Draw.FillOval (round (xBul), round (yBul), 5, 5, red)
xBul += cosd (Angle) * 3
yBul += sind (Angle) * 3
end if
end Shoot
loop
Text.ColorBack (7)
cls
Draw.FillBox (0, 0, maxx, 30, 8)
Movement
Shoot
Time.DelaySinceLast (5)
View.Update
end loop
|