Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Help with an arcade game scratch
- Shikanoko263
-
Scratcher
5 posts
Help with an arcade game scratch
So i am making a a game for my tech class and i am having trouble with it. So the girl has 3 lives and has to collect rice. If she misses them she loses a life. If she loses her 3 lives she dies. But i am having trouble programming that, can anybody help me? Currently, she can collect rice, but if she collects one the other rice clones are hidden. I also want to make her lose a life for everytime she misses a rice.
PROJECT LINK: https://scratch.mit.edu/projects/1118234455/
PROJECT LINK: https://scratch.mit.edu/projects/1118234455/
Last edited by Shikanoko263 (Jan. 10, 2025 12:19:36)
- Kenneth_games
-
Scratcher
16 posts
Help with an arcade game scratch
In the project, you broadcasted “hide rice” from the player. Every single rice clone then receives this message and hides themselves. Instead of this, you can detect if the rice is touching the player instead of the other way around. Another problem is when you want to delete the rice clones, you are only hiding them and not deleting the clones. This can cause clones to stop spawning since Scratch has a limit of 300 clones.
Example code (placed in the rice sprite):
To make the player take damage when they don't collect the rice, you can change the code that makes the rice fall down to this:
The logic is that if the player doesn't collect the rice, it falls until the bottom of the screen, and it decreases the health by 1 then deletes the clone. The code that broadcasts “hide rice” from the player can now be deleted, as well as the code that receives the message. You should also add some code for when the player loses all hearts, maybe a death animation or a game over screen. Hope this helps!
Example code (placed in the rice sprite):
when I start as a clone
wait until <touching [girl v] ?>
delete this clone
To make the player take damage when they don't collect the rice, you can change the code that makes the rice fall down to this:
when I start as a clone
show
go to [random position v]
set y to (176)
glide (2) secs to x: (x position) y: (-176)
change [Vie v] by (-1)
delete this clone
The logic is that if the player doesn't collect the rice, it falls until the bottom of the screen, and it decreases the health by 1 then deletes the clone. The code that broadcasts “hide rice” from the player can now be deleted, as well as the code that receives the message. You should also add some code for when the player loses all hearts, maybe a death animation or a game over screen. Hope this helps!
Last edited by Kenneth_games (Jan. 10, 2025 15:17:57)
- Shikanoko263
-
Scratcher
5 posts
Help with an arcade game scratch
thank you! also sorry for the weird named variables because eh i speak french too and my class is french so yeah. ty for the help. I added a game over screen before i posted this thread lol. thanks again, rlly helpful 





- Shikanoko263
-
Scratcher
5 posts
Help with an arcade game scratch
In the project, you broadcasted “hide rice” from the player. Every single rice clone then receives this message and hides themselves. Instead of this, you can detect if the rice is touching the player instead of the other way around. Another problem is when you want to delete the rice clones, you are only hiding them and not deleting the clones. This can cause clones to stop spawning since Scratch has a limit of 300 clones.But what about the original rice bowl? i cant collect it
Example code (placed in the rice sprite):when I start as a clone
wait until <touching [girl v] ?>
delete this clone
To make the player take damage when they don't collect the rice, you can change the code that makes the rice fall down to this:when I start as a clone
show
go to [random position v]
set y to (176)
glide (2) secs to x: (x position) y: (-176)
change [Vie v] by (-1)
delete this clone
The logic is that if the player doesn't collect the rice, it falls until the bottom of the screen, and it decreases the health by 1 then deletes the clone. The code that broadcasts “hide rice” from the player can now be deleted, as well as the code that receives the message. You should also add some code for when the player loses all hearts, maybe a death animation or a game over screen. Hope this helps!
- Discussion Forums
- » Help with Scripts
-
» Help with an arcade game scratch