I am working with a student who made a 512 x 512 background image. He was trying to have his sprite move across it similar to having a large tilemap and using the camera follow sprite block. Is there a way to do this?
It also looks like the editor is cropping the image? Is there a max size for a background image?
Ah, so the issue is that background images are “fixed” to the camera. Here’s a quick example–the image is always centered on the camera even as the player moves through the tilemap:
You’ll want to instead create a fake background image sprite, set a tilemap to define the bounds of the world (otherwise the player can move infinitely in any direction), and center the background image sprite in that tilemap. Here’s the code for it!
Perfect! That’s great solution. I really appreciate the help.
I found the solution to be somewhat buggy. Maybe it was my computer, but after I while I could not move the sprite very well. Once it moved to an edge of the screen, I could not move the sprite anymore, and when I could the controller events were being queued up. There was a delay in movement. I suspect because the background image is so large.
Oh, good call, the other thing that might be useful here is to set “ghost” to true for the image! It should significantly improve performance, as we’ll skip collision checking for the large background image.
Oh, I was experiencing the same thing. I didn’t make that connection though. I will test the ghost solution as well.
Thank you everyone. I appreciate it.
That works much better, and is logical as well; no need to collide with the background
I might just have to use this example code for my next game.