Need help with Spawn Enemy Function

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Need help with Spawn Enemy Function

Jet Set Willy
Hi there, I am a beginner with LUA (used it 4 years ago but have forgotten everything), and really need some help with this scenario that I'm trying to work through:


Can anyone out there help me?


If you were told that a function ‘SpawnEnemy’ took two inputs, the first is a table to spawn at (the table should have an x,y and z component) and the second argument was a string describing the type ‘small’, “medium” or “large”. Write a function that takes four parameters:

1. A starting position table.
2. An offset position table.
3. How many enemies to spawn?
4. Type of enemy to spawn?
 
An example call to the function may look something like this:
Local vStart = {x = 0, y =0, z = 0}
Local vSoffset = {x = 10, y = 0, z = 0}
SpawnEnemy(vStart, vOffset, 5, “large”}



Thanks in advance!