<commit_before>---
layout: post
author: JayYang95
title: "Jay's Game App"
---

<iframe src="https://trinket.io/embed/python/68bf04622d" width="100%" height="600" frameborder="0" marginwidth="0" marginheight="0" allowfullscreen></iframe>

Original Milestones:

 - [] Movement controlled by arrow keys
 - [] Keep track of counter variables for points
 - [] Click events to change game settings
 - [] Replay option
 - [] Use more modules
 - [] Win condition when enough points accumulated and user has reached certain area that ends the game
 - [] Lose condition that ends the game
 

Revised Milestones:

 - [x] Movement controlled by arrow keys
 - [x] Keep track of counter variables for points
 - [ ] Replay option
 - [x] Use more modules
 - [x] Create a class
 - [x] Win condition when enough points accumulated
 - [x] Lose condition when user collides with enemy
 - [x] Click events to change game settings(difficulty)
 - [x] Display current settings and state of counter variable
 - [x] Randomly place enemies
 - [x] Randomly place collectables
 - [x] Have enemies move completely randomly without moving outside of the screen
 

Reflection:

  Original game mechanics - I wanted to have the user be able to move the main turtle with the arrow keys. Specifically, I wanted it so
  that pressing up would make the turtle face up and move up, pressing left would make the turtle face left and move left, and so on.
  I managed to get this to work. However, I was extremely bothered by the fact that I could not get the turtle to face diagnoally when
  two keys were pressed at once. Instead it would move diagonally, but its heading would rapidly fluctuate between the two keys pressed.
  I tried to create some boolean variables such as "goingup" or "goingright" that were initialied to False and would equal True whenever
  their respective key was pressed, then turn back to False when it was released. That way, pressing up and right at the same time would
  set both goingup and goingright to True. We could check for this in the key functions and if they were both True, then we would set
  the turtles heading to be between 0 and 90 = 45. Unfortunately, I think when the user holds down a key, it is registered as rapdily
  pressing the key rather than one long hold and release, which made my logic invalid.
  
  Revised mechanics - Because I couldn't fully get the intended arrow key movement to work, I just made it so that up and down were
  forward and backwards respectively and left and right turned the turtle. I also intended for there to be a replay option, 
  but I could not get it to fully work as my collectable turtles and counter variable were not resetting correctly. A final feature that
  I left out was requiring the user to collect all the "points" AND reach a certain area to win. I decided to only require the points.
  I had the difficulty settings increase the speed and maximum distance travelled in one instance of the enemy turtles. I had intended
  the difficulty settings to also increase the amount of enemies and collectables but did not have enough time to implement them.



<commit_msg>Fixed paragraphs in Jay's Game App<commit_after>---
layout: post
author: JayYang95
title: "Jay's Game App"
---

<iframe src="https://trinket.io/embed/python/68bf04622d" width="100%" height="600" frameborder="0" marginwidth="0" marginheight="0" allowfullscreen></iframe>

Original Milestones:

 - [] Movement controlled by arrow keys
 - [] Keep track of counter variables for points
 - [] Click events to change game settings
 - [] Replay option
 - [] Use more modules
 - [] Win condition when enough points accumulated and user has reached certain area that ends the game
 - [] Lose condition that ends the game
 

Revised Milestones:

 - [x] Movement controlled by arrow keys
 - [x] Keep track of counter variables for points
 - [ ] Replay option
 - [x] Use more modules
 - [x] Create a class
 - [x] Win condition when enough points accumulated
 - [x] Lose condition when user collides with enemy
 - [x] Click events to change game settings(difficulty)
 - [x] Display current settings and state of counter variable
 - [x] Randomly place enemies
 - [x] Randomly place collectables
 - [x] Have enemies move completely randomly without moving outside of the screen
 

Reflection:

Original game mechanics - I wanted to have the user be able to move the main turtle with the arrow keys. Specifically, I wanted it so that pressing up would make the turtle face up and move up, pressing left would make the turtle face left and move left, and so on. I managed to get this to work. However, I was extremely bothered by the fact that I could not get the turtle to face diagnoally when two keys were pressed at once. Instead it would move diagonally, but its heading would rapidly fluctuate between the two keys pressed. I tried to create some boolean variables such as "goingup" or "goingright" that were initialied to False and would equal True whenever
their respective key was pressed, then turn back to False when it was released. That way, pressing up and right at the same time would set both goingup and goingright to True. We could check for this in the key functions and if they were both True, then we would set the turtles heading to be between 0 and 90 = 45. Unfortunately, I think when the user holds down a key, it is registered as rapdily pressing the key rather than one long hold and release, which made my logic invalid.
  
Revised mechanics - Because I couldn't fully get the intended arrow key movement to work, I just made it so that up and down were forward and backwards respectively and left and right turned the turtle. I also intended for there to be a replay option, but I could not get it to fully work as my collectable turtles and counter variable were not resetting correctly. A final feature that I left out was requiring the user to collect all the "points" AND reach a certain area to win. I decided to only require the points. I had the difficulty settings increase the speed and maximum distance travelled in one instance of the enemy turtles. I had intended the difficulty settings to also increase the amount of enemies and collectables but did not have enough time to implement them.
{'fraction_non_alphanumeric': 0.04692504804612428, 'fraction_numerical': 0.007367072389493914, 'mean_word_length': 3.992006394884093, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5434997', 'n_tokens_mistral': 1568, 'n_tokens_neox': 1462, 'n_words': 989}