Scrollable background



  • is there a way of doing a simple infinite scrolling background without moving the camera? Let's say by offsetting a object's texture?
    I was trying to do it using the FlxBackdrop, but I didn't understand very well how it works, even if I specify a camera just for the background, other static objects "move", like if they were all in the same camera.

    I didn't understand how camera.scroll relates to FlxBackdrop.scrollFactor

    roadCam = new FlxCamera();
    FlxG.cameras.add(roadCam);
    road = new FlxBackdrop(AssetPaths.normalRoad__png, 0, 3, false, true);
    road.origin.set(0, 0);
    road.cameras = [roadCam];
    add(road);
    
    override public function update(elapsed:Float):Void
    {
        super.update(elapsed);
        roadCam.scroll.add(0, -200 * elapsed);
    }
    

  • Banned

    This post is deleted!

Log in to reply
 

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.