Computer Science Canada collision for lots of circles |
Author: | be natural* [ Sun Jun 08, 2003 7:33 pm ] |
Post subject: | collision for lots of circles |
I'm trying to make collision detection work for my game.. there are a lot of circles up on the screen and i'm shooting a circle from a point. when the circle collide any of the circles it will stop & if they have the same colour, they'll disappear. I've tried making two circles disappear when they collide, but should i use an array for the centres of each circle if i want to use circle collision? |
Author: | Andy [ Sun Jun 08, 2003 7:38 pm ] |
Post subject: | |
you should, but you could also just use whatdotcolor |
Author: | be natural* [ Sun Jun 08, 2003 7:43 pm ] |
Post subject: | |
what's whatdotcolor? and can u explain how to use it? thx |
Author: | Andy [ Sun Jun 08, 2003 7:48 pm ] | ||||||
Post subject: | |||||||
whatdotcolor checks the color of one pixel
it returns the color of the pixel in integer format if you are shooting a projectile and the targets you are shooting are simply circles drawn by turing, you can just say
but using pythagorus is so much easier
if you have turing 4.01 or better, just type in the command and press F9 |
Author: | be natural* [ Mon Jun 09, 2003 8:40 am ] | ||
Post subject: | |||
i've tried to make circle collision but it doesn't really work... can anybody tell me what should i fix in my code? also, how can i identify the circles that are already disappeared so that the circle that is being shoot can pass through? i've attached the code below.
|
Author: | Prince [ Mon Jun 09, 2003 10:01 am ] |
Post subject: | |
http://www.compsci.ca/bbs/viewtopic.php?t=75 tutorial on collision detection... may help u |
Author: | Asok [ Mon Jun 09, 2003 3:40 pm ] |
Post subject: | |
omg, I just got an idea on how to use whatdotcolor for a collision detection game... PACHINKO! |
Author: | Andy [ Mon Jun 09, 2003 5:28 pm ] |
Post subject: | |
its really good if all of your targets are the same color |
Author: | Homer_simpson [ Mon Jun 09, 2003 5:44 pm ] | ||
Post subject: | |||
they dont need to be create a new color : solved!!!
|
Author: | be natural* [ Mon Jun 09, 2003 8:14 pm ] |
Post subject: | |
I got this error message Quote: "Array subscript is out of range" What does this mean? |
Author: | PaddyLong [ Mon Jun 09, 2003 8:19 pm ] |
Post subject: | |
it means you tried to acces an index in your array that isn't there... let's say you had var somearray : array 1..10 of int then you tried to do somearray (11) := 3 you would get array subscript out of range becuase somearray only goes up to 10 ... therefore there is no index 11 |