Author Topic: Group Overlap  (Read 757 times)


  • Member
  • **
  • Posts: 53
  • Karma: +0/-0
  • [Please enter text here]
    • View Profile
    • Superbany's games
Group Overlap
« on: Sat, Oct 2, 2010 »
I'm currently working on a platformer game, and one of the things I wanted to do was to have some alternate player physics when underwater. I created my "player" object and placed some water objects into a group called _water with:
Code: [Select]
_water.add(new Water_top(16, 1978));I put this, along with some other groups for enemies, lava, the player, and doors into a meta group called _objects to use for collisions.
In the update method, I use
Code: [Select]
FlxU.collide(_objects, tiles);
FlxU.collide(_objects, _objects);
for the basic collisions.
However, when I tried to use
Code: [Select]
FlxU.overlap(player, _water, overlapped); with "overlapped" being a method to change the variable in the player called inWater to trigger water physics, nothing happens, and the water just acts as a background sprite. I checked, and it seems that the two aren't being recognized as overlapping. To try to figure out the problem, I replaced _water with the tiles variable, and the game was seeing that they overlapped. Anybody know what I'm doing wrong?

Looked through other forum posts and solved the problem. the Water_top objects needed to be solid, and just not included in with the other objects in collisions.
« Last Edit: Sun, Oct 3, 2010 by superbany »