Giter VIP home page Giter VIP logo

reflexgame's Introduction

Reflex Game

Overview

This is a simple Android game. The objective of the game is to tap the circle spots on the screen before they disappear. You start with 5 lives and the game ends when you lose all of them.

Reflex Game playthrough

Download

This app is not available on Google play (maybe after some enhancements!). For now, you may download the apk and install it on your Android phone via usb. Alternatively, you can clone the repo and use Android Studio to run the app on your Android phone.

Development

I developed this app using only Android SDK and Java. I did not use any game engines or external libraries. I did this because I was very curious about the real difficulties of game development. In the end, I found the experience very rewarding. Here are some of the challenges I faced.

  • Architecture: from the beginning I wanted to design the app in a way that separated game logic from the view logic. I believed that I would likely want to change the layout of the app later on and I would not want to break the game while doing so. With this purpose, I divided the majority of logic for the game in three classes: 1) Game - a classes representing the state of the game, 2) GameRunner - the class performing all of the game logic and 3) GameView - an interface describing all that was required of the view layer; the interface was implemented by my Activity.
  • Parallel processing: I implemented this app such that the game logic runs in a secondary thread. Implementing this was hard. I wanted a dedicated thread to which I could submit my game logic as a runnable. The game runnable needs to be notified to finish running (and return) when the game is over, yet I wanted the thread to persist and simply wait for the game to restart. I could not achieve the effect I wanted using standard ExecutorServices and Looper/Handler Threads, however What I designed looks a little like a looper thread.
  • Animations and collision detection: working with Android's animators is not that intuitive, but the real challenge here was to code the spots' movements such that they would bounce from the walls. A typical game engine might do this using collision detection, but I thought that was an overkill for this game. What I set out to do was instead to figure out the trajectory of each spot at the moment of its creation and figure out when and how it should bounce from the borders of the layout. I then created an Android ObjectAnimator for each spot that contained the bouncing informaion. I do not remember how I coded this, but I am proud of myself. The result is a game that is not hard on your phone battery.

Future enhancements

I had bigger dreams for this game. It's easy to see it becoming the new Flappy Bird. But I think I have already implemented what I initially set out to implement and it is time to move on. I will likely add the ability to share the highscores on social media at some point and release the game... idk..

Thanks!

reflexgame's People

Contributors

tahahojati avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.