FlxSpriteGroup changing position when colliding

48 views
Skip to first unread message

talkingalone

unread,
Sep 13, 2015, 5:57:32 AM9/13/15
to HaxeFlixel
Hi there.

I'm having an issue when colliding a FlxSpriteGroup with a static object in my level's map. The problem is that when running into something and colliding, the FlxSpriteGroup stops, but it's inner position keeps moving if I keep running it into the colliding object. So the sprite itself doesn't move over the object in the map, but its position does. This screws the whole thing because I depend on the value of the position to do some calculations.

The way that I'm doing the collision is by using FlxG.overlap(map, flxSpriteGroup, notify, FlxObject.separate).

Anybody knows why this might be happening?

Thank you.

Lasent

unread,
Sep 13, 2015, 4:11:06 PM9/13/15
to HaxeFlixel
Can you give us a sample project, or some code to test it out?

SruloArt

unread,
Sep 15, 2015, 2:44:27 PM9/15/15
to HaxeFlixel
* At first (shallow) glance I don't notice anything that can cause this, it can be a bug (with the quad tree maybe...but I've no idea) so you can open an issue.
* But maybe it's something to do with your code (I have no idea either).
* So, I think uploading a test project with a new issue is the best course of action here.

Lasent

unread,
Sep 16, 2015, 2:00:04 PM9/16/15
to HaxeFlixel
Maybe you've also added the children sprite's as well to the state somewhere?

talkingalone

unread,
Sep 16, 2015, 2:14:44 PM9/16/15
to HaxeFlixel
Hi guys, thank you for your answers and sorry about the delayed reply.

I've uploaded what I have to github: https://github.com/jmle/jackal

The main class is CombatJeep (the FlxSpriteGroup), which consists of a Cannon and a Jeep. I was also playing around with the Tiled addon to build the level's map, and I'm doing the collisions against it.

If you go through the code you'll notice that I do some repositioning of the Cannon in relation to the Jeep depending on the angle that the car has adopted. This is to keep the cannon in the right place when the Jeep itself moves, but right now it's commented out (placeCannon() in Cannon.hx).

Comments are welcome!

SruloArt

unread,
Sep 17, 2015, 5:08:28 AM9/17/15
to haxef...@googlegroups.com
* I don't see anything specific in your code that can cause this, but I can't confirm it happens.
* So, open an issues over Github, refer to your project, someone's smart may pick it up :)
Reply all
Reply to author
Forward
0 new messages