Computer Science Canada Help With Collision, |
Author: | Rasta Fella [ Mon Jan 16, 2006 9:29 pm ] | ||
Post subject: | Help With Collision, | ||
Well, yeah for my summative I'm making a obstacle type game. I'm not very fluent with the getch/hasch so looked for another alternative. Now I'm doing this movement using Input.Keydown and so what I do is so far all my obstacles have been boxes. So I my commands are like if x,y are in the box cordinate then reset from begining and count as death. Fairly simple, but now the problem is that is it possible to circles without changing my code to hash/getch or without using what dotcolour? Im thinking of doing like timed gates kind of thing that open and close but cant figure out a code. This is a code for one of my levels, it won't work because i kind of copied and pasted from different places in my code. An because it is my summative....but I will post it after summatives. Oh yeah...and its my first year in turing so.... i think you get the message.
|
Author: | [Flame][Boy] [ Mon Jan 16, 2006 10:36 pm ] |
Post subject: | |
whatdotcolor would probaly be an easy way to do it i dont see why you dont want to use it?? |
Author: | MysticVegeta [ Mon Jan 16, 2006 10:40 pm ] | ||
Post subject: | |||
No, Go with Math.Distance (Turing 4.0.5) If you dont have that then, use the following distance formula
I coulda made a silly error, didnt test yet. |
Author: | Delos [ Tue Jan 17, 2006 12:09 am ] |
Post subject: | |
Even better yet, check out the [Tuts] section. There are a couple of good tuts on collision detection, both regular and circular (which people always have trouble with). |
Author: | Rasta Fella [ Tue Jan 17, 2006 4:30 pm ] |
Post subject: | |
[Flame][Boy] wrote: whatdotcolor would probaly be an easy way to do it i dont see why you dont want to use it??
Well, first off I'm new to Turing, so I learned simple commands and trying to make a game. Teacher never taught us whatdotcolour, and too late for me to use it now even if I did read up on it. MysticVegeta wrote: No, Go with Math.Distance (Turing 4.0.5)
If you dont have that then, use the following distance formula Yes, I do have Turing 4.0.5 and I am going to read up on Math.Distance today and see how it works. Delos wrote: Even better yet, check out the [Tuts] section. There are a couple of good tuts on collision detection, both regular and circular (which people always have trouble with).
I checked Turing Walkthrough and looked at many programs, all I found were things like whatdotcolour. I'll see what I can find. But thanks for the help from everyone, I appreciate it. I have to say compsci.ca has a very productive forum, maybe someday everyone will have this as their homepage browser. |
Author: | MiX-MaztA-M8riX [ Tue Jan 17, 2006 6:48 pm ] |
Post subject: | |
Ok, from what I've seen here, I can only see examples and Tuts that help with Circle-Circle collision. I'm trying to find out how to make collision detection that won't go in the black areas. It works fine if I'm just working with the Input.KeyDown (if = UP then y+= 1), but now I'm using angles to move the character, and that collision detection doesn't seem to cut it anymore. Is it possible?, or am I running in circles here? Just ask for the code and I'll post it, if it's needed ![]() Thanks in advance. |
Author: | Delos [ Tue Jan 17, 2006 7:17 pm ] |
Post subject: | |
MiX-MaztA-M8riX wrote: ...that won't go in the black areas...
Quoi? Please elaborate, such a skeleton description is like trying to light a few with a cat's tail on a rainy day - you're wet, scratched, and have a possibly rabid cat in your hands. Neither are you warm, since the fire didn't start - not enough static electricity. Not a good thing. |
Author: | Rasta Fella [ Tue Jan 17, 2006 7:38 pm ] |
Post subject: | |
Delos wrote: Quoi? Please elaborate, such a skeleton description is like trying to light a few with a cat's tail on a rainy day - you're wet, scratched, and have a possibly rabid cat in your hands. Neither are you warm, since the fire didn't start - not enough static electricity. Not a good thing.
Umm... quite expressive, yeah MiX-MaztA-M8riX it could be helpful if you post not all but part of your code that you need help on. And if i'm right their is a way to detect diagnol, Check Turing Walkthrough. |
Author: | MiX-MaztA-M8riX [ Tue Jan 17, 2006 9:37 pm ] |
Post subject: | |
hahaha, wow, awsome example ![]() Anywayz! I was kinda going crazy when I posted that, so please excuse my gibberish. Heres the "Shooter.t" , and the "Arena.txt" |
Author: | MiX-MaztA-M8riX [ Wed Jan 18, 2006 6:03 pm ] |
Post subject: | |
so anybody got any insight as to keep the players inside the "arena" and out of the "black" areas. (if you dont know what I mean, run the .t) |
Author: | pavol [ Wed Jan 18, 2006 6:09 pm ] |
Post subject: | |
you could use whatdotcolor and check for black pixles |
Author: | MiX-MaztA-M8riX [ Wed Jan 18, 2006 9:56 pm ] |
Post subject: | |
I already tried that, they still get through, I dunno, maybe its not possible when I'm running around with angles. |
Author: | jrblast [ Wed Jan 18, 2006 10:29 pm ] |
Post subject: | |
MiX-MaztA-M8riX, Why not try getting the users quadrant (as in, where in the txt file the user is on) simply say "x div 10" and "y div 10" the div gives you the max number, and then if you want (just a side note) you can use mod to get the remainder (haven't used remainders in like 6 years though :S) then check if where the user is trying to go is a 1 dont move the user. Understand? If not, then you can try to use a for loop to detect colision with each 1... i like the first idea better, probably easier to do, harder to understand from my explanation... ![]() Btw, perhaps add a line coming out of the user so you can see where theyre pointing? control is l1k3 zub3r h4rd! |