Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » My code randomly stops working
- Amtrak202
-
4 posts
My code randomly stops working
I made a simple environment to walk around in first person. I exactly followed the tutorial on the Scratch Wiki for raycasting. It randomly stops working, and I have to recode every sprite. It hapened rwice now and I'm extremely confused. It worked completely fine until it didn't. What's going on here? The Project
- p-p-p-p-p-p-p-p-p-p-
-
1000+ posts
My code randomly stops working
Maybe try establishing default variables for your sprites when starting the project? Nothing seems to be popping out at me here.
- Amtrak202
-
4 posts
My code randomly stops working
What do you mean? I did “When green flag clicked” and all the variable numbers it should be to start, but nothing is happening. The issue also persists throughout multiple browsers.
I just restarted my computer, and that didn't help either.
I just restarted my computer, and that didn't help either.
Last edited by Amtrak202 (Feb. 20, 2025 02:39:11)
- p-p-p-p-p-p-p-p-p-p-
-
1000+ posts
My code randomly stops working
Is what is being rendered right now (the blue stripe, the green stripe, and the brown stripe) supposed to be rendered? Or is that a bug? Is it just that the project isn't responding to user input?
- Amtrak202
-
4 posts
My code randomly stops working
The project is responding to the input, and the player is moving. I can see the X and Y coordinates changing. The orange & blue are backdrops, only the green should be rendering, which it isn't. I think something went wrong somehow in the “draw” sprite, as that isn't moving. It's code script is apparently running, though.
Also, I forgot to mention, all the custom blocks, (except movement,) are running without screen refresh. Turbo mode does nothing to help.
Also, I forgot to mention, all the custom blocks, (except movement,) are running without screen refresh. Turbo mode does nothing to help.
- p-p-p-p-p-p-p-p-p-p-
-
1000+ posts
My code randomly stops working
Yes I have gone through your code and nothing seems to be acting like it shouldn't be. I also don't know anything about raytracing though.
I found it!
In your “distance” sprite you are referencing a “map” sprite that doesn't exist.
Same with the player sprite. Changed both of them to “sprite 1” and I think it's working now? I'm testing some stuff cause I'm curious how this works.
You also need to make the “distance sensor” costume a little larger so it actually renders.
I did all 3 of these things and now it looks super cool!
I found it!
In your “distance” sprite you are referencing a “map” sprite that doesn't exist.
Same with the player sprite. Changed both of them to “sprite 1” and I think it's working now? I'm testing some stuff cause I'm curious how this works.
You also need to make the “distance sensor” costume a little larger so it actually renders.
I did all 3 of these things and now it looks super cool!
Last edited by p-p-p-p-p-p-p-p-p-p- (Feb. 20, 2025 03:04:14)
- Amtrak202
-
4 posts
My code randomly stops working
Yes! Thank you! It works perfectly now! The distance sensor being too small was what caused it. Making it slightly bigger fixed it. Do you want me to credit you in the project?
Last edited by Amtrak202 (Feb. 20, 2025 11:57:06)
- p-p-p-p-p-p-p-p-p-p-
-
1000+ posts
My code randomly stops working
I appreciate the sentiments but that is not necessary. I didn't really contribute much, I just found a small problem. Glad to see it's working again! Yes! Thank you! It works perfectly now! The distance sensor being too small was what caused it. Making it slightly bigger fixed it. Do you want me to credit you in the project?
- Discussion Forums
- » Help with Scripts
-
» My code randomly stops working