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

#1 2012-07-02 09:24:56

suben380
New Scratcher
Registered: 2012-06-22
Posts: 10

How to make RANDOM position for a sprite? PLEASE HELP!

So, how do I make a random x-position for a sprite every time it hits the edge?
But it has to be on the top and not close to the edges!


(i am trying to make like an apple fall or something then you have to catch it or it will go to the ground, after that it falls down from a different place)

THANK YOU FOR ANSWERING!!!

Offline

 

#2 2012-07-02 09:35:03

SciTecCf
Scratcher
Registered: 2011-11-23
Posts: 1000+

Re: How to make RANDOM position for a sprite? PLEASE HELP!

forever if <touching [edge v]?>
 go to x: (pick random (-200) to (200)) y: (150)
end


http://bit.ly/LCZEJRhttp://bit.ly/LSONcOhttp://bit.ly/LF3vIc
http://trinary.site40.net/images/scratchrank.php?username=SciTecCf&amp;display=small

Offline

 

#3 2012-07-02 09:35:46

360-International
Scratcher
Registered: 2011-07-17
Posts: 100+

Re: How to make RANDOM position for a sprite? PLEASE HELP!

forever
if <touching [edge v]?>
go to x: (pick random (-240) to (240)) y: (starting y position)
end
EDIT: Outposted.

Last edited by 360-International (2012-07-02 09:37:03)


https://lh4.googleusercontent.com/Oib6kyze-OrCFIRlqL6HYnWuHBQp1GfFoh5CkBlZGe3_9WCk-_DDwgfFrnD_mxJ_x2b18hMUyV2KVtIDiLdebyWaQQ6fbpKpZs-8auVep1zoSgOv-iA

Offline

 

Board footer