Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » following the mouse pointer without the sprite flipping
- AngieWilson
-
Scratcher
1 post
following the mouse pointer without the sprite flipping
Hi all, thought I'd try a hungry shark game as my first project however I can't figure out how to keep my sprite facing the mouse pointer (without him flipping upside down)
Project is here …
https://scratch.mit.edu/projects/96099541/#player
I think. Help / remixes appreciated.
Also, any idea how I can have the background loop so that the shark an basically swim left or right forever without me having to draw a load of scenery sprites?
Thanks
Project is here …
https://scratch.mit.edu/projects/96099541/#player
I think. Help / remixes appreciated.
Also, any idea how I can have the background loop so that the shark an basically swim left or right forever without me having to draw a load of scenery sprites?
Thanks
- 906154
-
Scratcher
1 post
following the mouse pointer without the sprite flipping
Here's the script I would use:

when green flag clickedI hope this helps!
point in direction (90 v)
go to x: (0) y: (0)
forever
if <([x position v] of [Shark v]) > (mouse x)> then
switch costume to [shark-a-left v]
end
if <([x position v] of [Shark v]) < (mouse x)> then
switch costume to [shark-a-left v]
end
go to [mouse pointer v]
end

- ECLIPSE-STUDIOS
-
Scratcher
100+ posts
following the mouse pointer without the sprite flipping
Hi,
In the “Sprites” box locate the shark sprite and click the blue “i” symbol in the top right corner of its icon. Then find the button which looks like this: <-> and select it.
I hope this helps!
In the “Sprites” box locate the shark sprite and click the blue “i” symbol in the top right corner of its icon. Then find the button which looks like this: <-> and select it.
I hope this helps!
- no76543218
-
Scratcher
1 post
following the mouse pointer without the sprite flipping
Yeah i been having the same issue also. But I need it to stay on the ground without like.. Flying?
- NuclerWeapon
-
Scratcher
2 posts
following the mouse pointer without the sprite flipping
I'm not sure if this is it, but I tried.
point in direction ( 90)
set rotation style [all around]
forever
point towards [mouse cursor]
end
Last edited by NuclerWeapon (Nov. 3, 2023 13:45:23)
- Discussion Forums
- » Help with Scripts
-
» following the mouse pointer without the sprite flipping