
-----------------------------------
guttface
Wed Feb 04, 2004 6:01 pm

whatdotcolor for collision detection
-----------------------------------
i'm tryin to make a maze game, and i was wondering if i could use whatdotcolor to detect if i ran into a barier

-----------------------------------
Tony
Wed Feb 04, 2004 6:14 pm


-----------------------------------
you could, but if you do, it would be too late by that point :lol: 

and this is not a tutorial, it's a question... and should be posted in [Turing Help]

-----------------------------------
Paul
Wed Feb 04, 2004 6:15 pm


-----------------------------------
This might help you, its not a maze, but the ball does stop on man made walls.
edit: I just realized this is not on turing help, sorry :( , but I suspect if someone wants it move that badly, a mod can do it easily.
It's just whenever I see a question, I automatically assume its the turing help section.


%movement
setscreen ("offscreenonly") 
var x, y : int 
x := 100 
y := 100 
var addx, addy : int := 0 
var chars : array char of boolean 

loop 
    drawfillbox (0, 0, maxx, maxy, black) 
    drawfillbox (10, 10, maxx - 10, maxy - 10, 0) 

    Input.KeyDown (chars) 

    if chars (KEY_UP_ARROW) then 
        if whatdotcolor (x, y + 11 + addy) = 0 
                then 
            y := y + 5 
        end if 
    end if 
    if chars (KEY_RIGHT_ARROW) then 
        if whatdotcolor (x + 11 + addx, y) = 0 then 
            x := x + 5 
        end if 
    end if 
    if chars (KEY_LEFT_ARROW) then 
        if whatdotcolor (x - 11 - addx, y) = 0 then 
            x := x - 5 
        end if 
    end if 
    if chars (KEY_DOWN_ARROW) then 
        if whatdotcolor (x, y - 11 - addy) = 0 then 
            y := y - 5 
        end if 
    end if 

    drawfilloval (x, y, addx + 10, addy + 10, red) 
    View.Update 
    delay (10) 
    cls 
    if chars (KEY_ENTER) then 
        addx := addx + 5 
        addy := addy + 5 
    end if 
    if chars (KEY_BACKSPACE) then 
        addx := addx - 5 
        addy := addy - 5 
    end if 
end loop 


-----------------------------------
guttface
Wed Feb 04, 2004 8:08 pm


-----------------------------------
thaks. sorry about posting in the wrong spot. it was my first post.
