setscreen ("offscreenonly;nobuttonbar;position:122;122;graphics:600;500")
var Ballx, Bally : int
var Move : array char of boolean
var Aimx, Aimy, Fire : int
var Bulletx, Bullety : int
var Shoot : boolean := false
Ballx := maxx div 2
Bally := maxy div 2
Bulletx := Ballx
Bullety := Bally
loop
Input.KeyDown (Move)
Mouse.Where (Aimx, Aimy, Fire)
colorback (green)
cls
Draw.FillOval (Ballx, Bally, 16, 16, 7)
Draw.ThickLine (Ballx, Bally, Aimx, Aimy, 5, 7)
if Fire = 1 then
Shoot := true
end if
if Shoot = true then
Draw.Oval (Bulletx, Bullety, 6, 6, 0)
Bulletx += Aimx div 50
Bullety += Aimy div 50
end if
% Draw.Oval (Bulletx, Bullety, 6, 6, 0)
if Bulletx > maxx or Bullety > maxy or Bulletx < 0 or Bullety < 0 then
if Fire = 1 then
Bulletx := Ballx
Bullety := Bally
end if
end if
delay (12)
View.Update
end loop
|