This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2007-08-25 14:55:33

MrShah
Scratcher
Registered: 2007-05-30
Posts: 9

How to...Reverse the Mouse!

You can easily control a sprite's motion by making it go to the mouse pointer:
<go to[mouse-pointer]>

BUT...
what if you want the sprite to move in the opposite direction to the mouse.
In this case, you can:
Go to
X (mouse X - (mouse X*2)),
Y (mouse Y - (mouse Y*2))

For an example of how to reverse the mouse see MrShah's Feed Gobo project:
http://scratch.mit.edu/projects/MrShah/31797

Scratch On!
MrShah
Search for "Scratch On!" on Facebook. It's a new group...just for us!
http://www.facebook.com/group.php?gid=4750062684

Last edited by MrShah (2007-08-25 14:59:39)

Offline

 

#2 2007-08-26 02:56:57

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: How to...Reverse the Mouse!

Would

Goto x: (Mousex * -1), y:(mouseY * -1)

work as well?


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#3 2007-08-26 11:34:52

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: How to...Reverse the Mouse!

(mouse X - (mouse X*2 )) is equal to (mousex*-1)

(mouse Y - (mouse Y*2 ))  is equal to (mousey*-1)


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#4 2007-08-26 11:48:20

Vanslar
Scratcher
Registered: 2007-03-17
Posts: 100+

Re: How to...Reverse the Mouse!

MrShah, ckeck out my virus game, you can get some of those little reverse mouse formulas from it


  I am a royal pain in the butt, I am ~Vanslar~       
      Want better gravity? Go to
Realistic Gravity, By Vanslar 2-D
Want a better way to spend your spare time? CubeField

Offline

 

#5 2007-09-01 18:49:37

MrShah
Scratcher
Registered: 2007-05-30
Posts: 9

Re: How to...Reverse the Mouse!

Thanks for simplyfying the maths.  smile

Offline

 

#6 2007-09-01 18:58:39

Vanslar
Scratcher
Registered: 2007-03-17
Posts: 100+

Re: How to...Reverse the Mouse!

smile  no prob


  I am a royal pain in the butt, I am ~Vanslar~       
      Want better gravity? Go to
Realistic Gravity, By Vanslar 2-D
Want a better way to spend your spare time? CubeField

Offline

 

Board footer