random timer actor create

Game Editor comments and discussion.

random timer actor create

Postby J Maker » Thu Feb 04, 2010 12:11 am

so i want to make a survival game with random enemies popping up. i kno that to make the enemies pop up randomly i need a timer set to random and when the timer goes off it will create an enemy actor. but i want them to pop op all along the x-axis that is equal with another actor. i remember using a code like that before but i cant find it in any of my games. it has to do with when the timer goes off it will create along the x-axis of the actor that is doing the creating. if someone could help me out with that and possibly the y-axis too that would be great.
Some people believe Chuck Norris evolved from a dinosaur, the Chucknorisaurus.
----------------------------------------------------------------------------------
Chuck Norris doesn't sleep, he waits.
----------------------------------------------------------------------------------
Chuck Norris doesn't hunt, he kills.
----------------------------------------------------------------------------------
Chuck Norris once shot down a german fighter plane with his finger by yelling BANG!!!
----------------------------------------------------------------------------------
User avatar
J Maker
 
Posts: 177
Joined: Fri Jun 22, 2007 4:17 pm
Location: in the stick version of Hyrule
Score: 10 Give a positive score

Re: random timer actor create

Postby skydereign » Thu Feb 04, 2010 12:35 am

Well, when creating the actor set the CreateActor to be relative to your actor. This means the point (0,0) is the center of your actor. If you want to create the actor somewhere on the x-axis, set that part to random, as shown below.
Code: Select all
CreateActor("actorName", "animationName", "(none)", "(none)", rand(100)-rand(100), 0, false);


What the rand is doing is allowing it to be randomly placed between -100 and 100 pixels. Switch the x with y to switch the axis.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: random timer actor create

Postby J Maker » Thu Feb 04, 2010 2:51 am

thx man, works like a charm, but what x am i supposed to switch? or is there another thing i should switch? i dont wanna sound like a noob but i dont see an x
Some people believe Chuck Norris evolved from a dinosaur, the Chucknorisaurus.
----------------------------------------------------------------------------------
Chuck Norris doesn't sleep, he waits.
----------------------------------------------------------------------------------
Chuck Norris doesn't hunt, he kills.
----------------------------------------------------------------------------------
Chuck Norris once shot down a german fighter plane with his finger by yelling BANG!!!
----------------------------------------------------------------------------------
User avatar
J Maker
 
Posts: 177
Joined: Fri Jun 22, 2007 4:17 pm
Location: in the stick version of Hyrule
Score: 10 Give a positive score

Re: random timer actor create

Postby skydereign » Thu Feb 04, 2010 2:59 am

In the CreateActor function, you pass it xy values for the create. In the case above, the rand(100)-rand(100) is in the x variable spot, and 0 is the y. So you would switch those two around to get the y-axis version.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: random timer actor create

Postby J Maker » Fri Feb 05, 2010 4:13 am

O! lol ok, thx, i missed that.
Some people believe Chuck Norris evolved from a dinosaur, the Chucknorisaurus.
----------------------------------------------------------------------------------
Chuck Norris doesn't sleep, he waits.
----------------------------------------------------------------------------------
Chuck Norris doesn't hunt, he kills.
----------------------------------------------------------------------------------
Chuck Norris once shot down a german fighter plane with his finger by yelling BANG!!!
----------------------------------------------------------------------------------
User avatar
J Maker
 
Posts: 177
Joined: Fri Jun 22, 2007 4:17 pm
Location: in the stick version of Hyrule
Score: 10 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron