Commit Graph

81 Commits

Author SHA1 Message Date
Jeremy Rand e213cc918b Fix the last known bug. The "Game Over" screen is now shown when the first of the two players in a two player game runs out of lives. 2021-02-01 22:31:53 -05:00
Jeremy Rand 815758f3ff Rework the game logic to support one and two player games. 2021-01-20 00:06:32 -05:00
Jeremy Rand 678a9ee104 Add code to keep track of two separate screens of mushrooms for player 1 and player 2. 2021-01-17 14:51:36 -05:00
Jeremy Rand 384a9ea233 Make more globals per player and index into them with the player number at game time. 2021-01-10 23:17:05 -05:00
Jeremy Rand 1cd4ccea3a Start work on supporting two player games. When the user starts a two player game now, two scores are initialized and the number of lives of the two players are independently tracked. Also, all of the score code has been updated to increment the player one or player two score correct. Still need to implement the logic to save the game state per player and switch between the players on each death. 2021-01-06 23:27:51 -05:00
Jeremy Rand 4700bd9cff Fix a bug where the collision and collisionAddr writes went to the wrong bank, leading to memory corruption and crashes. 2021-01-06 22:21:31 -05:00
Jeremy Rand 3bb4572eb8 Prompt for the initials of the player when they get a high score. 2021-01-01 23:09:46 -05:00
Jeremy Rand 4c7e52af58 Scores are now added to the top ten list of high scores and saved to the settings file. There seems to be a bug with moving all of the other scores down but it is a start. The initials are hard coded to my own for now. 2020-12-31 14:04:20 -05:00
Jeremy Rand 4d6f8d39f1 Change the prompt when the stereo channels are swapped so the user gets some feedback. Display the high score list. Still need to add the code to update the high score list. 2020-12-30 23:10:22 -05:00
Jeremy Rand 6947d8762c Add a way to swap left and right stereo channels and save the value in the settings. 2020-12-30 02:31:18 -05:00
Jeremy Rand aee2b26fea Add some info about how to start a game and quit and make space for showing the high score list. 2020-12-29 14:15:25 -05:00
Jeremy Rand 10a1d075fd Add support for pausing the resuming the game. Now, any key pressed during a game pauses the game. Pressing q from the paused game will quit the game and any other key will resume the game. So, quiting with a game in progress takes two key presses. One key press to pause the game and then the user must press q or Q to actually quit. 2020-12-29 00:00:39 -05:00
Jeremy Rand d962e98368 Add the flea sound. 2020-12-22 01:00:10 -05:00
Jeremy Rand d201f80c3b Move the sound code into a gameSound.s file. This is the first step towards going around the sound toolset for playing sounds. 2020-12-16 12:00:56 -05:00
Jeremy Rand 34d16c9944 Implement the code to compare and update the high score. Add a todo for a high score list with initials. Remove the border colour performance debug. 2020-11-20 00:31:09 -05:00
Jeremy Rand fd40c12d31 Explode a bug when it crashes into the player. When the last segment collides with the player, go onto the next level. 2020-11-18 23:36:01 -05:00
Jeremy Rand 520aaa5a34 Add collision detection for all of the bug types. Remove the debug code for shooting bugs. It is almost a functional game now! 2020-11-17 22:53:30 -05:00
Jeremy Rand 64f96896f7 Add the ability to shoot. Detect shot collisions with mushrooms and shoot the mushrooms. Remove the ability to randomly shoot the mushrooms because that debug is no longer needed. Fix a bug where the number of infield mushrooms was not being updated for mushrooms which were shot until gone. 2020-11-16 23:48:36 -05:00
Jeremy Rand 4e6bad0ae7 Start adding the code for supporting shooting. 2020-11-16 00:14:08 -05:00
Jeremy Rand 2abb57b1a5 Add the code for detecting player collisions, exploding the player, decrementing the number of lives and maybe ending the game. 2020-11-11 23:51:09 -05:00
Jeremy Rand c24b8ad072 Change the spider score colour to be the same as mushroom colours so the player does not detect it as a collision. Add code to display the number of lives and add to the number of lives ever 12,000 points. This lays the groundwork for handling player death and collisions. 2020-11-09 00:12:51 -05:00
Jeremy Rand bb66ef4b03 Replace the C code which built tables at game launch time with a script which generates these tables at build time. This reduces the start time of the application and saves code space and is a necessary step before adding some new tables to handle the mouse efficiently. 2020-11-04 22:48:18 -05:00
Jeremy Rand c45c3503d6 This is the first step to getting rid of the tile.c file and replace it with generated assembly instead. And then I can add the extra data required to handle the player correctly. 2020-11-03 00:11:22 -05:00
Jeremy Rand 7c0dc8ebb1 Replace the call to the Toolbox with a raw read of the mouse from ADB registers to try to minimize the cost of mouse polling in the game loop. 2020-11-01 22:50:10 -05:00
Jeremy Rand 4e500c6f38 Start adding some mouse code and display a player on the bottom row of tiles only for now. No collision detection hooked up and it is terribly inefficient but it seems to work. 2020-10-28 23:46:32 -04:00
Jeremy Rand 62fcc82790 Add the code to shoot mushrooms and hook up a debug routine to shoot random mushrooms. 2020-10-26 23:26:12 -04:00
Jeremy Rand 0dd8222611 Add the code to handle restricting the spider to lower and lower rows as the score goes up. This is the final bit of game logic necessary for the bugs in the game I think. 2020-10-26 22:32:46 -04:00
Jeremy Rand 96a6b6f51f Implement the code to add the flea at the right time. This includes tracking the score in multiples of 20,000 and adjusting the number of mushrooms required in the infield before a flea will appear. Simplify the other score based thresholds which are based on multiples of 20,000 to use this test. Add debug which allows me to add 20,000 to the score whenever I want so I can test these thresholds more easily. 2020-10-25 23:11:11 -04:00
Jeremy Rand bb1cd9b7ba Remove the debug code to control the scorpion speed now that the logic is implemented for that. 2020-10-23 00:25:00 -04:00
Jeremy Rand 1d4f783a3e Change the code for centipede speed to skip slow speed segments entirely once the score is more than 40000.
Add segments at the start of the next level in reverse order so the single head segments are added first.  This ensures they do collision detection properly in the updateSegment code.
Fix a bug where a set of 16 tiles were always marked as occupied by a centipede segment because we didn't clear it properly on each updateSegment call.  This fixed a problem with segments changing direction for no apparent reason.
Test for collisions on the two tiles the segment is spanning and change direction if either is occupied.  This should eliminate single segments travelling on top of each other.
Add scorpions randomly during a game once we get to level 4.  They are added with a 1 in 512 chance every 60 seconds so you should see a scorpion about once every 10 seconds or so.
When the score is above 20000, add scorpions at fast speed 3/4 of the time, slow speed the other 1/4 of the time.  Lower scores, the scorpion is always slow.
2020-10-23 00:20:18 -04:00
Jeremy Rand 9a34532d77 Implement the code to add spiders to the game. From my testing, it looks like 2 seconds after a spider leaves the game (either shot or off the screen), another one is added. Also, once the score is about 5000, the spiders added will be fast. The only spider behaviour I know of which is so far not implemented is as the player reaches higher levels, the spider constrains itself closer and closer to the bottom of the screen. 2020-10-22 00:00:16 -04:00
Jeremy Rand 1f26b38784 Fix the order of colours for the different levels. Remove the debug code to add centipedes and change the colour palette. This is gone now because we now have the concept of starting a game and progressing through levels with different kinds of centipedes running at different speeds with different palette colours. 2020-10-20 23:13:46 -04:00
Jeremy Rand 6c3b8398a8 Add the code to start a game and iterate through levels. We don't detect the end of a level yet though. 2020-10-19 23:34:08 -04:00
Jeremy Rand eb418fb1c4 Add the ability to shoot centipede segments. 2020-10-02 14:50:14 -04:00
Jeremy Rand 1dfbe8156a Add support for having both fast and slow centipedes in play at the same time. 2020-09-21 22:57:06 -04:00
Jeremy Rand 03466f8847 Add code to allow a centipede and all its body segments to scroll in at the top of the screen at slow speed. Need to do the same for fast speed. 2020-09-13 15:18:18 -04:00
Jeremy Rand 0d4677c397 More work towards the animation of centipede segments. 2020-09-08 23:54:44 -04:00
Jeremy Rand 3b541f8482 Fix bug leading to crash when trying to add centipede body segments. I needed to have a nop instruction after the self-modifying long jump. I am writing 4 bytes of the address into the long jump which only uses a 3 byte address and I was corrupting the next instruction. Inserting a nop ensures no corruption happens. 2020-09-06 13:39:00 -04:00
Jeremy Rand 07f8df4b4f Draw the scorpion once we are sure the beam has past it on the screen for the previous frame. Adjust the wait for VBL look to look for less than scan line 200 rather than scan line 0. That way, we shouldn't get a frame glitch at 2.8MHz any more. 2020-09-06 01:54:47 -04:00
Jeremy Rand 92c02ded0f Simplify the handling of the dirty tiles to just store the dirty word and not keep the array of dirty tile offsets. Have the flea use game and non-game dirty tiles to fix the problem with LHS tiles being marked dirty all the time. 2020-09-04 01:55:38 -04:00
Jeremy Rand 22a22d3533 Change the code to race the beam down the screen, redrawing the dirty game rows as it goes. 2020-09-04 00:17:19 -04:00
Jeremy Rand b07221c363 Change from an array of structs to a series of individual arrays for the tile information. This makes it easier to index into the arrays because the tile number * 2 is the offset, rather than tile number * 16. 2020-09-02 00:15:53 -04:00
Jeremy Rand df56cdecf1 Add the ability to display head segments of the centipede. Body segments is not working yet. 2020-08-27 23:36:16 -04:00
Jeremy Rand 7d7afc908d Use macros to reduce the copy/pasted code for marking tiles as dirty. Rough out the support for body and head segments. 2020-07-30 23:34:48 -04:00
Jeremy Rand 8bcd4fccf6 Add the code to support switching between fast and slow spiders. 2020-07-27 23:30:11 -04:00
Jeremy Rand 883d882d0e Provide an API to set the default speed of a flea or a scorpion. This will allow the speed to be changed for different levels in the game. Need to add this API for spiders also. 2020-07-27 22:27:18 -04:00
Jeremy Rand 36be001229 Improve the randN function. Show a different colour on the border when drawing versus updating the game state. 2020-07-27 21:47:28 -04:00
Jeremy Rand 4f74d630b9 Start coding support for the spider. Also, try to show the performance of the main game loop in the border colour. 2020-07-23 23:41:12 -04:00
Jeremy Rand ada774960b Finish up work on the scorpion, adding support for shooting the scorpion. Some more cleanup of hard coded constants, moving them to globals. 2020-07-22 23:46:04 -04:00
Jeremy Rand 44cb944f22 More general cleanup and get rid of more magic numbers. 2020-07-21 22:30:05 -04:00