
-----------------------------------
weebly
Thu Jun 05, 2008 9:17 pm

using whatdotcolour for my game
-----------------------------------
i need to use watdotcolour for my game that i m making. it is basically like a space game, where you move around a space ship and try to dodge asteroid, if the asteroid hits the ship, it's game over, if not, then game continues until the ship has dodged 200 asteroids. what i need to know is how to detect the colosion of the asteroid an the ship. the background colour of the display is black. someone told me i need to use whatdotcolour, but i dont knoe how.

please respond ASAP, thank you


please tell me if u need my code, i will post that after  :D  :D  :D

-----------------------------------
weebly
Thu Jun 05, 2008 9:37 pm

RE:using whatdotcolour for my game
-----------------------------------
oh man, no one is answering :(

-----------------------------------
Tony
Thu Jun 05, 2008 9:41 pm

Re: using whatdotcolour for my game
-----------------------------------
someone told me i need to use whatdotcolour, but i dont knoe how.
It's ok, they don't know what they are talking about anyway.

whatdotcolour will tell you the colour of the pixel at a given location, treating the entire screen as a giant 2D array, full of pixels. The theory is that you check the colour at a location and determine collision from the colour. Except that colour don't overlap, you either see the asteroid or the ship (and even then, only for a certain colour and a certain pixel), then you have to figure out the rest from the locations.

so whatdotcolour becomes redundant, it's unreliable, and it's accuracy depends on how many pixels (and how) you check.

just look into the circular collision detection (that is, collision between two circles). It's a fairly good estimate to the shape of asteroids and/or ships.

http://compsci.ca/blog/wp-content/uploads/2007/10/circle_collision_detection.png

-----------------------------------
weebly
Thu Jun 05, 2008 10:06 pm

RE:using whatdotcolour for my game
-----------------------------------
ok, wow, u just confused me, dude, im a grade 9 student, this is my isp, please explain in simple words, given a code example, like u said 2 circles coliding, make a simple code for that and bit of explaination, and that will do it. 

and can u give me tips on how to check for collison, like, my background screen is black so do it say if whatdotcolour not = black, then put "game over" ? i need to understand the logic to it, and a bit of code example, but thnx for ur effort for trying to help me

thnx

-----------------------------------
Tony
Thu Jun 05, 2008 10:12 pm

RE:using whatdotcolour for my game
-----------------------------------
Try to work it out on paper first. I've already posted a picture of a diagram, above, to get you started.

-----------------------------------
weebly
Thu Jun 05, 2008 10:14 pm

RE:using whatdotcolour for my game
-----------------------------------
k, thnx

-----------------------------------
weebly
Thu Jun 05, 2008 10:16 pm

RE:using whatdotcolour for my game
-----------------------------------
but 1 more question, how can u keep tract of the coordinate of the ship and asteroids, there is not only one asteroid there r many asteroid coming at once, so how do i kepp tract of each of their coordinate. i guess this is my main problem. i get the logic now

-----------------------------------
weebly
Thu Jun 05, 2008 10:19 pm

RE:using whatdotcolour for my game
-----------------------------------
"someone told me i need to use whatdotcolour, but i dont knoe how".