private void SpawnAsteroid() { AsteroidOld newAst = (AsteroidOld)asteroid_.Instance(); InitializeAsteroid(newAst); AddChild(newAst); }
private void InitializeAsteroid(AsteroidOld asteroid) { var rect = GetViewport().Size; asteroid.Position = new Vector2((float)GD.RandRange(0, rect.x), -100); asteroid.AngularVelocity = (float)GD.RandRange(-4, 4); asteroid.AngularDamp = 0; asteroid.LinearVelocity = new Vector2((float)GD.RandRange(-300, 300), 300); asteroid.LinearDamp = 0; }