setscreen ("graphics:800;600")
var chars : array char of boolean
var x, y : int
var enemyy1, enemyy2 : int
var enemyx1, enemyx2: int := 0
enemyy1 := Rand.Int (20, 600)
enemyy2 := Rand.Int (20, 600)
x := 700
y := 300
loop
Input.KeyDown (chars)
% move character
if chars (KEY_RIGHT_ARROW) then
y := y + 5
end if
if chars (KEY_LEFT_ARROW) then
y := y - 5
end if
%character
drawoval (x, y, 10, 10, red)
%enemy
drawoval (enemyx1, enemyy1, 10, 10, blue)
drawoval (enemyx2, enemyy2, 10, 10, black)
delay (20)
cls
enemyx1 := enemyx1 + 3
enemyx2 := enemyx2 + 3
put enemyx1
put enemyx2
end loop
|