Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Detect if touching 2 sprites at once?
- allahmark
-
Scratcher
2 posts
Detect if touching 2 sprites at once?
In a game i'm working on you can eat tacos, and sometimes you eat multiple at once but, my code doesn't do what I'd like it to do…
All the tacos have the code below in them, when I eat them, all the ones i'm standing on disappear, but fat only increases by 1…

Also, the fish have this code in them:


I want fat to increase for each taco eaten…. but that's not happening, any help would be awesome!
My project:
https://scratch.mit.edu/projects/186956382/
All the tacos have the code below in them, when I eat them, all the ones i'm standing on disappear, but fat only increases by 1…

Also, the fish have this code in them:


I want fat to increase for each taco eaten…. but that's not happening, any help would be awesome!
My project:
https://scratch.mit.edu/projects/186956382/
- Script_Helper
-
Scratcher
100+ posts
Detect if touching 2 sprites at once?
1st make a variable ‘fat’ (both fishes) a public variable, 2nd try this:
I hope it helps
when I start as a clonechange this to every tacos and you'll see it works.
show
if <(pick random (1) to (5)) > [2]> then
go to x: (pick random (-214) to (-119)) y: (pick random (-89) to (-120))
end
forever
if <<touching [Fish1 v] ?> and <key [e v] pressed?>> then
change [Fish1: fat v] by (1)
end
if <<touching [Fish2 v] ?> and <key [o v] pressed?>> then
change [Fish2: fat v] by (1)
end
end
I hope it helps

- Discussion Forums
- » Help with Scripts
-
» Detect if touching 2 sprites at once?