Discuss Scratch

RavenTheWolf9
Scratcher
10 posts

(Repost) How To Fix a Glitch in my Game?

Um whoops– I didn't mean to do that

Please refer to the original: https://scratch.mit.edu/discuss/topic/722945/

Last edited by RavenTheWolf9 (Nov. 6, 2023 20:13:06)

jgmer53527v2
Scratcher
44 posts

(Repost) How To Fix a Glitch in my Game?

Someone already answered your question.

standing_rake wrote:

Ok, first, you might want to clean up the code/put all the forever loop into one. I tried to help another person, and running multiple scripts at once broke the game. You could this:
whenclickedsetgem ito0forevercheckforgemdefinecheckforgemiftouchinggem?thenifgemi=0thenchangegemsby1setgem ito1

This would work, but might not be the best solution. Your solution would also work, but may be hard to debug.

Also, when key pressed blocks have a fairly large cooldown, so you might want to run a forever loop using ifs to check if a key is pressed, so inputs don't get dropped

Next, using glides for a jump can make the jump hard to cancel and they kind of count as a wait. You could use a variable for y velocity and every frame change y by YV and reduce YV by say 0.9. Then check if your player is touching the ground, and if it is, repeat until not touching the ground, change y by 1 and set YV to 0. Then, when you want to jump, set YV to say, 10. Like this:

whenclickedforeverchangeYVby-0.9iftouchingground?thenrepeatuntilnottouchingground?changeyby1setYVto0ifkeyuppressed?thensetYVto10

The reason the variables are still there when you click the green flag is because you don't set them to 0 at the start of the game. They start off as 0 when you load the page, though, because you last saved with the variables set to 0.
RavenTheWolf9
Scratcher
10 posts

(Repost) How To Fix a Glitch in my Game?

I know, I made this post as a mistake–

Powered by DjangoBB