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

#1 2009-10-02 23:42:51

FantasyTales
Scratcher
Registered: 2008-06-02
Posts: 1000+

how can i make a scroller where it scrolls depending on mouse aiming?

i need to make a scroller where the character points towards the mouse and it scrolls in the direction of the mouse, how can i do that?


http://ageofthefuture.ismywebsite.com/images/dg_sig_2_small.png
http://images.myadoptables.com/adopted/2340.pnghttp://images.myadoptables.com/adopted/2339.png

Offline

 

#2 2009-10-02 23:49:27

deatheater
Scratcher
Registered: 2008-04-11
Posts: 1000+

Re: how can i make a scroller where it scrolls depending on mouse aiming?

ok, here's how I do it

[blocks]
<when green flag clicked>
<forever>
<set{ old x }to( <x position>
<set{ old y }to( <y position>
<point towards( mouse pointer
<move( 5 )steps>
<change{ scroll x }by( (( <x position> <-> <{ old x }> ))
<change{ scroll y }by( (( <y position> <-> <{ old y }> ))

[/blocks] if the scrolling is going in the opposite direction, try switching the old x and x position around (in the - sign thing equation), same with the y

Last edited by deatheater (2009-10-02 23:50:07)

Offline

 

#3 2009-10-03 00:04:45

FantasyTales
Scratcher
Registered: 2008-06-02
Posts: 1000+

Re: how can i make a scroller where it scrolls depending on mouse aiming?

it works but the person moves around so much that it doesnt get a chance to scroll


http://ageofthefuture.ismywebsite.com/images/dg_sig_2_small.png
http://images.myadoptables.com/adopted/2340.pnghttp://images.myadoptables.com/adopted/2339.png

Offline

 

#4 2009-10-03 00:13:34

FantasyTales
Scratcher
Registered: 2008-06-02
Posts: 1000+

Re: how can i make a scroller where it scrolls depending on mouse aiming?

nvm i fixed it i simply made a sprite that moved the equivalent amount of steps but backwards, therefore it still made it scroll properly but the sprite stayed in teh center.


http://ageofthefuture.ismywebsite.com/images/dg_sig_2_small.png
http://images.myadoptables.com/adopted/2340.pnghttp://images.myadoptables.com/adopted/2339.png

Offline

 

#5 2009-10-03 00:14:50

deatheater
Scratcher
Registered: 2008-04-11
Posts: 1000+

Re: how can i make a scroller where it scrolls depending on mouse aiming?

oh, lol forgot the move -5 steps at the bottom of the script XD

Offline

 

Board footer