whatdotcolor for collision detection
Author |
Message |
guttface
|
Posted: 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 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: 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
and this is not a tutorial, it's a question... and should be posted in [Turing Help] |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
Paul
![](http://i12.photobucket.com/albums/a207/paulbian/DDRDuck.png)
|
Posted: 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 , 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
|
|
|
|
|
|
![](images/spacer.gif) |
guttface
|
Posted: Wed Feb 04, 2004 8:08 pm Post subject: (No subject) |
|
|
thaks. sorry about posting in the wrong spot. it was my first post. |
|
|
|
|
![](images/spacer.gif) |
|
|