public function enemySpawn():void
{
var class:Class = FP.choose(Car, Boat, Plane);
var entity:Entity = new class();
add(entity);
}
I try to call this function in my world’s update function, and I get a runtime error, its very frustrating. The error message is,
[Fault] exception, information=ArgumentError: Error #1063: Argument count mismatch on Car(). Expected 1, got 0.
(Currently testing the code with only the Car entity, but for all intents and purposes (thank you jacobalbano) lets say that there exists a Boat and Plane entity).
If there is another method to randomly spawning from a pool of different entities, please enlighten me. Also an added bonus, I also want to spawn these entities at random times but also failed to do so. I am aware of the fact that Zach makes that possible in http://www.youtube.com/watch?v=vcfV1kovaRA. But I was also unsuccessful in randomizing entity spawns.
If there is a genius out there who can somehow successfully implement both random entity selection, and randomized(controlled) entity spawn rates, please I am in desperate need of your assistance!