var bulletx, bullety, x, y : int
bulletx := 0
bullety := 0
x := 25
y := 50
var keys : array char of boolean
var right : char := chr (205)
var left : char := chr (203)
var space : char := chr (32)
var enter : char := chr (10)
var esc : char := chr (26)
var bulletmove, movex, movey : int
movex := 0
movey := 0
bulletmove := 0
var show := false
put "Use arrow keys to move, Space to jump, and enter to shoot."
delay(1000)
cls
setscreen ("offscreenonly")
loop
if show = true then
drawfilloval (bulletx, bullety, 2, 2, 7)
end if
if bulletx > maxx then
show := false
end if
drawoval (x, y, 10, 10, 7)
Input.KeyDown (keys)
if keys (right) then
if y > 50 then
movex := 0
movex := movex + 2
else
movex := 0
x := x + 5
end if
elsif keys (left) then
if y > 50 then
movex := 0
movex := movex - 2
else
movex := 0
x := x - 5
end if
elsif keys (space) then
if y = 50 then
movey := 0
movey := movey + 5
end if
elsif keys (enter) then
bulletx := x + 5
bullety := y
show := true
end if
if y > 200 then
movey := -movey
elsif y < 50 then
y := 50
movey := 0
movex := 0
end if
if x < 0 then
x := 0
elsif x > maxx then
x := maxx
end if
y := movey + y
x := movex + x
delay (25)
bulletx := bulletx + 5
View.Update
cls
exit when keys (esc)
end loop
|