setscreen ("graphics:800;500")
setscreen ("nocursor")
var Bullet : int
var Game : int
var Tank : int
var Tankx : int := 320
var Tanky : int := -230
var x : int := 0
var y : int := 1
var Tank2 : int
var bulletX : int := 80
var movementX : int := 0
var movementY : int := 1
var bulletY : int := -170
var bulletflag : boolean := false
var chars : array char of boolean
Game := Pic.FileNew ("Game2.bmp") %Locates the picture
Pic.Draw (Game, 0, 0, 2) %Draws the picture
Tank := Pic.FileNew ("Tank.bmp") %Locates the picture
Pic.Draw (Tank, Tankx, Tanky, 2) %Draws the picture
Bullet := Pic.FileNew ("bullet.bmp") %Locates the picture
Tank2 := Pic.FileNew ("Tank2.bmp") %Locates the picture
Pic.Draw (Tank2, 240, 220, 2) %Draws the picture
procedure moveBullet
bulletX += movementX
bulletY += movementY
Pic.Draw (Bullet, bulletX, bulletY, 2) %Draws the picture
if bulletY >= 220 then
bulletflag := false
cls
locate (20, 10)
put "YOU WON!"
end if
end moveBullet
loop
Input.KeyDown (chars)
if chars (KEY_ENTER) then
bulletflag := true
end if
if bulletflag = true then
moveBullet
end if
if chars (KEY_RIGHT_ARROW) then
Pic.Draw (Game, 0, 0, 2)
Pic.Draw (Tank, Tankx + x, Tanky, 2) %Draws the picture
Pic.Draw (Tank2, 240, 220, 2) %Draws the picture
x := x + 12
end if
if chars (KEY_LEFT_ARROW) then
Pic.Draw (Game, 0, 0, 2)
Pic.Draw (Tank, Tankx + x, Tanky, 2) %Draws the picture
Pic.Draw (Tank2, 240, 220, 2) %Draws the picture
x := x - 12
end if
end loop
|