Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 whatdotcolor for collision detection
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
guttface




PostPosted: Wed Feb 04, 2004 6:01 pm   Post subject: 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
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed Feb 04, 2004 6:14 pm   Post subject: (No subject)

you could, but if you do, it would be too late by that point Laughing

and this is not a tutorial, it's a question... and should be posted in [Turing Help]
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Paul




PostPosted: Wed Feb 04, 2004 6:15 pm   Post subject: (No subject)

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 Sad , 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.

code:

%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




PostPosted: Wed Feb 04, 2004 8:08 pm   Post subject: (No subject)

thaks. sorry about posting in the wrong spot. it was my first post.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: