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

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




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Martin




PostPosted: Thu Apr 14, 2005 6:14 pm   Post subject: (No subject)

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




PostPosted: Thu Apr 14, 2005 6:21 pm   Post subject: (No subject)

i dont understand what u mean by 2d array
Martin




PostPosted: Thu Apr 14, 2005 6:34 pm   Post subject: (No subject)

Search the forums for a 2d array tutorial.
Andy




PostPosted: Thu Apr 14, 2005 6:50 pm   Post subject: (No 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
Vertico




PostPosted: Thu Apr 14, 2005 7:00 pm   Post subject: (No subject)

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




PostPosted: Thu Apr 14, 2005 7:13 pm   Post subject: (No 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
Token




PostPosted: Thu Apr 14, 2005 7:52 pm   Post subject: (No 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
Sponsor
Sponsor
Sponsor
sponsor
jamonathin




PostPosted: Fri Apr 15, 2005 7:44 am   Post subject: (No subject)

I think you just took away andy's point.
Martin




PostPosted: Fri Apr 15, 2005 8:06 am   Post subject: (No subject)

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




PostPosted: Fri Apr 15, 2005 2:29 pm   Post subject: (No subject)

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




PostPosted: Fri Apr 15, 2005 4:25 pm   Post subject: (No 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
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  [ 12 Posts ]
Jump to:   


Style:  
Search: