User Tag List

Results 1 to 8 of 8

Thread: My collision detection just. dosn't. work.

  1. #1
    No Products Registered

    Join Date
    Sep 2006
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    My collision detection just. dosn't. work.

    Hi, I have programmed a fairly decent custom movement for the main character in my topdown action game. The collision detection worked just fine and did prevent my character from walking through walls (quick backdrops set to "obstacle"), but now when I added doors, it's all a mess.
    I have four collision detectors that surround my character, and when one of them are overlapping a background object OR a door, a value is set to 1, and it's not possible to move in that direction. When the detector doesn't overlap anything, the value returns to 0, and you can once again move in that direction. But it doesn't work.
    When it was obvious that something was wrong, I tried to track down the problem by adding ink effekt to the collision detectors which values are set to 1. This way I figured out that they don't alwasy return to 0 even though they aren't overlapping anything. Sometimes they do, but perhaps 50% of the times, they don't. I can't imagine why!
    Like I said, it worked when I didn't have any doors. =/
    Any ideas of what I might have missed?

    Anyway.

    How would you usually solve this kind of stuff? If you just could assign an obstacle type to active objects this would be so much easier. The way it is now you have to include every single active non-passable object in your code. Or am I missing something clever here?

    Thanks in advance
    /Tommy

  2. #2
    No Products Registered

    Join Date
    Jul 2006
    Location
    Germany
    Posts
    236
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: My collision detection just. dosn't. work.

    In the properties window you can add qualifiers to your active objects. This way you can ask:
    Is 'object1' overlapping 'group.1' -> Set 'Alt Val. A' to 1.

    You just have to add the qualifier '1' to every active object that is supposed to be an obstacle.

  3. #3
    No Products Registered

    Join Date
    Sep 2006
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: My collision detection just. dosn't. work.

    Thanks. I didn't know that. But now when I check it out, it doesn't look like you can ask if something overlaps a group. Uhm. I'm sure it's there somewhere.
    Anyway, in this case it actually is somewhat useful not to group the doors, because the way it is (supposed to work) now there are four types of doors (up, down, left, right), who are supposed to collide only with the appropriate detector. This is because my doors are swinging when opened, and if all detectors would collide with all doors, you'd be stuck if you stood in the way of an opening door. I think.
    I still _don't_ get why my values aren't returning to zero when no collisions are detected. Gnah. I've tried with flags as well, and they don't work. Only one action when event loops doesn't help me either. It's like MMF totally ignores my wishes.
    And I missed my deadline.

    Sigh.

  4. #4
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module
    Nifflas's Avatar
    Join Date
    Jul 2006
    Posts
    2,613
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: My collision detection just. dosn't. work.

    I suggest using an "always" event which sets the values to 0, then after that, the events that set the values to 1 in case of overlap.

    In case you're doing it another way (I suspect a "negated" check for obstacle overlap which sets the values to 0), things will get trickier. Besides, an obstacle overlap check every frame requires more CPU than just changing the value to 0 all the time.

  5. #5
    No Products Registered

    Join Date
    Sep 2006
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: My collision detection just. dosn't. work.

    Ah, I get your point. Yes, I'm using a negated check. But wouldn't an always event and the overlap check be contradicting each other? How can I be certain of which condition has priority?
    I'll try it!
    Thanks!

  6. #6
    No Products Registered

    Join Date
    Jun 2006
    Posts
    1,630
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: My collision detection just. dosn't. work.

    I had a similar problem some time ago. I just duplicated the event 'collision with backdrop' and replaced by 'colliding with door'.. this way, two separated and independent events.. solved for me, but I don't know if it is the best solution

  7. #7
    No Products Registered

    Join Date
    Sep 2006
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: My collision detection just. dosn't. work.

    Nifflas: It actually works! Thanks a lot!
    Bruto: Don't really follow you. Thanks for commenting though.
    Problem solved.
    Ah. =)

  8. #8
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: My collision detection just. dosn't. work.

    For every game cycle, the events are read from top to bottom - so if the "set to 0" action is above the one that sets the value to 1 (and both are run), the value will be 1 as it is set after the action that sets it to 0.

    That could have been explained better, but that's the idea of it.

Similar Threads

  1. [bug] collision Detection dont work After resume
    By StingRay in forum iOS Export Module Version 2.0
    Replies: 2
    Last Post: 12th March 2013, 11:11 AM
  2. Possible bug in PMO collision detection
    By K1kk0z90 in forum Multimedia Fusion 2 - Technical Support
    Replies: 9
    Last Post: 4th August 2011, 01:56 PM
  3. détection collision
    By graboide in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 12th December 2010, 05:24 AM
  4. Why dosn't this work?
    By Zambaku in forum The Games Factory 2 - Technical Support
    Replies: 2
    Last Post: 27th July 2009, 09:07 PM
  5. Collision detection
    By Crash86 in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 1st April 2007, 04:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •