From The Blog: Introducing “Match Three Space RPG” modular game template

match3spacerpg_iconThere are many ways to learn programming with Corona and one popular option is to look at completed project source code. With that in mind, Corona Labs is partnering with Michael Wilson of Ponywolf, LLC to provide you with great projects to study and learn from.

The first project in the series is Match Three Space RPG , a simple “match three” style game with a classic sci-fi RPG theme.

The goal of the project is to teach modular design and project organization while also providing reusable modules for your own apps.

The complete project is now available for free in the Corona Marketplace. Note that after you activate the project, you will need to access your Marketplace profile page to download the project .zip file. Or, if you wish to obtain the project directly, it’s available on GitHub.

Once you download the project, open it in the Corona Simulator and play around with the game to learn its flow/gameplay. Then study the code to see how everything works and how you can use its reusable heart meter, health bar, score keeping, hallway, and other modules in your own games.

Assets for all

This project also represents our first downloadable asset  in the Corona Marketplace. In addition to this project, we’re currently getting several more asset providers on-boarded. While their assets won’t show up in the main directory for a little bit longer, you will be able to access them by direct link and download them as the asset landing pages become public.

Conclusion

Corona Labs is committed to providing an ever-increasing level of learning materials to help you get the most out of your Corona app development experience. Please join us in the Corona Forums to discuss this project and tell us how you are using it.

View the full article

Typical match 3 games move the piece back when there is no match so what would the code be to do that in this example?

For the purposes of this framework, I needed the user to be able to keep going if there were no matches, so I removed that code. Basically, if cull == false when the board does it’s board:cull() function it’s easy to swap the two pieces back. It would be a good exercise to try to add that functionality back… Start looking here:

 if cull then board.status = "culling" board:updateStatus() local pieces = board.piece if pieces == nil then return false end for i = #pieces, 1, -1 do if pieces[i].cull then transition.to (pieces[i], { tag="board", time = 233, xScale = 0.001, yScale = 0.001, transition=easing.outExpo }) end end board.timer[#board.timer+1] = timer.performWithDelay(250, function () board:drop("down") end) else board.status = "idle" board:updateStatus() end end 

The code to swap the last two pieces back would be right after the else

Good luck!

Typical match 3 games move the piece back when there is no match so what would the code be to do that in this example?

For the purposes of this framework, I needed the user to be able to keep going if there were no matches, so I removed that code. Basically, if cull == false when the board does it’s board:cull() function it’s easy to swap the two pieces back. It would be a good exercise to try to add that functionality back… Start looking here:

 if cull then board.status = "culling" board:updateStatus() local pieces = board.piece if pieces == nil then return false end for i = #pieces, 1, -1 do if pieces[i].cull then transition.to (pieces[i], { tag="board", time = 233, xScale = 0.001, yScale = 0.001, transition=easing.outExpo }) end end board.timer[#board.timer+1] = timer.performWithDelay(250, function () board:drop("down") end) else board.status = "idle" board:updateStatus() end end 

The code to swap the last two pieces back would be right after the else

Good luck!