From 1323aa8f720768452d09d1868067ab2d97dcb45f Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sun, 21 Nov 2021 23:35:56 -0500 Subject: [PATCH] peasant: kerrek: can get you if you walk too close --- games/peasant/NOTES | 1 + games/peasant/kerrek_actions.s | 85 +++++++++++++++++++++++++++++++++- games/peasant/peasant1.s | 2 + games/peasant/peasant4.s | 2 + games/peasant/text/kerrek.inc | 5 +- 5 files changed, 92 insertions(+), 3 deletions(-) diff --git a/games/peasant/NOTES b/games/peasant/NOTES index 9a1cb125..a5712180 100644 --- a/games/peasant/NOTES +++ b/games/peasant/NOTES @@ -201,3 +201,4 @@ deaths/endings implemented +4 kick/punch/kill old gary +5 get arrow (while dongolev shooting) +6 walk on range (while dongolev shooting) ++7 walk too close to Kerrek diff --git a/games/peasant/kerrek_actions.s b/games/peasant/kerrek_actions.s index d6c33766..cdffe7a0 100644 --- a/games/peasant/kerrek_actions.s +++ b/games/peasant/kerrek_actions.s @@ -6,6 +6,12 @@ ; if dead on this screen ; if dead not on this screen + ;======================= + ;======================= + ; kerrek setup + ;======================= + ;======================= + ; call at beginning of level to setup kerrek state kerrek_setup: ; first see if Kerrek alive @@ -19,9 +25,9 @@ kerrek_setup_alive: beq kerrek_alive_not_there kerrek_alive_out: - lda #20 + lda #22 sta KERREK_X - lda #100 + lda #76 sta KERREK_Y lda #0 sta KERREK_DIRECTION @@ -73,6 +79,81 @@ kerrek_row4: rts + + ;======================= + ;======================= + ; kerrek collision + ;======================= + ;======================= + ; see if the kerrek got us + +kerrek_collision: + + ; first, only if kerrek out + + lda #KERREK_STATE + bpl kerrek_no_collision + + + ; first check X + + ; if (peasant_x >= kerrek_x-1) && (peasant_x<=kerrek_x+2) + ; this is roughly equivelant to |kerrek_x-peasant_x| < 2 + + lda KERREK_X + sec + sbc PEASANT_X + bpl kerrek_x_distance_good +kerrek_x_distance_negate: + eor #$FF + clc + adc #1 +kerrek_x_distance_good: + cmp #2 + bcs kerrek_no_collision + + ; next check Y + + ; this is roughly equivelant to |kerrek_y+20-peasant_y| < 5 + + lda KERREK_Y + clc + adc #20 + sec + sbc PEASANT_Y + bpl kerrek_y_distance_good +kerrek_y_distance_negate: + eor #$FF + clc + adc #1 +kerrek_y_distance_good: + cmp #5 + bcs kerrek_no_collision + + +kerrek_got_ya: + ; game over, man! + + ; animate pounding you into ground + + ldx #kerrek_pound_message + jsr partial_message_step + + lda #LOAD_GAME_OVER + sta WHICH_LOAD + + lda #NEW_FROM_DISK + sta LEVEL_OVER + +kerrek_no_collision: + + rts + + + + + ;======================= ;======================= ;======================= diff --git a/games/peasant/peasant1.s b/games/peasant/peasant1.s index f356d43d..4bf71a37 100644 --- a/games/peasant/peasant1.s +++ b/games/peasant/peasant1.s @@ -158,6 +158,8 @@ game_loop: jsr check_keyboard + jsr kerrek_collision + lda LEVEL_OVER bmi oops_new_location bne game_over diff --git a/games/peasant/peasant4.s b/games/peasant/peasant4.s index e7705ef9..eedd5666 100644 --- a/games/peasant/peasant4.s +++ b/games/peasant/peasant4.s @@ -196,6 +196,8 @@ game_loop: jsr check_keyboard + jsr kerrek_collision + lda LEVEL_OVER bmi oops_new_location bne game_over diff --git a/games/peasant/text/kerrek.inc b/games/peasant/text/kerrek.inc index 4b51bc27..9fce3c8e 100644 --- a/games/peasant/text/kerrek.inc +++ b/games/peasant/text/kerrek.inc @@ -2,7 +2,10 @@ ; Kerrek Tracks 1/2 (top or bottom footprints?) ;================================================ -; (Walk too close to the Kerrek) — {The Kerrek pounds your head into the ground} +; (Walk too close to the Kerrek) +; {The Kerrek pounds your head into the ground} +; then prints message +kerrek_pound_message: .byte "Your mom always told you",13 .byte "not to take head poundings",13 .byte "from strange Kerreks. And",13