Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Advanced Scrolling Platformer Script
- Oshawott_X
- Scratcher
33 posts
Advanced Scrolling Platformer Script
Hello, I need help with my latest project! https://scratch.mit.edu/projects/633380366/ There is a problem in the “Platform” sprite. The variable “counter” is going up to infinity and making the game lag. I am wondering if it is a custom block problem because I think I coded everything right, but the number is probably skipping a section of the code. This is advanced because I made the clones delete themselves when they went out of view and reappear when in range. If someone could help me, that would be awesome! Thanks!
- amster11722
- Scratcher
100+ posts
Advanced Scrolling Platformer Script
Getting rid of the “Decode for save data” function completely fixes the FPS, so I would look into that
when gf clicked
broadcast[WAKE UP!!! v]
when i receive [WAKE UP!!! v]
switch costume to[clothes v]
go to x: [https://scratch.mit.edu/discuss/] y: [Help With Scripts]
- Oshawott_X
- Scratcher
33 posts
Advanced Scrolling Platformer Script
That wouldn't work because then the clones wouldn't be able to reappear!
Last edited by Oshawott_X (Jan. 25, 2022 23:29:19)
- FireflyFi
- Scratcher
25 posts
Advanced Scrolling Platformer Script
An easier engine to implement is to have only nine clones which cycle while scrolling, so instead of having the entire level clone itself, the clones will just loop around. This offers a large amount of content with low clone-limit impact, and you can do great things with it too. (Depending on certain parameters, it can even work with as little as four clones!)
- Oshawott_X
- Scratcher
33 posts
Advanced Scrolling Platformer Script
That's a great idea, but for this engine I want the clones to delete and reappear. An easier engine to implement is to have only nine clones which cycle while scrolling, so instead of having the entire level clone itself, the clones will just loop around. This offers a large amount of content with low clone-limit impact, and you can do great things with it too. (Depending on certain parameters, it can even work with as little as four clones!)
- FireflyFi
- Scratcher
25 posts
Advanced Scrolling Platformer Script
Fair. You could consider adding all of the clone data (x pos, y pos, size, anything else) to a list, then have the original sprite check said list every tick. If the sprite should be on screen (if the scrollx and scrolly are overlapping the place where the sprite should be) create the sprite and give it a cloneid equivalent to its position on the list, then once it cycles out of view, send a message that triggers an if: cloneidthe list number that should be despawned) , which will despawn it.
Hope that helps!
Hope that helps!
- Discussion Forums
- » Help with Scripts
- » Advanced Scrolling Platformer Script