Is there a way to have a sprite moving full stage width on the x: axis, but within 60 and -75 on the y: axis? I would prefer that this movement be random rather than just moving across the stage on a straight line. Ideally the sprite would reach x: -240 point and disappear, and then appear again from the left side at x: 240 and again wander across the stage. Also, I'm not looking for a continuous feed of one sprite following the other as soon as one reaches x: -240. There will be a random variable delay between the sprites. You can see my partially completed script at:
http://scratch.mit.edu/projects/Nodrogchavez/2852913
I want the sprite to move in the area between the existing sprites.
Gordon
Offline
You want the sprite to wander across the screen, but keep its y position between -75 and 60?
I can't guarantee it will stay exactly within -75 and 60, but the following script should work fairly well. I would probably disable your rotation is you use it. Hope that's what you wanted
when gf clicked forever go to x:(-240) y:(0) point in direction (90) repeat until <(x position) > (240)> if<<(y position) > (45)> and <(direction) < (90)>> turn cw (4) degrees else if<<(y position) < (-60)> and <(direction) > (90)>> turn ccw (4) degrees else turn cw (pick random (-4) to (4)) degrees end end if<(direction) < (-90)> point in direction (-180 v) end if<(direction) < (0)> // must follow "it" block above to work point in direction (0 v) end move (3) steps endEdit: change to script to avoid rare glitches.
Last edited by MoreGamesNow (2012-10-23 21:33:01)
Offline
Thank you so much for that, and it does seem to work. I'll have to tweak things a little, as I want my photo (by the mike) to duck if that sprite is going to touch it. It does get as low as -85 sometimes, but I'll be able to figure out how to adjust that. I also need to slow down the occurrences, rather than have the sprite in a non-stop loop, So, I'll add in some random timing on that point. But overall you have gotten me further down the road in understanding how Scratch works.
I am new to the Scratch program, but am slowly getting there. Your input has helped me a lot on my learning curve of variables, operators and so on.
Thanks again.
Offline
Is there a way to have 2 stages? I would like to first show just a whte stage with some credits on it for a period of something like 5 - 10 seconds, and then have the script move on to the Project 0 page where the presentation resides. I have looked at the 'go to front' and 'go back X layers', but don't see how that would help. I sense that the change backgrounds option when the stage is selected might be the answer, but not sure how I would get text onto that. Any suggestions would be appreciated.
Offline