Page 1 of 1
random timer actor create
Posted:
Thu Feb 04, 2010 12:11 am
by J Maker
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.
Re: random timer actor create
Posted:
Thu Feb 04, 2010 12:35 am
by skydereign
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.
Re: random timer actor create
Posted:
Thu Feb 04, 2010 2:51 am
by J Maker
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
Re: random timer actor create
Posted:
Thu Feb 04, 2010 2:59 am
by skydereign
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.
Re: random timer actor create
Posted:
Fri Feb 05, 2010 4:13 am
by J Maker
O! lol ok, thx, i missed that.