Hey I was wondering if someone cold help me with this...
I want to make a sprite appeer in different places each time I press the green flag...
can someone help me do this?
Thanks!
Offline
<when green flag clicked>
<go to x <pick random(1 )to( 480 )y
<pick random(1 )to( 360
That script will make your sprite appear in a random location every time the green flag is clicked.
Offline
Wait....I tried this and well...here is what happens
I am a starfish sprite and i'm trying to collect money(which is the sprite that moves in different places)
My background is scrolling, so how do i collect the money?
Offline
Post what you have so far, and we can make better informed suggestions.
Offline
ok...look for "money hunt"
Offline
Hey I noticed that your is a remix of one of my projects. It would be nice if you mentioned that you used my codes in your project notes. I think you may want to double check my project because there are a lot of overlapping area sprites because you never set the y positions of the area sprites.
Ok now for the random positioning.
Every non-player sprite affected by scrolling will have a script that looks like this. The sprite needs to have 2 variables to store it's x and y position. I called these variables freemoveX and freemoveY.
<when green flag clicked>
<forever>
<go to x (( <{ scrollX }> <+> <{ freemoveX }> )) )y
(( <{ scrollY }> <+> <{ freemoveY }> ))
<end>
If you want to randomize the position of these variables on the scrolling screen just randomize the freemoveX and freemoveY variables.
like this
<when green flag clicked>
<set{ freemoveX }to(<pick random( 1 )to( 2400
<set{ freemoveY }to(<pick random( 1 )to( 1400
Last edited by archmage (2008-03-23 18:32:56)
Offline
I have found an easier method to do scrolling with many sprites . It requires only 2 variables.[blocks]first make a variable <{scroll x}> After that make a variable <{ steps }>
then go to the stage and write in this script <when green flag clicked><forever><if><key[right arrow]pressed?><set{scroll x}to(-3)<wait( 3)secsc> <set{ scroll x}to( 0) and for left arrow do the same thing but change -3 to 3.Then also write<when green flag clicked><forever><if><key[right arrow]pressed?><change{ steps }by(1). Do the same thing for the left arrow but exchange 1 by -1. Then write in if the Green flag pressed Forever If Steps = 30 or >30 then broadcast come on. Then make a sprite and in it write Forever change x by scroll x. Then type when Green flag pressed hide . Then type When i receive come on go to x 230 and y 100 or wherever you want show and then snap the previous script to it. and then type When green flag clicked forever wait until x < 150 and touching edge
hide. Then go to the stage and type if steps <250 broadcast come again. And in the sprite type If i receive come again go to x-238 and y100 or whatever you want it to be . Now it will not flicker when it comes .thanks. :-)
Offline
thx man!
Last edited by auburn1996 (2008-03-24 19:42:28)
Offline
sorry archmage...I will be sure to mention you
Offline
HOW DO YOU MAKE SCROLLING GAMES!!!
Offline
Go to http://scratch.mit.edu/forums/viewtopic.php?id=2440 for scrolling help.
Offline