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

#1 2011-10-26 16:11:50

ManiacMoose
New Scratcher
Registered: 2011-09-26
Posts: 4

Script help? (objects fly in and out of screen)

I'm creating an avoider game, and I would like help with a script in which a sprite will randomly fly in and out of the screen.

Help would be much appreciated.

Offline

 

#2 2011-10-26 19:49:09

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Script help? (objects fly in and out of screen)

Could you be more specific please?  Is it flying from side to side? Top to bottom? Or a curved path? Is it going at a constant rate? or slowing as it enters and speeding up as it exits?  Is it random placement?


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#3 2011-10-26 19:51:04

aldenhorbach
New Scratcher
Registered: 2011-09-22
Posts: 23

Re: Script help? (objects fly in and out of screen)

actually i have the same question.. im making it from top to bottom.. and i need help..

thanks

Offline

 

#4 2011-10-26 19:56:45

aldenhorbach
New Scratcher
Registered: 2011-09-22
Posts: 23

Re: Script help? (objects fly in and out of screen)

ive got 3 balls that i want to come down from the top.. i did this to make them pick a random spot to fall from:

[blocks]
<when green flag clicked><set x to( <pick random( -200 )to( 200 )

Offline

 

#5 2011-10-26 20:00:50

imaperson123
Scratcher
Registered: 2011-07-20
Posts: 100+

Re: Script help? (objects fly in and out of screen)

when flag clicked, go to border. if touching border, brodcast go to spawn point. when i recieve go to spawn point, pick random 1-5 seconds. repeat until touching border. hope i helped.


http://gstheadquarters.weebly.com/uploads/9/3/8/8/9388597/7786047.gif [img][/img] http://internetometer.com/image/31593.png http://blocks.scratchr.org/API.php?user=imaperson123&amp;action=onlineStatus

Offline

 

#6 2011-10-26 20:26:43

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: Script help? (objects fly in and out of screen)

When Green Flag Clicked:
forever {
go to x: (pick random -240 to 240) y: 180.
repeat until <(y position) < -239> {
change y by (NEGATIVE NUMBER HERE). }
}

That will work if you want it to fall on a random x from top to bottom.

Offline

 

#7 2011-10-27 12:27:33

aldenhorbach
New Scratcher
Registered: 2011-09-22
Posts: 23

Re: Script help? (objects fly in and out of screen)

ive got a problem. i can make it work if the -y equals -2... but then the balls fall really slow, and when i try to speed it up i doesnt work anymore. they fall once and dont go back up to the top... help?


thanks,

alden

Offline

 

#8 2011-10-27 14:49:17

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

Re: Script help? (objects fly in and out of screen)

aldenhorbach wrote:

ive got a problem. i can make it work if the -y equals -2... but then the balls fall really slow, and when i try to speed it up i doesnt work anymore. they fall once and dont go back up to the top... help?


thanks,

alden

You must have changed another part of the script, if you just changed the -2 to -3 (or another number) then it should do just the same, but fall faster.


Why

Offline

 

#9 2011-10-27 17:14:16

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: Script help? (objects fly in and out of screen)

aldenhorbach wrote:

ive got a problem. i can make it work if the -y equals -2... but then the balls fall really slow, and when i try to speed it up i doesnt work anymore. they fall once and dont go back up to the top... help?


thanks,

alden

Are you sure you got the script completely right?  Maybe you used = instead of < ...

Offline

 

Board footer