Author Topic: Collision Detection Help  (Read 9424 times)

0 Members and 3 Guests are viewing this topic.

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Collision Detection Help
« Reply #15 on: March 09, 2010, 06:42:02 pm »
Not quite yet. I'm kinda still excited that I figured it out :D I will in a second.

Edit: I tried it out. Nice, not sure I follow it all (just 'cause I haven't looked at it extensively) but cool. Thanks :)

The only thing I'm not following is why are you implementing the boundaries in this? The way they are working shouldn't as long as you have the outer boarder (like my string has) it shouldn't go off screen, right? (I know that is how my program works anyways.)
« Last Edit: March 09, 2010, 06:50:07 pm by meishe91 »
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Radical Pi

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1143
  • Rating: +5/-2
    • View Profile
    • RealityRevolution
Re: Collision Detection Help
« Reply #16 on: March 09, 2010, 06:53:14 pm »
Your most recent code doesn't work if you ever go into any of the screen's edges (A=1 or A=8 or B=1 or B=16) because even if you might not be trying to move in the offscreen direction, your code still ends up testing each space adjacent to you, of which one will be offscreen and cause an error.

It would be much easier to fix this up if we knew whether or not your maze would ever allow you onto those edges :P

EDIT: And there's my answer. So the problem is solved totally now?
« Last Edit: March 09, 2010, 06:53:55 pm by Nyrax »
One of these days I'll get a sig I'm really proud of.

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Collision Detection Help
« Reply #17 on: March 09, 2010, 06:59:17 pm »
Well ya, I know that. But for testing purposes this string has boarders all around the edge. I know once I get to work on the maze I will need to implement going off the edge. Thanks though :)
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Collision Detection Help
« Reply #18 on: March 09, 2010, 07:24:17 pm »
Ah, I see.  I was working on making it go off the screen. :)

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Collision Detection Help
« Reply #19 on: March 09, 2010, 07:26:51 pm »
Ya, I will have to implement that into the maze game. Still have a lot to figure out :P
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Collision Detection Help
« Reply #20 on: March 09, 2010, 08:11:41 pm »
I always had massive trouble with detecting collision when going out of the screen. In the past, I would make my matrices 10x18 instead of 8x16 but that wastes a lot of RAM

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Collision Detection Help
« Reply #21 on: March 09, 2010, 11:08:22 pm »
Hmmm, interesting.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Collision Detection Help
« Reply #22 on: March 09, 2010, 11:19:06 pm »
I always had massive trouble with detecting collision when going out of the screen. In the past, I would make my matrices 10x18 instead of 8x16 but that wastes a lot of RAM

Thats exactly what i did for Shift :) Maybe it wastes a but of mem, but it sure makes the engine a hell of a lot faster ;D I guess it depends on what kind of game your writing.  I had non tile-by-tile movement so I needed all the speed i could get O.O

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Collision Detection Help
« Reply #23 on: March 09, 2010, 11:24:31 pm »
I'm not entirely sure I understand what increasing the matrix by 2 in both ways does. Could someone explain that please?
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Collision Detection Help
« Reply #24 on: March 09, 2010, 11:29:18 pm »
Basically you have a border around your entire map that is not displayed, but is there so that when you try to move off the screen, the collision routine has something to find (or else it goes wacky).  This can be avoided by clever coding, but often times the code needs to be very very clever to still be fast.

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Collision Detection Help
« Reply #25 on: March 09, 2010, 11:31:43 pm »
Oh, ok. I get it. Interesting. Then why two more layers? Wouldn't a 9x17 work just as well?
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Collision Detection Help
« Reply #26 on: March 09, 2010, 11:34:15 pm »
well you need to increase it on both sides ;)

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Collision Detection Help
« Reply #27 on: March 09, 2010, 11:37:19 pm »
Oh! Wow, I'm tired. (Note to self: Don't let yourself get less than 30 min of sleep again...). Gotcha :D
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Collision Detection Help
« Reply #28 on: March 09, 2010, 11:40:38 pm »
Heh i feel your pain, getting up at 5:00 every day for band is killing me X.x

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Collision Detection Help
« Reply #29 on: March 09, 2010, 11:41:49 pm »
You get up at 5:00 for band?
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)