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

Username:   Password: 
 RegisterRegister   
 Colour Collision detection
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
mapmap




PostPosted: Tue May 18, 2010 4:14 pm   Post subject: Colour Collision detection

What is it you are trying to achieve?
I'm trying to create a game like bmtron on Turing
http://www.ccybernet.com/games/bmtron/bmtron.html

What is the problem you are having?
I don't know how I could have collision detection on my program and I want to know if I can have some sort of collision detection that checks if the character has went over someone else's trail.


Describe what you have tried to solve this problem
I have so far added collision detection to check if a player went off the screen and to check if the head of each others characters are touching which results in a tie.


Please specify what version of Turing you are using
4.1.1
Sponsor
Sponsor
Sponsor
sponsor
Monduman11




PostPosted: Tue May 18, 2010 4:18 pm   Post subject: Re: Colour Collision detection

post collision code please? cause i dont really know what ur trying to detect collision for.
mapmap




PostPosted: Tue May 18, 2010 4:21 pm   Post subject: Re: Colour Collision detection

did u play the game in the link?
Monduman11




PostPosted: Tue May 18, 2010 4:25 pm   Post subject: Re: Colour Collision detection

mapmap @ Tue May 18, 2010 4:21 pm wrote:
did u play the game in the link?

no it doesnt load for me says there's a java error.. but if u want to do the collision detection for the trails you could have something like
code:
if chars (KEY_LEFT_ARROW) and whatdotcolour (posx - 10, posy + 24) = black then
put" you have touched the trail of player whichever"
end if
mapmap




PostPosted: Tue May 18, 2010 4:28 pm   Post subject: Re: Colour Collision detection

oh thanks, is there a tutorial that explains it in more detail in the tutorial section?
Monduman11




PostPosted: Tue May 18, 2010 4:33 pm   Post subject: Re: Colour Collision detection

yea there is but i played the game and i know what you mean now.

well to do that you could have
Turing:

if chars (KEY_LEFT_ARROW) and whatdotcolour (posx - 10, posy + 24) = black then % lets say that black is the color of the trail
    put" you have lost the game"
elsif chars (KEY_LEFT_ARROW) and whatdotcolour (posx - 10, posy + 24) = blue then % lets say that blue is the color of the head
    put" you have tied the game"


hope that helps
Monduman11




PostPosted: Tue May 18, 2010 4:40 pm   Post subject: Re: Colour Collision detection

heres the link for the detailed collision detection tutorial by hacker dan
http://compsci.ca/v3/viewtopic.php?t=75
andrew.




PostPosted: Tue May 18, 2010 5:37 pm   Post subject: RE:Colour Collision detection

I would recommend not using colour collision detection. Instead, check for the coordinates of the trails. It will be a bit harder to code, but will work a lot better than colour detection.
Sponsor
Sponsor
Sponsor
sponsor
mapmap




PostPosted: Tue May 18, 2010 5:44 pm   Post subject: Re: Colour Collision detection

Why is using color collision detection not as good?
And would I have to store every single coordinate in a array and then check if every player has touched any of those coordinates every single time the program loops?
jcollins1991




PostPosted: Tue May 18, 2010 6:41 pm   Post subject: Re: Colour Collision detection

mapmap @ Tue May 18, 2010 5:44 pm wrote:
Why is using color collision detection not as good?
And would I have to store every single coordinate in a array and then check if every player has touched any of those coordinates every single time the program loops?


I'm not sure what reason andrew is suggesting against it, but IMO colour collision detection isn't very practical... The only way it's going to work is if you have different colours for each thing you're trying to check for collision with, and if you want to do anything like have the colours of the snake fade to black closer to the edge of the snake it probably wouldn't work... Since its a fairly small game (probably only like 50x50 grid) an array should work, if you're keeping track of direction of each player all you have to do is add one to the direction of their movement and check that position in the array... The nice thing about that approach is that you can code the logic part of the game however you want and decide on the specifics of the graphics later...

note: I don't actually know Turing so I'm not sure how this approach would work, but it's fairly simple so I'm hoping it'd work in Turing XD
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  [ 10 Posts ]
Jump to:   


Style:  
Search: