
-----------------------------------
CoD
Thu Jun 16, 2011 11:23 am

Need help with my Program
-----------------------------------
I need help with collision because if the circles touch eachother then the program ends but I can't get the circles to go behind one another and if they try the program ends.

colorback (black)
var x := maxx div 2
var y := maxy div 2
const INCREMENT : int := 10
var chars : array char of boolean
var shoot : boolean := false
var r := x + 10
var distance : real
var a := 100
var b := 170
var circle1rad : int
var circle2rad :int
circle1rad := 12
circle2rad := 12



loop
    cls
    Draw.FillOval (a + 20, b + 30,circle1rad, circle1rad , white)
    Draw.FillOval (x, y,circle2rad,circle2rad, red)

    Input.KeyDown (chars)
    if chars (KEY_LEFT_ARROW) and chars (KEY_UP_ARROW) then
        x := x - INCREMENT
        y := y + INCREMENT
        Draw.FillOval (x - 1, y - 1, 5, 5, red)
    elsif chars (KEY_RIGHT_ARROW) and chars (KEY_UP_ARROW) then
        x := x + INCREMENT
        y := y + INCREMENT
        Draw.FillOval (x + 2, y + 1, 5, 5, red)
    elsif chars (KEY_LEFT_ARROW) and chars (KEY_DOWN_ARROW) then
        y := y - INCREMENT
        x := x - INCREMENT
        Draw.FillOval (x - 1, y - 1, 5, 5, red)
    elsif chars (KEY_RIGHT_ARROW) and chars (KEY_DOWN_ARROW) then
        y := y - INCREMENT
        x := x + INCREMENT
        Draw.FillOval (x + 1, y + 1, 5, 5, red)
    elsif chars (KEY_LEFT_ARROW) then
        x := x - INCREMENT
        Draw.FillOval (x - 4, y - 1, 5, 5, red)
    elsif chars (KEY_RIGHT_ARROW) then
        x := x + INCREMENT
        Draw.FillOval (x + 5, y - 1, 5, 5, red)
    elsif chars (KEY_UP_ARROW) then
        y := y + INCREMENT
        Draw.FillOval (x + 1, y + 5, 5, 5, red)
    elsif chars (KEY_DOWN_ARROW) then
        y := y - INCREMENT
        Draw.FillOval (x - 1, y - 5, 5, 5, red)

    end if


    if chars ('a') and chars ('w') then
        a := a - INCREMENT
        b := b + INCREMENT
        Draw.FillOval (a + 20, b + 30, 5, 5, white)
    elsif chars ('a') and chars ('s') then
        a := a - INCREMENT
        b := b - INCREMENT
        Draw.FillOval (a + 21, b + 28, 5, 5, white)
    elsif chars ('d') and chars ('w') then
        a := a + INCREMENT
        b := b + INCREMENT
        Draw.FillOval (a + 22, b + 30, 5, 5, white)
    elsif chars ('d') and chars ('s') then
        a := a + INCREMENT
        b := b - INCREMENT
        Draw.FillOval (a + 20, b + 29, 5, 5, white)
    elsif chars ('a') then
        a := a - INCREMENT
        Draw.FillOval (a + 15, b + 29, 5, 5, white)
    elsif chars ('d') then
        a := a + INCREMENT
        Draw.FillOval (a + 25, b + 30, 5, 5, white)
    elsif chars ('w') then
        b := b + INCREMENT
        Draw.FillOval (a + 20, b + 36, 5, 5, white)
    elsif chars ('s') then
        b := b - INCREMENT
        Draw.FillOval (a + 20, b + 25, 5, 5, white)
    end if
    distance := sqrt ((x - a) ** 2 + (circle2rad - circle1rad) ** 2)
    if distance 