I'm creating an RPG like RuneScape, where you have to click where you want to go to.
The thing is, I can't devise a script for this, as I'm fairly new to this.
Help?
Offline
I'm not an expert, but this worked in my project:
[blocks]
<when green flag clicked>
<forever>
<wait until><mouse down?>
<glide( 1 )secs to x <mouse x> )y
<mouse y>
<end>
[/blocks]
Last edited by StoryMaker (2011-12-31 15:11:32)
Offline
I made a project, with a perfect method!
Download it to see the scripts ^_^
http://scratch.mit.edu/projects/RedRocker227/2250984
Last edited by RedRocker227 (2012-01-01 17:00:54)
Offline
And I think this would belong better in the All About Scratch forum.
I'll report it to be moved, okay? c:
Offline
StoryMaker wrote:
I'm not an expert, but this worked in my project:
[blocks]
<when green flag clicked>
<forever>
<wait until><mouse down?>
<glide( 1 )secs to x<mouse x> )y
<mouse y>
<end>
[/blocks]
The thing about this is, if you move the mouse, the character will start to head towards the new position. if you don't want this, you will need two variables (walk x and walk y).
when green flag clicked
|if <mouse down?>|
|wait until <not<mouse down?>>|
|set walk x to (mouse x)|
|set walk y to (mouse y)|
glide [{speed}] to x: (walk x) y: (walk y)|
hope this helps!
Offline
LewisZapata-Lee wrote:
StoryMaker wrote:
I'm not an expert, but this worked in my project:
[blocks]
<when green flag clicked>
<forever>
<wait until><mouse down?>
<glide( 1 )secs to x<mouse x> )y
<mouse y>
<end>
[/blocks]The thing about this is, if you move the mouse, the character will start to head towards the new position. if you don't want this, you will need two variables (walk x and walk y).
when green flag clicked
|if <mouse down?>|
|wait until <not<mouse down?>>|
|set walk x to (mouse x)|
|set walk y to (mouse y)|
glide [{speed}] to x: (walk x) y: (walk y)|
hope this helps!
[/blocks]The first was what the user wanted. This can probably be closed, though.
And don't forget [/blocks]!
Last edited by SJRCS_011 (2012-01-02 13:24:32)
Offline
LewisZapata-Lee wrote:
StoryMaker wrote:
I'm not an expert, but this worked in my project:
[blocks]
<when green flag clicked>
<forever>
<wait until><mouse down?>
<glide( 1 )secs to x<mouse x> )y
<mouse y>
<end>[/blocks]
[/blocks]The thing about this is, if you move the mouse, the character will start to head towards the new position. if you don't want this, you will need two variables (walk x and walk y).
when green flag clicked
|if <mouse down?>|
|wait until <not<mouse down?>>|
|set walk x to (mouse x)|
|set walk y to (mouse y)|
glide [{speed}] to x: (walk x) y: (walk y)|
hope this helps!
No, it won't start walking towards the new position.
Once it starts gliding, it continues to glide towards the coordinates of the mouse when it was clicked, it doesn't change.
I wouldn't recommend using the glide block anyway though; it would sometimes go faster than other times, depending on the distance to the mouse-pointer when it's clicked.
If you want to see a method that makes the speed constant, I've made a project for it. Link in my earlier post ^_^
Last edited by RedRocker227 (2012-01-02 13:55:59)
Offline
StoryMaker wrote:
I'm not an expert, but this worked in my project:
[blocks]
<when green flag clicked>
<forever>
<wait until><mouse down?>
<glide( 1 )secs to x<mouse x> )y
<mouse y>
<end>
[/blocks]
yeah, probably something like that or:
<when green flag clicked>
<forever>
<if><mouse down?>
<glide( )secs to x <mouse x>)y
<mouse y>
Offline