Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » can't go under y -180
- Atreew
- Scratcher
1 post
can't go under y -180
Trying to make griffpatch's vertical platformer but sprite doesn't go below y -180 when falling down. It works when I move up. Anyone knows why?
My project
My project
- Jlerpy
- Scratcher
1000+ posts
can't go under y -180
In general, sprites can only go down to -180 and up to 180.
- deck26
- Scratcher
1000+ posts
can't go under y -180
More accurately sprite position limits are dictated by when the sprite is nearly off screen. A larger sprite might well go below -180 since if it is properly centred that still leaves plenty of the sprite visible. Scratch prefers to keep something like 10 or 20 pixels of a sprite on screen.
That leads to the workaround. If you select a larger costume (or increase the size) before you move the sprite you should be able to move further and as long as you then switch back to the original costume/size the user doesn't see this happening since they only see the screen as it appears at the end of the frame. It is possible to get sprites off screen completely using this method.
Demo for horizontal movement https://scratch.mit.edu/projects/419039062/
That leads to the workaround. If you select a larger costume (or increase the size) before you move the sprite you should be able to move further and as long as you then switch back to the original costume/size the user doesn't see this happening since they only see the screen as it appears at the end of the frame. It is possible to get sprites off screen completely using this method.
Demo for horizontal movement https://scratch.mit.edu/projects/419039062/
Last edited by deck26 (July 25, 2024 08:01:07)
- deck26
- Scratcher
1000+ posts
can't go under y -180
Just for general info, I've done some testing and it looks like Scratch prefers to keep at least 16 pixels of the sprite visible. I tried two different costumes and 2 different sizes and this was a fairly consistent result.
So a costume with height 50 pixels at 100% size should be able to go to a position where the lower edge is at y=164 so if it is properly centred that would allow a y position of 164 + 25 = 189.
So a costume with height 50 pixels at 100% size should be able to go to a position where the lower edge is at y=164 so if it is properly centred that would allow a y position of 164 + 25 = 189.
- Discussion Forums
- » Help with Scripts
- » can't go under y -180