Move tilesprite when camera changes position

Recommended Posts

Hi guys, I'm new to the framework but I googled around abit and couldn't find an answer to this:  

I’m making a tile mapped game where the player needs to make their way through a tiled level by moving upwards.

To achieve this the camera follows the player around a rectangular world


My question is about creating 2 background TileSprites that scroll with the camera BUT not at the same speed as the camera to achieve the effect of having a background with TileSprite 1 in the distance and TileSprite 2 in the far distance 

Maybe something like an event handler that works like this:

    backgroundTileSprite1.scrollY -=  yDistance/2 
    backgroundTileSprite2.scrollY -=  yDistance/4 

Right now my setup is like this:

TileSprite 1 -> moves with the camera 

TileSprite 2 -> stays still in background using TileSprite.fixedToCamera


It looks okay right now, but I think this would convey a more convincing sense of distance.

Cheers and thank you!  

Edited by GregDev

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.