top of page
Search

PAPER, SCISSORS, ROCK!! Rock beats scissors!! yay!!!

Writer's picture: Adam HouseAdam House

Ladies and gentlemen, I give you a simple game that people have played for over 1000s of years, it’s a game of rock, paper, scissors!!! But this time, it's on your iPhone! WOOWWW!! A nearly 2000-year-old game on your iPhone? It may not be original, but it's handy for your iPhone whenever you don’t have anyone else to play with!


The game may look simple to make and plays exactly the same rock, paper, scissors game everyone plays, but I programmed it slightly differently from how I am used to comparing when I program other games.


WHAT I LEARNT:

• Animation state machines don’t have to be linked by transitions to play animations.

• Using event system to pass information of strings, switches, and Enums to other scripts. • Using the string names to assign to different Enum types.

• Changing images of the rock, paper, and scissors for both player and A.I.’s choices before showing what each of them has chosen.

• Making the AI use the same variation of the Enum that contains info of rock, paper, scissors without making a new enum just for the A.I.

• Assigning random ints in Random.RandomRange of the A.I’s enum to randomly choose of rock, paper, scissors which will show the image of what it has chosen on the same image property each round.

• UI can be grouped to be moved or faded together at the same time.

• Can compare with Player’s rock paper scissors enum choice with the A.I’s to determine who wins the round or if it’s a draw with each if statement. E.g if the player chooses rock and A.I choose scissors = the player wins and wins a point. Another eg if both Player and A.I pick rock = it’s a draw and no one scores a point.

• You can have more than 2 yield return new WaitForSeconds in an Ienumerator to time the code in between them to run more code.


WHAT I COULD HAVE DONE BETTER:

• I could have shown the score of both the player and A.I while the UI shows what they both chose rather than at the selection of rock, paper, scissors making it less claustrophobic. However, at the last min I chose that the player needs to see their score rather than choosing first. Maybe I could have made the text smaller? OVERALL: Again, different style of programming, which is quite simple, but learned new tricks up my sleeve that will be useful to build my future games.




2 views0 comments

Recent Posts

See All

Comments


bottom of page