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

#1 2007-07-08 13:15:05

Lindsay_7321
Scratcher
Registered: 2007-06-30
Posts: 25

Glide To Mouse Pointer For RPG :D But How???

Ok, This Is For A RPG I Am Making On Scratch



1. How Do I Make A Sprite Move Or Glide Towards Another Sprite, Anywhere On The Screen?

2. If You Have Any Other Tips Or Ideas For My RPG Please Tell Me


But First, Please Try Answer 1.



Thanks  big_smile



HERE IT IS, TELL ME WEATHER TO FINISH IT OR NOT

http://scratch.mit.edu/projects/Lindsay_7321/20182

Last edited by Lindsay_7321 (2007-07-08 15:11:03)

Offline

 

#2 2007-07-08 13:25:00

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

Re: Glide To Mouse Pointer For RPG :D But How???

Movign towards is easy.  use the "Poitn towards" command and then use "move x steps".  You'll want the point towards and move commands inside a loop, so that it keeps going until it reaches your target.

Repeat until touching "sprite 2"
- Point towards "sprite 2"
- Move forward 10


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-07-08 13:44:47

Lindsay_7321
Scratcher
Registered: 2007-06-30
Posts: 25

Re: Glide To Mouse Pointer For RPG :D But How???

Thanks!!!
big_smile

Offline

 

#4 2007-07-08 14:28:00

Lindsay_7321
Scratcher
Registered: 2007-06-30
Posts: 25

Re: Glide To Mouse Pointer For RPG :D But How???

Also, How Do I Make Him Switch His Costume If "Sprite 2" Is To The Left Of Him???

Offline

 

#5 2007-07-08 17:11:58

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: Glide To Mouse Pointer For RPG :D But How???

There are a couple of different ways: 

1) have an "all sprites" variable that Sprite 2 sets to his x position.  compare your x to that variable.

2) point to sprite 2 and check the direction: positive is right and negative is left.  If you want to do this without losing your direction, you can use a variable saved_dir

     set saved_dir to direction
     point towards sprite 2
     if  direction < 0
         set costume to <left costume>
     point in direction saved_dir

You'll lose a tiny bit of information, since the Squeak implementation of <direction> rounds the direction (which it shouldn't).

Offline

 

Board footer