i am new to corona and lua so i have some problems in making my game…i want to develop a game with different stages (near about 50).so i am totally confused how to organize the basic structure of our program.i just dont know any api which can control this kind of situation .in all different stages many of lines are similar and i dont know how to avoid same type of coding again and again in this situation.i have searched same type of problem in forum them many of post suggested to implement module method…well i dont know how it can be done…and one more thing i want to know is that what are the performance issues in this type of situation .
i mean graphics for every stage plus coding, is corona okay with such type of complexity and what measures should i take to make performance of this app better and how to save memory,?
Generally speaking there are two ways to attack this problem.
if your levels/stages can be described in data (image file names, x, y coordinates of objects, etc.) then you can have a big table of level data and use a single game module that reads that data, draws and runs the level. This reduces code quite a bit.
If your levels are drastically different you may have to code each stage differently.
Now somewhere in between, lives a world where you may have unique features but it’s mostly data driven. At this point you would pull the unique gameplay code out into it’s own module.
As an example I’m building a side scrolling sci-fi shooter. I have multiple enemy types that have different behaviors. Each enemy type has its own .lua file that I can require into my game.lua and use when I need it. In other words, game.lua doesn’t have the enemy code in it.
Generally speaking there are two ways to attack this problem.
if your levels/stages can be described in data (image file names, x, y coordinates of objects, etc.) then you can have a big table of level data and use a single game module that reads that data, draws and runs the level. This reduces code quite a bit.
If your levels are drastically different you may have to code each stage differently.
Now somewhere in between, lives a world where you may have unique features but it’s mostly data driven. At this point you would pull the unique gameplay code out into it’s own module.
As an example I’m building a side scrolling sci-fi shooter. I have multiple enemy types that have different behaviors. Each enemy type has its own .lua file that I can require into my game.lua and use when I need it. In other words, game.lua doesn’t have the enemy code in it.