How would I make the camera only follow mySprite horizontally?

If you have a solution, that would be cool!

4 Likes

You could set the camera X to the sprite X!

1 Like

forever
center camera at x mySprite.x y 60 ( any fixed number)

3 Likes

It’s very choppy though.

1 Like

This is a scenario where on game update would work better actually:

image

reason being that forever spins up a separate thread to run the code in, so it will always be ‘1 render’ behind / potentially could miss a frame depending on timing a bit; since this is code we want to update synchronously it’s better to update it with on game update where it will always start and finish before we actually render to the screen (a little bit of documentation on this for anyone interested here: https://arcade.makecode.com/developer/game-loop)

Alternatively, we use my sprite utils extension (https://github.com/jwunderl/arcade-sprite-util) which has a block to run at certain parts in the game loop if you care about the exact timing when something should run, but on game update should generally handle these types of things well
image

2 Likes