In need of aid

Game Editor comments and discussion.

In need of aid

Postby luckydog » Sun Sep 27, 2009 10:14 am

Sorry if this is in the wrong section. I wasn't sure it was serious enough to go into the game development section, but feel free to move it if it's in the wrong forum.

Now, I wanted to make my enemies spawn at a random y position but I can't seem to find any documentation on using such a thing. I'll keep searching, but if you could help me it'd be much appreciated.
luckydog
 
Posts: 1
Joined: Wed Sep 23, 2009 9:56 am
Score: 0 Give a positive score

Re: In need of aid

Postby makslane » Sun Sep 27, 2009 12:38 pm

You can use the 'Create Actor' event with the script:

Code: Select all
y = rand(view.height);
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Re: In need of aid

Postby DST » Sun Sep 27, 2009 5:43 pm

For a little extra spawning control, i set my actors to do this on startup:

y=starty;

where starty is a global variable. Then, in the script that spawns the actors,

starty=rand(400)+40;
CreateActor(blah blah, blahx, starty, true);

(int a 640 x480 game, this will spawn between 40 and 440, so enemies won't be partially offscreen).

Now if you need to make arrays of enemies, you can always just set starty before spawning them. You can do the same thing with their health, speed, type, whatever.

for (i=0; i<10; i++){
starty=(i*40);
CreateActor(...
}

now you can spawn them in neat patterns.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest