junglejourney
changeset 85:f31b957138df
Ensured that the player is awarded points for shooting enemies.
Improved the item placement on the map - some more work needed.
| author | David Boddie <david@boddie.org.uk> |
|---|---|
| date | Tue Aug 30 00:58:42 2011 +0200 |
| parents | b4e921f11ead |
| children | b8c0aa3a50a0 |
| files | build.py mapcode.oph tools/makesprites.py |
| diffstat | 3 files changed, 150 insertions(+), 28 deletions(-) [+] |
line diff
1.1 --- a/build.py Tue Aug 30 00:57:25 2011 +0200 1.2 +++ b/build.py Tue Aug 30 00:58:42 2011 +0200 1.3 @@ -61,7 +61,7 @@ 1.4 # emerging, explosion: bits 4,5,6 are enemy type for emerging, 1.5 # bit 3 is type 0=emerge,1=explode, 1.6 # bits 0,1 are animation 1.7 - # item: bits 0,1 are type, bit 2 is weapon/treasure 1.8 + # item: bits 0,1,2,3 are type, bit 2 is weapon/treasure 1.9 # 0-3 weapons, 4 key, 5-8 treasure) 1.10 # n+2 y room offset (0-10) 1.11 # n+3 dy (0-5) 1.12 @@ -125,9 +125,9 @@ 1.13 # ; 2 tree/wall 1.14 # ; 3 tree/wall 1.15 # ; 4 exit 1.16 - # ; 5 final exit 1.17 - # ; 6 weapon (bits 3,4 are type) 1.18 - # ; 7 treasure (bits 3,4 are type) 1.19 + # ; 5 final exit (left) 1.20 + # ; 6 final exit (right) 1.21 + # 1.22 # 5800 screen memory 1.23 1.24 files = []
2.1 --- a/mapcode.oph Tue Aug 30 00:57:25 2011 +0200 2.2 +++ b/mapcode.oph Tue Aug 30 00:58:42 2011 +0200 2.3 @@ -1398,7 +1398,7 @@ 2.4 ; Select the sprites to use. 2.5 2.6 lda $80 2.7 - and #7 ; only keep the bits required to find the correct sprite 2.8 + and #$0f ; only keep the bits required to find the correct sprite 2.9 clc 2.10 tax 2.11 lda item_chars_low,x 2.12 @@ -3223,6 +3223,16 @@ 2.13 cmp #8 2.14 bmi move_projectile_no_enemy_collision 2.15 2.16 + and #$70 ; increase the player's score 2.17 + lsr 2.18 + lsr 2.19 + lsr 2.20 + lsr 2.21 + tax 2.22 + lda enemy_scores,x 2.23 + sta $70 2.24 + jsr add_score 2.25 + 2.26 ; Unplot the enemy and replace it with an explosion. 2.27 2.28 jsr unplot_character 2.29 @@ -3278,6 +3288,8 @@ 2.30 clc 2.31 rts 2.32 2.33 +enemy_scores: .byte 2, 4, 6, 8, 10 2.34 + 2.35 move_characters: 2.36 2.37 lda #$0c ; set the character address 2.38 @@ -3379,15 +3391,28 @@ 2.39 iny 2.40 lda ($74),y ; get the item type 2.41 2.42 - tax ; temporarily store A in X and increase the score 2.43 + sta $8d ; temporarily store A and increase the score 2.44 + tax 2.45 lda item_scores,x 2.46 + sta $70 2.47 jsr add_score 2.48 - txa 2.49 + lda $8d 2.50 2.51 ; Check the item type. 2.52 + cmp #8 2.53 + bmi move_characters_not_health 2.54 + 2.55 + lda #12 2.56 + sta $70 2.57 + jsr add_strength 2.58 + clc 2.59 + rts 2.60 + 2.61 + move_characters_not_health: 2.62 cmp #5 2.63 bmi move_characters_not_treasure 2.64 2.65 + ; Do nothing here. We have already increased the player's score. 2.66 clc 2.67 rts 2.68 2.69 @@ -3436,10 +3461,13 @@ 2.70 clc 2.71 rts 2.72 2.73 -item_scores: .byte 10,10,10,10, 50,100,150,200,250 2.74 +item_scores: .byte $1,$4,$9,$16, $50,$20,$5,$10,$40 2.75 +score_vdu_bytes: .byte 1,1,31 ; reversed 2.76 +score_digits: .byte "0123456789" 2.77 2.78 add_score: ; $70=score to add 2.79 2.80 + sed 2.81 lda $33f6 2.82 adc $70 2.83 sta $33f6 2.84 @@ -3449,6 +3477,43 @@ 2.85 lda $33f8 2.86 adc #0 2.87 sta $33f8 2.88 + cld 2.89 + 2.90 +write_score: 2.91 + 2.92 + ldx #2 2.93 + write_score_vdu_bytes: 2.94 + lda score_vdu_bytes,x 2.95 + jsr $ffee 2.96 + dex 2.97 + bpl write_score_vdu_bytes 2.98 + 2.99 + lda #$f6 2.100 + sta $70 2.101 + lda #$33 2.102 + sta $71 2.103 + 2.104 + ldy #2 2.105 + write_score_loop: 2.106 + 2.107 + lda ($70),y 2.108 + lsr 2.109 + lsr 2.110 + lsr 2.111 + lsr 2.112 + tax 2.113 + lda score_digits,x 2.114 + jsr $ffee 2.115 + 2.116 + lda ($70),y 2.117 + and #$0f 2.118 + tax 2.119 + lda score_digits,x 2.120 + jsr $ffee 2.121 + 2.122 + dey 2.123 + bpl write_score_loop 2.124 + 2.125 clc 2.126 rts 2.127 2.128 @@ -3462,6 +3527,7 @@ 2.129 lda $33f4 2.130 and #$fc 2.131 asl 2.132 + clc 2.133 tay 2.134 2.135 lda $33f4 2.136 @@ -3964,8 +4030,8 @@ 2.137 2.138 rts 2.139 2.140 -status_vdu_bytes: .byte 31,1,0, 17,3, "Score", 31,11,0, 17,2, "Strength" 2.141 -; TAB(1,0), COLOUR 3, TAB(12,0), COLOUR 2 2.142 +status_vdu_bytes: .byte 31,2,0, 17,3, "Score", 31,11,0, 17,2, "Strength", 17,1 2.143 +; TAB(1,0), COLOUR 3, "Score", TAB(12,0), COLOUR 2, "Strength", COLOUR 1 2.144 2.145 start_new_game: 2.146 2.147 @@ -3983,14 +4049,25 @@ 2.148 lda status_vdu_bytes,x 2.149 jsr $ffee 2.150 inx 2.151 - cpx #23 2.152 + cpx #25 2.153 bmi write_status_text_loop 2.154 2.155 - ; Set level. 2.156 - 2.157 + ; Set the level. 2.158 lda #0 2.159 sta $33fa 2.160 2.161 + ; Set the score. 2.162 + lda #0 2.163 + sta $33f6 2.164 + sta $33f7 2.165 + sta $33f8 2.166 + jsr write_score 2.167 + 2.168 + ; Set the player's strength. 2.169 + lda #64 2.170 + sta $70 2.171 + jsr add_strength 2.172 + 2.173 ; Set the projectile type. 2.174 lda #0 2.175 sta $33f9 2.176 @@ -4003,8 +4080,8 @@ 2.177 lda #0 2.178 sta $33f0 2.179 2.180 - ; Set the player's strength. 2.181 - lda #64 2.182 + ; Add to the player's strength. 2.183 + lda #20 2.184 sta $70 2.185 jsr add_strength 2.186 2.187 @@ -4038,31 +4115,76 @@ 2.188 sta $80 2.189 2.190 lda $33fa ; level 2.191 + adc #11 2.192 and #31 2.193 sta $7c 2.194 + clc 2.195 lda #10 2.196 sta $7d 2.197 2.198 + lda $33fa ; create an upper limit on the weapon type found in this level 2.199 + adc #2 2.200 + sta $8d 2.201 + clc 2.202 + 2.203 ldx #121 2.204 start_level_add_treasure_loop: 2.205 2.206 - cpx $80 ; check for the key room 2.207 + cpx $80 ; check for the key room 2.208 bne start_level_add_treasure_item 2.209 2.210 - lda #5 ; the value is type + 1 2.211 - sta $5100,x 2.212 - jmp start_level_add_treasure_next 2.213 + lda #5 ; the value to store is type + 1 2.214 + jmp start_level_add_treasure_store 2.215 2.216 start_level_add_treasure_item: 2.217 + clc 2.218 jsr unlimited_values 2.219 - and #7 ; restrict the value returned 2.220 - adc #1 2.221 - cmp #5 ; do not allow keys to be added as normal items 2.222 - beq start_level_add_treasure_next 2.223 - 2.224 + and #$0f 2.225 + cmp #15 2.226 + bcs start_level_add_treasure_none 2.227 + 2.228 + cmp #9 ; only allow values 0-8 2.229 + bcc start_level_add_treasure_ok 2.230 + 2.231 + sec 2.232 + sbc #4 2.233 + clc 2.234 + 2.235 + cmp #9 2.236 + bcc start_level_add_treasure_ok 2.237 + 2.238 + sec 2.239 + sbc #4 2.240 + clc 2.241 + 2.242 + start_level_add_treasure_ok: 2.243 + cmp #5 ; check for values 5-8 2.244 + bcs start_level_add_treasure 2.245 + 2.246 + cmp #4 ; do not allow keys to be added as normal items 2.247 + beq start_level_add_treasure_none 2.248 + 2.249 + cmp $8d ; only add weapons with types that equal the 2.250 + bcs start_level_add_treasure_none ; level number or exceed it by one 2.251 + 2.252 + clc 2.253 + adc #1 ; store values 0-8 as values 1-9 2.254 + jmp start_level_add_treasure_store 2.255 + 2.256 + start_level_add_treasure: 2.257 + clc 2.258 + 2.259 + adc #1 ; store values 0-8 as values 1-9 2.260 + jmp start_level_add_treasure_store 2.261 + 2.262 + start_level_add_treasure_none: 2.263 + clc 2.264 + lda #0 ; do not put treasure in this room 2.265 + 2.266 + start_level_add_treasure_store: 2.267 + clc 2.268 sta $5100,x ; add the item to the table 2.269 2.270 - start_level_add_treasure_next: 2.271 dex 2.272 bpl start_level_add_treasure_loop 2.273
3.1 --- a/tools/makesprites.py Tue Aug 30 00:57:25 2011 +0200 3.2 +++ b/tools/makesprites.py Tue Aug 30 00:58:42 2011 +0200 3.3 @@ -144,9 +144,9 @@ 3.4 # placeholder treasure 3.5 read_xpm("images/key.xpm", [(".", "0"), ("+", "1"), ("@", "3")]), 3.6 read_xpm("images/chest.xpm", [(".", "0"), ("+", "1"), ("@", "3")]), 3.7 - read_xpm("images/chest.xpm", [(".", "0"), ("+", "1"), ("@", "3")]), 3.8 - read_xpm("images/chest.xpm", [(".", "0"), ("+", "1"), ("@", "3")]), 3.9 - read_xpm("images/chest.xpm", [(".", "0"), ("+", "1"), ("@", "3")]), 3.10 + read_xpm("images/statue.xpm", [(".", "0"), ("+", "2"), ("@", "3")]), 3.11 + read_xpm("images/jewel.xpm", [(".", "0"), ("@", "1"), ("+", "2"), ("#", "3")]), 3.12 + read_xpm("images/health.xpm", [(".", "0"), ("@", "1"), ("+", "2"), ("#", "3")]), 3.13 3.14 # exit 3.15 read_xpm("images/exit1.xpm", [("+", "0"), ("#", "1"), (".", "2"), ("@", "3")]),
