Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Sprite follow sound
- SuperXavierLandYT
-
Scratcher
10 posts
Sprite follow sound
i'm making a detection test where the code goes like this
If player goes near sprite, then start sound. if sound is heard by sprite 2. follow the sound until reaching player
Sprite 2 follows the sound to players location.
Any ideas on how to make that happen?
If player goes near sprite, then start sound. if sound is heard by sprite 2. follow the sound until reaching player
Sprite 2 follows the sound to players location.
Any ideas on how to make that happen?
- Tyh99
-
Scratcher
18 posts
Sprite follow sound
when green flag clicked
forever
if <touching [ v] ?> then
play sound [ v]
end
end
and make an invisibe hitbox inside the sprtie
- medians
-
Scratcher
1000+ posts
Sprite follow sound
I don't know if people remember about this block..


- SuperXavierLandYT
-
Scratcher
10 posts
Sprite follow sound
Uh what about the sprite following that sound?
- PurpleSuit
-
Scratcher
500+ posts
Sprite follow sound
(sorry it is messy i hope you understand)
for enemy
when green flag clicked
forever
if ([distance to = then
for enemy
when green flag clickedfor player
forever
if (<[distance to [player] = < [number]>) then
repeat until <touching player>
follow player script
end
end
end
when green flag clicked
forever
if ([distance to = then
play sound [sound] until donethis will give the illusion that when it hears you, it will chase you, set both numbers to the same value
end
end
Last edited by PurpleSuit (Jan. 23, 2023 14:53:46)
- Discussion Forums
- » Help with Scripts
-
» Sprite follow sound



