HaxeFlixel / HaxeFlixel/flixel
Multiple overlap between two objects
Nobody has claimed this yet.
- Dominant language
- Haxe
- Stars
- 2.2k
- Forks
- 522
- Avg merge
- 34m
- Merged PRs (30d)
- 1
Description
flixel ver 3.3.5.
I met with strange (for me) behavior of FlxG.overlap function. If this is normal, please don't beat me :)
I call FlxG.overlap function with such type of objects: FlxObject (hero sprite), FlxGroup (contains triggers) - FlxG.overlap(hero, _Triggers, onTriggerOverlap);
So, when hero overlaps trigger (no other triggers overlapping with hero at the same time), the callback function for that trigger executes a few times - one or two or, sometimes, three-four times at one FlxG.overlap call.
After debugging I find out that trigger is adding to few ListTrees (north, south, ...) and thus when next tree call execute(), it again finds overlapping between hero and same trigger again. And it again calls callback function for trigger.
Is it normal behavior?
Demo here: https://dl.dropboxusercontent.com/u/18869478/flxOverlap/Tower.swf
Source here: https://dl.dropboxusercontent.com/u/18869478/flxOverlap/flxOverlap.zip
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at FlxG.overlap with the FlxObject and FlxGroup usage described in the issue, then inspect how the trigger objects are processed across the north, south, and other ListTrees. Reproduce the behavior using the linked demo or source archive and determine whether one physical overlap should invoke the callback once or multiple times; document or correct the observed behavior accordingly.
Written by the indexing model from the issue text.
Assessment
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100