Commit Graph

37 Commits

Author SHA1 Message Date
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
8963a9d76c I believe I have fixed the invisible mushroom bug. I have inspected all of the code which sets a tileType to something that didn't mark the tile as dirty. I believe the problem occurred because the code in update which placed/changed mushrooms assumed that the draw code which then mark the tile as dirty because the bug which caused the change which dirty that tile. But that is an assumption. If the bug is shot, perhaps the draw routine will not mark the tile dirty. So, now the tile is always marked dirty right at the point where the mushroom is placed. I believe this will fix the problem but more play testing is required to confirm I don't see it anymore. 2020-12-26 15:26:19 -05:00
Jeremy Rand
b432cf654b Implement stereo sound. Sounds now come from the left or the right speaker depending on where the sound is coming from on the screen as much as possible. 2020-12-22 23:40:21 -05:00
Jeremy Rand
d962e98368 Add the flea sound. 2020-12-22 01:00:10 -05:00
Jeremy Rand
32aee75462 Add the segment, spider and extra life sounds. Add some more information about the mysterious crash. 2020-12-18 00:50:01 -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
0136579125 Disassociate sound resources from the generators they are connected with. Use multiple generators to play multiple shot sounds at the same time. It sounds weird but it kind of works. 2020-12-10 21:55:13 -05:00
Jeremy Rand
bae931aaa6 Add sounds for shooting, killing bugs, dying and resetting mushrooms after death. The shoot sound isn't great because it doesn't restart when rapid fire is happening but this is a start. 2020-12-10 00:45:48 -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
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
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
123c3a48ef Add some comments about the spider score threshold yet to be implemented where it is restricted to a smaller and smaller space close to the player. 2020-10-25 23:25:23 -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
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
a1b4013e1c Hook up the score. Shooting fleas, spiders, scorpions or segments will increase the score. We track the score in two ways. One is just as a 32-bit unsigned integer for doing numeric comparisons on the score (say to the high score list to be implemented in the future) and secondly as a series of numeric digits displayed in a tile. Both are updated. 2020-10-13 23:24:15 -04:00
Jeremy Rand
b85000b4ed Start adding the infrastructure for levels and score. 2020-10-13 00:09:37 -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
3a63b2ef1b Add code to support marking dirty tiles under head and body segments. 2020-08-27 22:36:04 -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
9fde825430 Add some constants for the spider score amounts. 2020-07-27 14:25:22 -04:00
Jeremy Rand
3ad311dca6 Add support for shooting the spider and displaying a score. 2020-07-27 14:22:34 -04:00
Jeremy Rand
49baa1b360 Get spider motion working in both directions. 2020-07-26 16:00:46 -04:00
Jeremy Rand
d4fbd9f14c Almost done animating the spider. 2020-07-26 02:13:06 -04:00
Jeremy Rand
bf01c47285 Getting close to having the spider fully implemented... 2020-07-26 00:05:32 -04:00
Jeremy Rand
18d0c3a80f Add some randomness when the spider changes direction. 2020-07-25 14:54:35 -04:00
Jeremy Rand
213686ea1d The spider can now go down and to the right. More directions to come. 2020-07-25 14:34:44 -04:00
Jeremy Rand
184461947b Getting closer on the spider 2020-07-25 00:01:42 -04:00
Jeremy Rand
f890200a0d More spider work. 2020-07-24 23:50:01 -04:00
Jeremy Rand
45bc6641e6 Some more work on spider animation. 2020-07-24 23:27:33 -04:00
Jeremy Rand
aa2e5408da Some code for adding a spider on the LHS. 2020-07-24 14:42:03 -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