const Gravity := 2
var x, y := 100
var y_velocity := 0
var keys : array char of boolean
var tiles : array 0..35, 0..35 of int
setscreen ("offscreenonly,graphics:500;400")
var Height := 150
var Length := 150
var try : string
loop
Input.KeyDown (keys)
if keys (KEY_UP_ARROW) and y_velocity = 0 and y <= 100 then
y_velocity := 30
end if
if keys (KEY_LEFT_ARROW) and x > 0 then
x -= 10
end if
if keys (KEY_RIGHT_ARROW) and x < maxx then
x+= 10
end if
y_velocity -= Gravity
y += y_velocity
if y < 0 then
y := 0
y_velocity := 0
end if
if Math.DistancePointLine (x, y, 50, 100, 150, 100) < 15 then
if y_velocity < 0 then
y := 100
y_velocity := 0
else
y_velocity := y_velocity * -1
end if
end if
if Math.DistancePointLine (x, y, 300, 0, 300, 200) < 15 then
put "Game Over!"
exit
end if
if Math.DistancePointLine (x, y, 0, 300, 215, 300) < 15 then
put "Game Over!"
exit
end if
if Math.DistancePointLine (x, y, 500, 300, 300, 300) < 15 then
put "Game Over!"
exit
end if
if Math.DistancePointLine (x, y, 350, 100, 450, 100) < 15 then
if y_velocity < 0 then
y := 100
y_velocity := 0
else
y_velocity := y_velocity * -1
end if
end if
if Math.DistancePointLine (x, y, 300, 0, 700, 0) < 15 then
put "Game Over!"
exit
end if
if Math.DistancePointLine (x, y, 0,0,300,0) < 15 then
put "Game Over!"
exit
end if
Draw.FillOval(x,y,15,15,blue)
drawline(50,100,150,100,black)
drawline(300,0,300,200,brightred)
drawline(0,300,215,300,brightred)
drawline(500,300,300,300,brightred)
drawline(350,100,450,100,black)
drawline(300,0,700,0,brightred)
drawline(0,0,300,0,brightred)
View.Update
delay (15)
cls
end loop
|