Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Lag glitch
- among_yourself
-
Scratcher
44 posts
Lag glitch
My game starts to lag when the player goes too far from the starting point, I have no idea how to fix this nor do I know what is even causing the issue.
here is a link to the game https://scratch.mit.edu/projects/1093605533/
I suspect it's the ground sprite but I don't know how.
here is a link to the game https://scratch.mit.edu/projects/1093605533/
I suspect it's the ground sprite but I don't know how.
- Jareddddddd
-
Scratcher
1000+ posts
Lag glitch
its the “NPC” sprite. I can't seem to find from where it's clones are created, could you point me to that?
—–
Adding somes logs show that the custom block “change y by dy” in “NPC” is called many many times (light testing, around 3000 times per frame). I suspect you are trying to spawn in the clone when it's not supposed to.
—–
To temporarily remedy this, you can make the npc go off of absolute positioning, instead of adding collision for it. It doesn't move, so it doesn't need to collide.
edit: format
—–
Adding somes logs show that the custom block “change y by dy” in “NPC” is called many many times (light testing, around 3000 times per frame). I suspect you are trying to spawn in the clone when it's not supposed to.
—–
To temporarily remedy this, you can make the npc go off of absolute positioning, instead of adding collision for it. It doesn't move, so it doesn't need to collide.
edit: format
Last edited by Jareddddddd (Nov. 11, 2024 18:47:16)
- among_yourself
-
Scratcher
44 posts
Lag glitch
its the “NPC” sprite. I can't seem to find from where it's clones are created, could you point me to that?Thanks, this solved the problem, but I have a question. Is there any chance I could make the NPC's move and experience gravity without causing more lag? I was planning to have some NPC's attack the player by being bandits
—–
Adding somes logs show that the custom block “change y by dy” in “NPC” is called many many times (light testing, around 3000 times per frame). I suspect you are trying to spawn in the clone when it's not supposed to.
—–
To temporarily remedy this, you can make the npc go off of absolute positioning, instead of adding collision for it. It doesn't move, so it doesn't need to collide.
edit: format
Last edited by among_yourself (Nov. 11, 2024 19:06:18)
- Discussion Forums
- » Help with Scripts
-
» Lag glitch

