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.

This commit is contained in:
Jeremy Rand 2020-10-28 23:46:32 -04:00
parent 0fa9b45f45
commit 4e500c6f38
4 changed files with 78 additions and 0 deletions

View File

@ -79,6 +79,7 @@
9D33970024AEFBF2003222B3 /* segments.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = segments.s; sourceTree = "<group>"; }; 9D33970024AEFBF2003222B3 /* segments.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = segments.s; sourceTree = "<group>"; };
9D33970124AF9D55003222B3 /* sprites.macros */ = {isa = PBXFileReference; lastKnownFileType = text; path = sprites.macros; sourceTree = "<group>"; }; 9D33970124AF9D55003222B3 /* sprites.macros */ = {isa = PBXFileReference; lastKnownFileType = text; path = sprites.macros; sourceTree = "<group>"; };
9D47CBE02547BEDB00CDA5CB /* gameMushroom.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gameMushroom.s; sourceTree = "<group>"; }; 9D47CBE02547BEDB00CDA5CB /* gameMushroom.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gameMushroom.s; sourceTree = "<group>"; };
9D47CC14254A698900CDA5CB /* gamePlayer.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gamePlayer.s; sourceTree = "<group>"; };
9D62AF3B249871A300348F45 /* colour.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = colour.s; sourceTree = "<group>"; }; 9D62AF3B249871A300348F45 /* colour.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = colour.s; sourceTree = "<group>"; };
9D62AF3F2499CD1E00348F45 /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; }; 9D62AF3F2499CD1E00348F45 /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
9D62AF402499CD3A00348F45 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; }; 9D62AF402499CD3A00348F45 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
@ -143,6 +144,7 @@
9DB1505324C9E54C00558B87 /* gameSpider.s */, 9DB1505324C9E54C00558B87 /* gameSpider.s */,
9DB1505424D3BF6C00558B87 /* gameSegments.s */, 9DB1505424D3BF6C00558B87 /* gameSegments.s */,
9D47CBE02547BEDB00CDA5CB /* gameMushroom.s */, 9D47CBE02547BEDB00CDA5CB /* gameMushroom.s */,
9D47CC14254A698900CDA5CB /* gamePlayer.s */,
9D8AF0B72535542400C10E3C /* level.s */, 9D8AF0B72535542400C10E3C /* level.s */,
9D8AF0B82535543000C10E3C /* score.s */, 9D8AF0B82535543000C10E3C /* score.s */,
9D62AF3B249871A300348F45 /* colour.s */, 9D62AF3B249871A300348F45 /* colour.s */,

View File

@ -104,6 +104,7 @@ gameLoop anop
sta >BORDER_COLOUR_REGISTER sta >BORDER_COLOUR_REGISTER
long i,m long i,m
jsl updatePlayer
jsl updateScorpion jsl updateScorpion
jsl updateSpider jsl updateSpider
jsl updateFlea jsl updateFlea

70
BuGS/gamePlayer.s Normal file
View File

@ -0,0 +1,70 @@
;
; gamePlayer.s
; BuGS
;
; Created by Jeremy Rand on 2020-10-28.
;Copyright © 2020 Jeremy Rand. All rights reserved.
;
case on
mcopy gamePlayer.macros
keep gamePlayer
gamePlayer start
using globalData
updatePlayer entry
lda gameRunning
beq updatePlayer_gameRunning
rtl
updatePlayer_gameRunning anop
pha
pha
pha
~ReadMouse
pla
pla
pla
lsr a
bcs updatePlayer_shift
adc #$9834
tay
jsl drawShip
bra updatePlayer_dirty
updatePlayer_shift anop
adc #$9834
tay
jsl drawShipShift
bra updatePlayer_dirty
updatePlayer_dirty anop
lda #TILE_STATE_DIRTY
sta tileDirty+1200
sta tileDirty+1202
sta tileDirty+1204
sta tileDirty+1206
sta tileDirty+1208
sta tileDirty+1210
sta tileDirty+1212
sta tileDirty+1214
sta tileDirty+1216
sta tileDirty+1218
sta tileDirty+1220
sta tileDirty+1222
sta tileDirty+1224
sta tileDirty+1226
sta tileDirty+1228
sta tileDirty+1230
sta tileDirty+1232
sta tileDirty+1234
sta tileDirty+1236
sta tileDirty+1238
sta tileDirty+1240
sta tileDirty+1242
sta tileDirty+1244
sta tileDirty+1246
sta tileDirty+1248
rtl
end

View File

@ -60,6 +60,11 @@ int main(void)
srand(randomSeed); srand(randomSeed);
randInit(); randInit();
InitMouse(0);
SetMouse(transparent);
ClampMouse(0, (GAME_NUM_TILES_WIDE - 1) * 8, 0, 8 * 5);
PosMouse(GAME_NUM_TILES_WIDE * 4, 8 * 5);
initTiles(); initTiles();
initNonGameTiles(); initNonGameTiles();
addStartingMushrooms(); addStartingMushrooms();