
-----------------------------------
Adaub7282
Sun Feb 15, 2009 1:42 pm

Collisions with a platform
-----------------------------------

%Constants
const gravity :int := 2
%Variables
var x := 20
var y := 20
var y_velocity := 0
var keys : array char of boolean
var platx1, platx2, platy1, platy2 : int
platx1 := 100
platy1 := 20
platx2 := 300
platy2 := 30
%Graphics
View.Set("offscreenonly")
%Loop
loop
    Input.KeyDown  (keys)
    if keys (KEY_UP_ARROW) and y  0 then %move left
        x -= 5
    end if
    if keys (KEY_RIGHT_ARROW) and x < maxx then%move right
        x += 5
    end if
    
    if y = platy2 and x >= platx1 and x 