Assignment 3B: Rock/Paper/Scissors (Version B)
Assignment 3B — Rock/Paper/Scissors app version B is the
second version of the Android app based on the hand game
"Rock-Paper-Scissors". In Version B, the three rock/paper/scissors
Buttons are replaced with ImageButtons. This time, when
the player chooses between the three weapons, a computer player
randomly chooses a weapon to go against the human player. The app then
determines the winner (or if it's a draw) based on what the human and
computer players have chosen.
Process:
- The code within the main class (RPSVb.java), as well as within the XML
file (activity_rpsvb.xml), were borrowed from Professor Odendahl.
- activity_rpsvb.xml makes use of LinearLayout, as opposed to
ConstraintLayout, in order to give us a simpler button layout process.
- Images representing the rock, paper, and scissors
buttons; as well as an image to replace the ugly wall in the center,
were placed in the app\src\main\res\drawable directory within the project
folder
- The sound files that play once the user has clicked on one of the three buttons
were placed in the res\values directory within the project folder
- Adjusted the size of the images relative to the ImageButtons and
ImageViews in which they were displayed with android:padding
This is what the application looks like on startup.
This is what the app may look like upon clicking the ImageButton
representing paper. In this case, it was a tie between the player and the computer
opponent, since the computer also happened to choose paper.
Assignment Page