Project 3 - Android Development
Contributers: Charles Bonoan and Arvin Shertukde
Prototype
- Description: For our application, we will be creating a 2D game that is based on using a sensor that detects the phone's tilt.
- To the left you can see what we intend to implement into our application. We want to keep track of player's lives and scores and want each level to become progressively harder.
- For the sensor, we plan on using the acceleromter to detect the tilt of the phone. However, we may need another sensor that detects the phone's inclination (upright or flat) so that when we get the data of the phone's tilt, it will be more accurate.
Data Input
-
Sensor Input
Since our application will mainly be using an accelerometer, the data we will be collecting is the angle that the phone is in on the X, Y, and Z axis. -
Value Range
The range of values for all three X, Y, and Z axes go from -180 degrees to 180 degrees. -
Testing Input
To test the sensors, we will use the emulator that Android Studio comes with. However, if the emulator is not meeting our standards for testing, we will have to buy a cheap Android device and use that for testing. -
Github
To push the project to my github, I initialized a repository in my project directory from the terminal on Android Studio. Then I created a new repository in Github and pushed my repository from my project directory to Github. Here is the link to the Github repo: https://github.com/cbonoan/PirateDefenders.git
Project 3 Progress
Milestones
- Created assets for the player, background, projectile, and enemy.
- Used the accelerometer sensor to gather data values on user tilt on the Z-axis.
- Used that data value gathered to move player left and right.
- Implemented collision detection and game over screen.
Future Goals
- Gather data values on X-axis in order to move player up and down.
- Create power ups (if time permits).
- Create score and highscore system (if time permits).
Final Project Update
Purpose Of App
Our idea for this project was to create a game application that detects the rotation of the device to move the player object left and right. We tested several sensors to see which one gave us the results we wanted, and we found out that the magnometer gave us what we wanted. Below you can see we detected the roation of the device on the Y-axis to get the player to move side to side as well as the title screen when the app starts up.
If an enemy object gets passed or hits the player, then a game over screen is shown. Example shown below.
Important Points
- Our project is based on the "endless waves" type of arcade game.
- Initially we used an accelerometer sensor to detect user tilt. We then found out that that type of sensor was not what we wanted because of how to player would have to tilt the device was not what we envisioned for this project.
- Upon further research, we decided to use the magnometer sensor so we can detect rotation on the Y-axis instead of tilt.
- Unlike the accelerometer, magnometer is measured in micro teslas.
- Using a Sensor manager, that is how we collected the values that the sensor outputted and stored it into a variable.
- Depending on how much the user rotates the device is how we determine whether the player object moves and in which direction.
- We did not use the data from the sensor to determine the speed of the player object, but rather set a speed the player will move.
What We Learned
- For both of us, this is our first time using Android Studio and creating an application with it. On top of that
we learned how to gather sensor data and how to use it in our application.
- On top of not knowing Android Studio, we both do not own Android devices, so as seen above, we had to use the emulator in order to test our application.
- It was helpful using the emulator because as you can see on the sliders, the values are actually outputted on the emulator, so it was a great tool for debugging any issues we came across.
- We both also learned how to use Java.
- Finally we learned how to create application assets (i.e. player, enemies, and background) as well as getting those objects to move on the screen.