Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » how to let my shark to stop eating after eating exactly one fish?
- jh_2003
-
10 posts
how to let my shark to stop eating after eating exactly one fish?
rules:
1)when green flag is pressed, type how many balls you want to be in the game and target you want to eat,then fish starts swimming without other action(swim=0)
2)when space is pressed, the fish starts moving following mouse cursor and eating balls. (i know that sounds weird) (swim=0,touch=1)
3)when score=target , stop eating and go back swimming as (1) without other action
4)when space is pressed agn, start what is done in 2 until no. of ball=0.
my question is : how to let my shark to stop eating after eating exactly one fish?i set a variable “touch” to make sure fish stop eating after eating one ball (when touches fish, touch=0, wait until sprite not touching the ball,set touch to 1)but it doesn't work if it touches a bunch of balls together when the no of ball i set at the beginning is large(let's say 100).
here's the link to my project: Your text to link here…
1)when green flag is pressed, type how many balls you want to be in the game and target you want to eat,then fish starts swimming without other action(swim=0)
2)when space is pressed, the fish starts moving following mouse cursor and eating balls. (i know that sounds weird) (swim=0,touch=1)
3)when score=target , stop eating and go back swimming as (1) without other action
4)when space is pressed agn, start what is done in 2 until no. of ball=0.
my question is : how to let my shark to stop eating after eating exactly one fish?i set a variable “touch” to make sure fish stop eating after eating one ball (when touches fish, touch=0, wait until sprite not touching the ball,set touch to 1)but it doesn't work if it touches a bunch of balls together when the no of ball i set at the beginning is large(let's say 100).
here's the link to my project: Your text to link here…
- griefercube
-
500+ posts
how to let my shark to stop eating after eating exactly one fish?
Dupe of this
![](https://assets.scratch.mit.edu/get_image/.%2E/21eed3848178058ac95ebb2c51268e3f.png)
sometimes, you just have to change a way of thinking to solve a problem. -griefercube
|other projects■how I made the banner■animated thumbnails?■i’m on wiki!■Cubey Mines|
|other projects■how I made the banner■animated thumbnails?■i’m on wiki!■Cubey Mines|
Last edited by griefercube (32th Undecimber, XXXX)
https://turbowarp.org/563693837/editor (something i did a while back don’t worry it’s for the banner)
list of working bbcodes:
[color=]
[scratchblocks]
[url=]
[img]
[center]
[code]
[code=]
[list]
[quote]
[b]
[i]
[u]
[s]
[big]
[small]
[p]
[wiki]
[google]
- Discussion Forums
- » Help with Scripts
-
» how to let my shark to stop eating after eating exactly one fish?