From 1ccdb1d0b67ef8b04e436f1f4250729ec969e525 Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Mon, 20 Jul 2020 23:04:27 -0400 Subject: [PATCH] Start to get scorpion support into the game. --- BuGS.xcodeproj/project.pbxproj | 2 + BuGS/game.s | 23 ++++++---- BuGS/gameScorpion.s | 77 ++++++++++++++++++++++++++++++++++ BuGS/sprites/scorpions.s | 12 ++---- 4 files changed, 97 insertions(+), 17 deletions(-) create mode 100644 BuGS/gameScorpion.s diff --git a/BuGS.xcodeproj/project.pbxproj b/BuGS.xcodeproj/project.pbxproj index 02257c3..30b6cd5 100644 --- a/BuGS.xcodeproj/project.pbxproj +++ b/BuGS.xcodeproj/project.pbxproj @@ -84,6 +84,7 @@ 9D8FFC602491CA28005C9327 /* game.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = game.s; sourceTree = ""; }; 9D8FFC612491CAF0005C9327 /* game.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = game.h; sourceTree = ""; }; 9DB1505024C3801100558B87 /* gameFlea.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gameFlea.s; sourceTree = ""; }; + 9DB1505124C6875C00558B87 /* gameScorpion.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gameScorpion.s; sourceTree = ""; }; 9DC4D7BD24B7652100BACF4B /* ship.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = ship.s; sourceTree = ""; }; 9DC4D7BE24B80C9600BACF4B /* shot.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = shot.s; sourceTree = ""; }; 9DC4D7BF24BE9F7100BACF4B /* tiles.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = tiles.h; sourceTree = ""; }; @@ -131,6 +132,7 @@ 9D8FFC602491CA28005C9327 /* game.s */, 9D8FFC612491CAF0005C9327 /* game.h */, 9DB1505024C3801100558B87 /* gameFlea.s */, + 9DB1505124C6875C00558B87 /* gameScorpion.s */, 9D62AF3B249871A300348F45 /* colour.s */, 9D2FF6DA24C4C79A000181E5 /* random.s */, 9D3396F324AECACC003222B3 /* sprites */, diff --git a/BuGS/game.s b/BuGS/game.s index ca73abb..2b9c5fe 100644 --- a/BuGS/game.s +++ b/BuGS/game.s @@ -29,9 +29,11 @@ game start gameLoop anop jsl drawDirtyGameTiles + jsl drawScorpion jsl drawFlea jsl drawDirtyNonGameTiles + jsl updateScorpion jsl updateFlea jsl checkKeyboard @@ -652,12 +654,12 @@ checkKey_loop2 anop cmp #'f' beq checkKey_addFlea cmp #'F' - beq checkKey_addFlea + beq checkKey_shootFlea cmp #'s' - beq checkKey_shootFlea + beq checkKey_addScorpion cmp #'S' - beq checkKey_shootFlea + beq checkKey_shootScorpion lda colourPalette inc a @@ -666,16 +668,19 @@ checkKey_loop2 anop lda #$0000 checkKey_skip anop sta colourPalette - jsl setColour - rtl + jmp setColour checkKey_addFlea anop - jsl addFlea - rtl + jmp addFlea checkKey_shootFlea anop - jsl shootFlea - rtl + jmp shootFlea + +checkKey_addScorpion anop + jmp addScorpion + +checkKey_shootScorpion anop + jmp shootScorpion checkKey_quit anop stz shouldQuit diff --git a/BuGS/gameScorpion.s b/BuGS/gameScorpion.s new file mode 100644 index 0000000..916a279 --- /dev/null +++ b/BuGS/gameScorpion.s @@ -0,0 +1,77 @@ +; +; gameScorpion.s +; BuGS +; +; Created by Jeremy Rand on 2020-07-20. +;Copyright © 2020 Jeremy Rand. All rights reserved. +; + + case on + mcopy gameScorpion.macros + keep gameScorpion + +gameScorpion start + + +scorpionState_none equ 0 +scorpionState_left equ 1 +scorpionState_right equ 2 +scorpionState_exploding equ 3 + + +drawScorpion entry + rtl + + +updateScorpion entry + rtl + + +addScorpion entry + lda scorpionState + beq addScorpion_done + +addScorpion_done anop + rtl + + +shootScorpion entry + rtl + + +scorpionState dc i2'scorpionState_none' +scorpionScreenOffset dc i2'0' +scorpionTileOffsets dc i2'0' + dc i2'0' + dc i2'0' + dc i2'0' + dc i2'0' + dc i2'0' +scorpionSpriteCounter dc i2'0' +scorpionSprite dc i2'0' + +scorpionLeftJumpTable dc i4'leftScorpion1s' + dc i4'leftScorpion1' + dc i4'leftScorpion1s' + dc i4'leftScorpion1' + dc i4'leftScorpion2s' + dc i4'leftScorpion2' + dc i4'leftScorpion2s' + dc i4'leftScorpion2' + dc i4'leftScorpion3s' + dc i4'leftScorpion3' + dc i4'leftScorpion3s' + dc i4'leftScorpion3' + dc i4'leftScorpion4s' + dc i4'leftScorpion4' + dc i4'leftScorpion4s' + dc i4'leftScorpion4' + +explosionJumpTable dc i4'explosion1' + dc i4'explosion2' + dc i4'explosion3' + dc i4'explosion4' + dc i4'explosion5' + dc i4'explosion6' + + end diff --git a/BuGS/sprites/scorpions.s b/BuGS/sprites/scorpions.s index 4f5258d..0f1f3c1 100644 --- a/BuGS/sprites/scorpions.s +++ b/BuGS/sprites/scorpions.s @@ -13,6 +13,7 @@ scorpions start leftScorpion1 entry + iny _spriteHeader ; $c - Green @@ -168,8 +169,6 @@ leftScorpion1 entry leftScorpion1s entry - dex - dex _spriteHeader ; $c - Green @@ -310,6 +309,7 @@ leftScorpion1s entry leftScorpion2 entry + iny _spriteHeader ; $c - Green @@ -470,8 +470,6 @@ leftScorpion2 entry leftScorpion2s entry - dex - dex _spriteHeader ; $c - Green @@ -627,6 +625,7 @@ leftScorpion2s entry leftScorpion3 entry + iny _spriteHeader ; $c - Green @@ -771,8 +770,6 @@ leftScorpion3 entry leftScorpion3s entry - dex - dex _spriteHeader ; $c - Green @@ -939,6 +936,7 @@ leftScorpion3s entry leftScorpion4 entry + iny _spriteHeader ; $c - Green @@ -1082,8 +1080,6 @@ leftScorpion4 entry leftScorpion4s entry - dex - dex _spriteHeader ; $c - Green