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

#1 2012-06-28 20:18:01

Gemini8910
Scratcher
Registered: 2011-08-23
Posts: 24

Randomly Generate Enemies/Items

I know this has probably been asked a lot before, but what is a script for making enemies randomly generate?  smile  Same for items, but I assume they can use the same script.  tongue  Thanks!  smile

Offline

 

#2 2012-06-28 21:02:45

berberberber
Scratcher
Registered: 2012-03-08
Posts: 1000+

Re: Randomly Generate Enemies/Items

It depends.  Could you specify what you mean by "randomly generate"? Thanks!  big_smile


http://i47.tinypic.com/2iaa73k.png

Offline

 

#3 2012-06-28 22:06:24

Wes64
Scratcher
Registered: 2011-08-19
Posts: 1000+

Re: Randomly Generate Enemies/Items

We need to know the context of your problem. I don't know how to solve it right now, but I recommend using these blocks - (item (any) of (list) ) and  (pick random () to () )

Last edited by Wes64 (2012-06-28 22:06:36)


Experienced 2.0 Tester: Ask me questions!
Using Firefox 13.0, Flash plugin version 11.4.402.287, and Windows XP Professional.

Offline

 

#4 2012-06-28 23:08:51

berberberber
Scratcher
Registered: 2012-03-08
Posts: 1000+

Re: Randomly Generate Enemies/Items

If you mean spawn them randomly, that will be possible in Scratch 2.0.


http://i47.tinypic.com/2iaa73k.png

Offline

 

#5 2012-06-29 13:56:56

Gemini8910
Scratcher
Registered: 2011-08-23
Posts: 24

Re: Randomly Generate Enemies/Items

I mean spawn them in random places on a map. It's a RPG I'm making, so could there be a way to make enemies appear at a random location on a map when you enter?  tongue

Offline

 

#6 2012-06-29 13:57:43

wolfdude999
Scratcher
Registered: 2012-01-07
Posts: 1000+

Re: Randomly Generate Enemies/Items

Gemini8910 wrote:

I mean spawn them in random places on a map. It's a RPG I'm making, so could there be a way to make enemies appear at a random location on a map when you enter?  tongue

Is the RPG top-down or side-scrolling?


http://i48.tinypic.com/15yxmp4.png

Offline

 

#7 2012-06-29 21:37:46

Gemini8910
Scratcher
Registered: 2011-08-23
Posts: 24

Re: Randomly Generate Enemies/Items

Top down.  smile

Offline

 

#8 2012-06-29 21:40:01

wolfdude999
Scratcher
Registered: 2012-01-07
Posts: 1000+

Re: Randomly Generate Enemies/Items

Just have it set x to a random number from -240 to 240, set y to a random number from -180 to 180, and then have it show.


http://i48.tinypic.com/15yxmp4.png

Offline

 

#9 2012-06-29 22:00:50

Gemini8910
Scratcher
Registered: 2011-08-23
Posts: 24

Re: Randomly Generate Enemies/Items

Uhh... how exactly do I do that? o_O Sorry this is my first RPG, I've never had to use that before. >_<

Offline

 

#10 2012-06-29 22:06:25

wolfdude999
Scratcher
Registered: 2012-01-07
Posts: 1000+

Re: Randomly Generate Enemies/Items

Gemini8910 wrote:

Uhh... how exactly do I do that? o_O Sorry this is my first RPG, I've never had to use that before. >_<

Just use the "set x to __" and "set y to __" blocks from the motion tab but instead of putting numbers in them, use the "pick random __ to __" with those parameters.  Now does it make sense? 

Sorry, I would show you with scratchblocks but I can't figure out how do make what I want.


http://i48.tinypic.com/15yxmp4.png

Offline

 

#11 2012-06-30 00:04:48

Gemini8910
Scratcher
Registered: 2011-08-23
Posts: 24

Re: Randomly Generate Enemies/Items

Ah ok.  smile  I figured out the set x to but couldn't figure out the random number part.  tongue  But I found it. I tested it on my health items and it works!  big_smile  Now to make some enemies.  tongue  Thanks!  big_smile

Offline

 

#12 2012-06-30 00:19:27

thebriculator
Scratcher
Registered: 2011-07-11
Posts: 500+

Re: Randomly Generate Enemies/Items

for further clarification:

go to x: (pick random (-240) to (240)) y: (pick random (-180) to (180))


.     http://tiny.cc/2cwgpw    http://tiny.cc/viwgpw    http://tiny.cc/iwwgpw

Offline

 

Board footer