View.Set ("offscreenonly")
colorback (black)
cls
var time2 := 0
function distance (x1, y1, x2, y2 : real) : real
result (((x1  x2) ** 2 + (y1  y2) ** 2) ** .5)
end distance
var chars : array char of boolean
type projectile_t :
record
startx, starty, x, y, angle, weight, velocity : real
end record
type player_t :
record
x, y, w, v, t : real
end record
var projectile_1 : projectile_t
var player_1 : player_t
player_1.x := 100
player_1.y := 100
player_1.v := 50
player_1.w := 10
player_1.t := 0
projectile_1.startx := 100
projectile_1.starty := 140
projectile_1.velocity := 80
projectile_1.angle := 90
projectile_1.weight := 10
var time1 := 0.0
var bjump_1 := false
procedure Projectile (var obj : projectile_t, t : real)
obj.x := (obj.velocity * cosd (obj.angle) * t) + obj.startx
obj.y := (obj.velocity * sind (obj.angle) * t  (obj.weight) * t ** 2 / 2) + obj.starty
end Projectile
procedure Jump (var obj : player_t)
obj.y := (obj.v * sind (90) * obj.t  (obj.w) * obj.t ** 2 / 2) + 100
obj.t += .1
end Jump
procedure ResetP (var obj : projectile_t, sx, sy, v, a, w : real)
projectile_1.startx := sx
projectile_1.starty := sy
projectile_1.velocity := v
projectile_1.angle := a
projectile_1.weight := w
end ResetP
color (10)
loop
if round (projectile_1.velocity) > 1 then
time1 += .1
else
player_1.x := 100
player_1.y := 100
player_1.v := 50
player_1.w := 10
player_1.t := 0
projectile_1.startx := 100
projectile_1.starty := 140
projectile_1.velocity := 80
projectile_1.angle := 90
projectile_1.weight := 10
time1 := 0.0
locate (10, 10)
put "eeeshta!"
cls
delay (200)
end if
Projectile (projectile_1, time1)
if projectile_1.y < 105 then
ResetP (projectile_1, projectile_1.x, projectile_1.y, round (projectile_1.velocity / 2), projectile_1.angle, projectile_1.weight)
time1 := 0
end if
if projectile_1.x < 1 then
ResetP (projectile_1, projectile_1.x, projectile_1.y, round (projectile_1.velocity / 1.3), projectile_1.angle  90, projectile_1.weight)
time1 := 0
end if
if projectile_1.x > 639 then
ResetP (projectile_1, projectile_1.x, projectile_1.y, round (projectile_1.velocity / 1.3), projectile_1.angle + 90, projectile_1.weight)
time1 := 0
end if
if projectile_1.y < 210 then
if projectile_1.x > 310 and projectile_1.x < 320 then
ResetP (projectile_1, projectile_1.x, projectile_1.y, round (projectile_1.velocity), projectile_1.angle  90, projectile_1.weight)
time1 := 0
end if
if projectile_1.x < 330 and projectile_1.x > 320 then
ResetP (projectile_1, projectile_1.x, projectile_1.y, round (projectile_1.velocity), projectile_1.angle + 90, projectile_1.weight)
time1 := 0
end if
end if
if distance (player_1.x, player_1.y, projectile_1.x, projectile_1.y) < 40 then
if projectile_1.x not= player_1.x then
locate (1, 1)
if arctand ((projectile_1.y  player_1.y) / (projectile_1.x  player_1.x)) < 0 then
ResetP (projectile_1, projectile_1.x, projectile_1.y, round (projectile_1.velocity), 180 + arctand ((projectile_1.y  player_1.y) / (projectile_1.x  player_1.x)), projectile_1.weight)
else
ResetP (projectile_1, projectile_1.x, projectile_1.y, round (projectile_1.velocity), arctand ((projectile_1.y  player_1.y) / (projectile_1.x  player_1.x)), projectile_1.weight)
end if
else
ResetP (projectile_1, projectile_1.x, projectile_1.y, round (projectile_1.velocity), 90, projectile_1.weight)
end if
time1 := 0
end if
if bjump_1 then
Jump (player_1)
if player_1.y < 100 then
bjump_1 := false
player_1.t := 0
player_1.y := 100
end if
end if
Input.KeyDown (chars)
if chars ('w') then
bjump_1 := true
end if
if chars ('a') then
player_1.x = 1
end if
if chars ('d') then
player_1.x += 1
end if
drawline (320, 100, 320, 200, yellow)
drawfilloval (round (player_1.x), round (player_1.y), 30, 30, 9)
drawfillbox (0, 0, 640, 100, 10)
drawfilloval (round (projectile_1.x), round (projectile_1.y), 10, 10, 12)
View.Update
delay (10)
drawfilloval (round (player_1.x), round (player_1.y), 30, 30, black)
drawfilloval (round (projectile_1.x), round (projectile_1.y), 10, 10, black)
drawline (320, 100, 320, 200, black)
end loop
