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

#1 2011-12-09 18:38:10

ThatTurtleIsPurple
Scratcher
Registered: 2011-12-09
Posts: 21

Script for making an object move then return, then move again?

I am trying to make a game where 3 or 4 enemies will be up along a set line. Then one or two of them will strike randomly, return to the line, and the process will repeat. The script I have is like this,
When flag is clicked, go to x: (set number) y: (random number from range), wait 3 secs, forever.
This works, only the enemy doesn't return to the line before striking again. Is there any script to do this?


49% of kids love Justin Bieber. 50% are plotting his death. If you are part of the 1% who really doesn't care, post this in your signature.

Offline

 

#2 2011-12-09 22:52:08

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Script for making an object move then return, then move again?

You just haven't sent your enemy back to your original spot! It's at its original spot, then you tell it to go to strike, waited three seconds, and then go to the exact same spot it's already in.  smile  Just put in another block saying "go to x:y:" at the end of your script, directing the sprite to where it's supposed to start, and all will be swell. Maybe add another short wait after that, too.

Offline

 

#3 2011-12-10 10:16:11

ThatTurtleIsPurple
Scratcher
Registered: 2011-12-09
Posts: 21

Re: Script for making an object move then return, then move again?

Oh! That works great! Thank you sooo much!  big_smile


49% of kids love Justin Bieber. 50% are plotting his death. If you are part of the 1% who really doesn't care, post this in your signature.

Offline

 

#4 2011-12-10 10:18:53

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Script for making an object move then return, then move again?

No problem. Glad to help!  big_smile

Offline

 

#5 2011-12-10 10:24:34

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Script for making an object move then return, then move again?

It's good that it's solved.
And you honestly have the best username on Scratch!  big_smile


Why

Offline

 

Board footer