FlxSprite is moving somehow



  • Hi guys,
    I've faced to a strange behaviour from single FlxSprite. I am adding the sprite to my state:

    sky = new FlxSprite(0, 0, AssetPaths.sky__png);
    sky.screenCenter();
    add(sky);

    And nothing more I do with this sprite!
    About one time of a 100 this sprite slowly moves to the bottom-right... I traced its properties and found out that acceleration has the value (x: 1 | y: 1) instead of (x: 0 | y: 0).. But why?? I do absolutely nothing with this particular sprite. Anybody noticed similar issues?
    alt text
    All haxeflixel libs are git-latest.



  • I added the other sprite instead of "sky" and it moves as well... Also strange FlxSprite is always the first added to state in code.



  • @vleontiy
    I believe that the default scroll factor is set to 1. Try this... scrollFactor.set(0, 0);

    Space Castle is a free retro style platformer game with a mystery storyline and made using the haxeflixel library.

    0


  • @galoyo Yes, it is. But I never use camera moving or scrolling.
    I added scrollFactor.set(0, 0); and I have the same behaviour sometimes: still sometimes acceleration is set as (1, 1). I can manually set it to (0, 0) but curious why it happens at all.


  • administrators

    Any chance you're calling put() on a FlxPoint that is still in use somewhere?



  • @Gama11 No, but I found out this only happens in FlxTransitionableState when transition begins before previous ends or near. Trying to reproduce now in empty project..



  • Ok, I've reproduced this. Happens always after restart (R button).
    I assumed it happens because of Actuate does not end the tween. And maybe FlxTransitionableState involved too. But why completely different sprite is moving?

    [http://gametrax.eu/game/95d8781787](link url)

    source:
    [http://s000.tinyupload.com/index.php?file_id=05289250829440236347](link url)


Log in to reply