11.12.15

Ecocarnival Alpha

In an early class I took for my undergraduate degree in Information Systems, a team and I came up with the concept "Ecocarnival." It was pitched as a collection of mobile games that taught its players about green practices.

The old posts: [1] [2]

Fast forward to now, four years later, I implemented the application via xCode 7, Swift 2, Spritekit, Core Animation, and Core Graphics for 67422, a class about iOS development. It ended up winning best of class, netting me an iPad air! Here's a video of me playing on an emulator though.


While Ecocarnival is supposed to be a collection of games, it actually only has one at the moment. The one you see above in the video and screenshots is "Trash Ninja," which is inspired by Halfbrick Studios "Fruit Ninja." But there are a lot of twists that differentiate the two games.


In "Trash Ninja," you have to sort trash into the right bin. See a chocolate bar? Toss it in the trash. A soda can? That goes in recycling. A rat? That...goes on the ground. Don't put the rat in the trash. Making the wrong move causes you to lose a life. As you earn points by making the right decisions, the game is paused and a new item is added to the pool. This way, people will steadily learn what is recyclable and what is not.

The start screen acts as a portal to other games
While the game is simple from the user's perspective, there are actually a lot of small things happening in the background. Items have different percentages of spawning (40% trash, 40% recyclable, 15% animals, 5% power ups) and within each category, my game picks out something to spawn given the pool of available items. Point values are based on how common the item is.

In game! Using Spritekit to simulate physics. Can touch the drag trash and toss it into the right bin
Meanwhile, items (really subclasses of SKSpriteNodes) can detect collision and, essentially, when they collide with a trash can. That's when I detect if a right decision has been made. The pause screen is actually a UIView that pauses the scene and presents itself over it - allowing players to dismiss it and return to the game without being taken to "somewhere else."

Game over with the custom UIview, when a new high score is made. I liked implementing the confetti 
Programming for iOS presents its own unique challenges. I feel I learned a lot about how to keep a xCode project optimized and organized in their way (using groups instead of folders, a spriteatlas, etc). I learned how to properly debug Swift, how to search for memory leaks, how to install modules via Cocoapods, managing app state, saving data, and more. One thing I'd like to continue improving on is implementing responsive layouts however. Autolayout didn't really work for many of my more complex screens, and I'd like to research what the best way to achieve responsiveness is for native applications.

Still, I think it's really fitting to close off this year by creating a project that, four years ago, I thought I'd never be able to do! I feel that Ecocarnival can be built on in the future as well (adding a compost bin to Trash ninja, other games, a leaderboard, fixing and polishing, currency... so many possibilities!) so who knows? Perhaps you'll see it in the app store one day.  : )

No comments:

Post a Comment