Consolidation week work- Beginning 25th October 2021
- Sadie Read
- Oct 26, 2021
- 3 min read
Task 1- Croc simulator
I was asked to look at just the code of the game to try to figure out how to win it. At the start of the game the player was asked to enter an amount of croc food. The player then wanders around the grid. If the player leaves the grid, they get attacked by the crocodiles, however if the player is carrying more than 1000 croc food they win as the crocs are distracted.
I then boundary tested the number 1000 using 999,1000 and 1001. 999 and 1000 led to me being killed whereas 1001 led to be being saved and winning the game.
I improved this code by adding a random croc spawner. The croc spawns at random points and if the player and croc share the same space then the croc can eat the player if they do not carry enough food. This was a good skill to try out because I was able to get it to work and it’s something I may want to include in my final project.
To improve the code, I would create a separate class for croc and have multiple croc enemies randomly spawning.
Task 2- Source control
For the next task I had to watch a few videos about source control and why they are important, its import ant to have back ups of your files of all versions that can be accessed from anywhere. I decided to use GitHub, so I installed the modifier and linked my account. I then uploaded my previous files onto GitHub, and I am now ready to use it in my code every time.
Task 3- Adventure Island
I took the code and placed it within the visual studios and pushed it to GitHub. I then played the game to see what happened and realised it was very boring, I decided I would attempt to make it more fun by randomising multiple sports in which treasure can spawn.
I stared by using the original code as a templated such as the co-ordinate system but changed the introduction to be more game like by taking the players name and asking them if they are ready to go and find treasure.
I made the game a treasure hunt with 5 locations of rubies. The user was told 3 but the game could not be won until the other 2 locations where found, however there is a way to exploit this by revisiting a known point. I was unsure of how to fix this so I will place the code in discord and let my peers also have a go at trying to fix it. Also, I tried to get the locations of the rubies to spawn differently each game, but there was trouble with this, and I am unsure how to fix this. I do need to investigate this as it is a feature I want to use on my final project. The game is honestly super fun and for me it was a test of the order of code as we already had building blocks that we had to use as our bases so this meant when adding more while loops and if statements I had to place them in the correct order as at one point by code was signifying the game had ended but yet it still carried on due to the placement of the code so I fixed this by moving it up one indentation and it worked perfectly.
Comments