Computer Science Canada

Help with whatdotcolor

Author:  Vertico [ Thu Apr 14, 2005 5:57 pm ]
Post subject:  Help with whatdotcolor

trying to make a pacman game, and i am stuck. im trying to get the oval 2 stop when it reaches the blue walls but when i try and do

code:
if whatdotcolor (x , y ) = blue then


it doesnt understand it and lets the oval go right throught the blue wall.
but if i put

code:
if whatdotcolor ( x, y ) not= black then

it works and stops when it hits the blue wall. this isnt good cuz i want 2 put in coins and warps but if it stops when its not black then that stuff isnt going to work.

can someone show me how 2 use this, or maby an easyer and faster way. thz. Very Happy

Author:  Martin [ Thu Apr 14, 2005 6:14 pm ]
Post subject: 

Don't use whatdotcolour, and instead use a 2d array to store your map.

Author:  Vertico [ Thu Apr 14, 2005 6:21 pm ]
Post subject: 

i dont understand what u mean by 2d array

Author:  Martin [ Thu Apr 14, 2005 6:34 pm ]
Post subject: 

Search the forums for a 2d array tutorial.

Author:  Andy [ Thu Apr 14, 2005 6:50 pm ]
Post subject: 

martin u sux... go whatdotcolour!! see you have to check the next step, you need to check if (x+1,y) or (x-1,y) or (x,y+1) or (x,y-1) is blue

Author:  Vertico [ Thu Apr 14, 2005 7:00 pm ]
Post subject: 

andy can u give me the exact code for that. PLZ Shifty

Author:  Andy [ Thu Apr 14, 2005 7:13 pm ]
Post subject: 

sure... why dont i just do the whole freaking project for you while im at it? use ur brain, thats why you have one, if you cant, then too bad, drop compsci

Author:  Token [ Thu Apr 14, 2005 7:52 pm ]
Post subject: 

heres what you have to do, you have to check if 1 pixel in front of your oval is blue, not the center of your oval, because it will obviously be blue.. so do somthing like this

code:

if whatdotcolor (x , y+radius ) = blue then %%if your heading up

Author:  jamonathin [ Fri Apr 15, 2005 7:44 am ]
Post subject: 

I think you just took away andy's point.

Author:  Martin [ Fri Apr 15, 2005 8:06 am ]
Post subject: 

Make sure you don't draw the pacman until AFTER you use the whatdotcolour.

Author:  Vertico [ Fri Apr 15, 2005 2:29 pm ]
Post subject: 

i found out what i was doing wrong. the picture was "brightblue" instead of just blue. even thou they look almost the same.

Author:  Token [ Fri Apr 15, 2005 4:25 pm ]
Post subject: 

no i didnt give him the exact code i just gave him an idea of what he had to do, if i were to give him all the code like the if statement for all 8 directions then that would be taking away andys point


: