Pages: 1
Right, so I am making a carnival game, and my problem, is when I want the sprite (a coin) to go to one of five sprites, and every time it touches it, to point in a random direction once, then move forwards until it hits one of seventeen sprites. I know how to make the coin move forwards until it hits one of seventeen sprites, I know how to make it go to one of five sprites, I just cant figure out how to make it point in a random direction every time it touches one of the five sprites because,
If i use the 'if' scratch block, it points in a random direction when it touches the sprite, but it only does it once and never again after that.
If I use the 'forever if' scratch block, once it touches one of the five sprites it just points in a random direction forever without stopping,
Once again please help! this project is due in on monday!
Thank you and I will check regularly so will answer any questions, suggestions or problems,
Thanks!,
DoowNimajneb
Offline
when gf clicked forever if <touching [sprites v]?> point in direction (pick random (180) to (-180)) // i think that works wait until <not <touching [sprites v]?> >
Last edited by zammer990 (2012-07-07 13:29:17)
Offline
zammer990 wrote:
when gf clicked forever if <touching [sprites v]?> point in direction (pick random (180) to (-180)) // i think that works wait until <not <touching [sprites v]?> >
i think that would work, but for angles convention its best to use 0 to 360
Offline
TRocket wrote:
zammer990 wrote:
when gf clicked forever if <touching [sprites v]?> point in direction (pick random (180) to (-180)) // i think that works wait until <not <touching [sprites v]?> >i think that would work, but for angles convention its best to use 0 to 360
Yea, I don't use angles much, and scratch turns 360 into -180 or something.
Offline
DoowNimajneb wrote:
If I use the 'forever if' scratch block, once it touches one of the five sprites it just points in a random direction forever without stopping,
That's not actually what the forever if block does. The name is slightly misleading: it is not
wait until <something happens> forever do stuff, it is actually equivalent to
forever if <something happens> do stuff endThere are many suggestions to remove this block because of exactly this kind of confusion. Did you actually try the forever if block?
forever if <touching [whatever sprite you want v]?> // or forever then if as noted above point in direction (pick a random (0) to (360)You could also do 180 to -180; it doesn't actually matter.
Offline
joefarebrother wrote:
DoowNimajneb wrote:
If I use the 'forever if' scratch block, once it touches one of the five sprites it just points in a random direction forever without stopping,
That's not actually what the forever if block does. The name is slightly misleading: it is not
wait until <something happens> forever do stuff, it is actually equivalent toforever if <something happens> do stuff endThere are many suggestions to remove this block because of exactly this kind of confusion. Did you actually try the forever if block?
By the way, the answer to the problem isforever if <touching [whatever sprite you want v]?> // or forever then if as noted above point in direction (pick random (0) to (360))You could also do 180 to -180; it doesn't actually matter.
fixed (your) [scripts]
Last edited by berberberber (2012-07-07 18:18:34)
Offline
i did test the 'forever if' block, thats what it did...
Offline
Pages: 1