Hi, I’m making this asteroids like game in the Android platform and what I want to do is spawn random power-ups without the power-ups going out the screen. I clamped the X and Y to the edges of the screen to prevent objects from going out of bounds.
So how do I spawn random power-ups without going out of the screen?
Here’s the clamped values:
var xPos : float = Mathf.Clamp(transform.position.x, Screen.width * .057, -Screen.width * .057);
var yPos : float = Mathf.Clamp(transform.position.y, Screen.height * .057, -Screen.height * .057);
And how do you spawn power-ups one at a time at a random time in a game? For example, only 1 power-up can spawn at a time then after getting that power-up, a timer with a random time ( let’s say 5 - 15 seconds after getting that power-up ) will count then another power-up will spawn.
I hope you get what I mean.
May you please provide me a sample javascript of this?
I appreciate the help of whoever’s going to help me here. Thank you