Discuss Scratch

armstrongt11
New Scratcher
4 posts

Make Sprite disappear when "eaten by Shark"

Hey All,

New to Scratch and am attempting to make an ocean scenario in which the Shark(controlled by the mouse pointer) is supposed to go after the different fish and eat them. However, I cannot manage to get the fish to disappear when the Shark is on top of them. I have tried adding a statement for when the shark is on top of the fish, have the fish change costume to a blank costume…ie: nothing. I am pretty sure the different fish, which are moving around the screen, are not recognizing the touch of the shark. Any ideas?

Thanks!
1234abcdcba4321
Scratcher
1000+ posts

Make Sprite disappear when "eaten by Shark"

In fish sprite:
whenIstartasaclone or gf if you're not using cloneswaituntiltouchingshark?hide

That's all you need…
armstrongt11
New Scratcher
4 posts

Make Sprite disappear when "eaten by Shark"

Hmmmm…but then it doesnt start when the flag his pressed?

I have it set up so that when the * is pressed, if it touches shark, then it hides. However, it doesnt look like that is working.
armstrongt11
New Scratcher
4 posts

Make Sprite disappear when "eaten by Shark"

Scratch that, looks like it worked! Not sure why it didn't go through the first time!
armstrongt11
New Scratcher
4 posts

Make Sprite disappear when "eaten by Shark"

Now it appears I cannot move the sprite…I have it set to move randomly about the map and it appears it doesn't want to work
PreoKid
Scratcher
100+ posts

Make Sprite disappear when "eaten by Shark"

What scripts are you using to move it?
scubajerry
Scratcher
1000+ posts

Make Sprite disappear when "eaten by Shark"

The basic problem is that while you are gliding, you are not sensing. See fish2 in my remix.
MMHMMH
Scratcher
100+ posts

Make Sprite disappear when "eaten by Shark"

armstrongt11 wrote:

Scratch that, looks like it worked! Not sure why it didn't go through the first time!
clones don't respond to
whenclicked
they only respond to
whenIstartasaclone
MMHMMH
Scratcher
100+ posts

Make Sprite disappear when "eaten by Shark"

armstrongt11 wrote:

Now it appears I cannot move the sprite…I have it set to move randomly about the map and it appears it doesn't want to work
I visited the project….the shark is moving around fine right? What's wrong?
queenfeen
New Scratcher
1 post

Make Sprite disappear when "eaten by Shark"

1234abcdcba4321 wrote:

In fish sprite:
whenIstartasaclone or gf if you're not using cloneswaituntiltouchingshark?hide

That's all you need…
realy works but how do u make the fish re apper
Robotron3000
Scratcher
100+ posts

Make Sprite disappear when "eaten by Shark"

Here is your specific answer:
When I have attempted to do this programming this block does NOT work :
iftouchingShark?then

So if you are doing something like that then use this:
whenclicked
iftouchingcolor(color of the shark)?thenhide
You're welcome
deck26
Scratcher
1000+ posts

Make Sprite disappear when "eaten by Shark"

You should add a ‘show’ to all the fish so they appear after the green flag is clicked. As has already been pointed out the main problem is you're gliding instead of moving and you can't detect that you're touching the shark until the glide is done by which time you might not be touching.

If you do want to use glide then split the ‘if touching shark’ to a separate script along the lines of

whenclickedwaituntiltouchingshark?hidestopother scripts in this sprite
Frostface
Scratcher
2 posts

Make Sprite disappear when "eaten by Shark"

queenfeen wrote:

1234abcdcba4321 wrote:

In fish sprite:
whenIstartasaclone or gf if you're not using cloneswaituntiltouchingshark?hide

That's all you need…
realy works but how do u make the fish re apper
How about try:
whenclickedforeveriftouchingshark?thenhidewaitafewsecsshow
deck26
Scratcher
1000+ posts

Make Sprite disappear when "eaten by Shark"

The important thing is getting the fish to appear at the start.

whenclickedshowandthenwhateverothercodeyouwantforthatsprite
Vetpetmon
Scratcher
1000+ posts

Make Sprite disappear when "eaten by Shark"

whenclickedforeveriftouchingshark?thenhide
that's all you need.
pusheenkittens
Scratcher
100+ posts

Make Sprite disappear when "eaten by Shark"

please show the scripts so i can figure out ^-^
you don't have to show the project, click the 14th icon on the reply box and put the order of the scripts/blocks
Shift_key
Scratcher
1 post

Make Sprite disappear when "eaten by Shark"

do u know how to make a sprite eat another sprite when its bigger than it
GodzillaKing100
Scratcher
100+ posts

Make Sprite disappear when "eaten by Shark"

try
whenclickedforeveriftouchingShark?thenbroadcastGameOver
arman516
Scratcher
500+ posts

Make Sprite disappear when "eaten by Shark"

whenclickediftouchingshark?thenhide

or
whenIstartasacloneiftouchingshark?thenhide

Last edited by arman516 (Oct. 17, 2015 15:11:10)

AnimeWarrior0510
Scratcher
25 posts

Make Sprite disappear when "eaten by Shark"

I have made a similar game and I did this:

whenclickedrepeatuntiltouchingShark?ifonedge,bouncemove4stepshidestopthis script

Hope this helps

Last edited by AnimeWarrior0510 (Oct. 17, 2015 15:52:26)

Powered by DjangoBB