Changing Monster Health

n8bit

Member
I am in the process of finishing up "kids mode" for Doodle World, but I have run into an issue.

I have created copies of my "normal mode" bosses and reduced their health to make them easier. I was barely able to squeeze them all in and managed to fill my Bank $1C in the process. When I go and try and add the code to make them do my boss death and boss drops I overflow my Bank $14.

I was trying to come up with a solution that would work, and the only one I can think of would be to use the "normal mode" bosses and just reduce their health when "kids mode" is selected.

Has anyone done something like this?
 

NeoBenj

Member
Here is one possible solution.
You can make your inflicted damages higher in easy mode. So killing enemy faster.

1- Create a variable for "yourdamage".
2- When selecting Easy Mode, make this value equal to what seems good to kill monsters easier. (In easy you are doing an good amount of damage, just do maths based on your basic monster HP)
3- When selecting Normal mode, make this value equal to what seems challenging based on your enemy HP (In normal you are doing average damage).
Optional -> In case you enemies HP were set at 1 by default. Make it equal to 10. (Always to take the habit to start your game economy with default big values, 2 or 3 digits).

In the HandleMonsterHurt Script, replace the value to substract from the enemy health (set to #$01 by default) with the value "yourdamage".
My game script is overly modified, but in the vanilla script it should look like this:

Code:
LDA Object_health,x
SEC
SBC yourdamage; Decrease this enemy HP by "yourdamage"
CMP #$01
BMI + ; If the monster HP goes under 1, INCLUDING negative numbers, branch to +.
JMP notMonsterDeath
+

This should work.
 

dale_coop

Moderator
Staff member
You could also move some code from the BANK 14 to another bank (for example BANK 1A):

For example, an easy one to move, is the "handle pre draw"...
1/ Modify the "Bank14.asm" file (that is in the "Routines\Basic\BankData\Bank14.asm" folder), from line 18 you will see:
Code:
doPreDraw:
	.include SCR_SPRITE_PREDRAW
	RTS

Copy that code and comment out (or remove) those lines.
Save.

2/ Now, open the "Bank1A.asm" file (that is in the "Routines\Basic\BankData\Bank14.asm" folder)... it might be empty in your project, so just add:
Code:
doPreDraw:
	.include SCR_SPRITE_PREDRAW
	RTS
Save the file.

3/ Modify the HandleUpdateObject.asm script (in your "" folder), around line 36, you'll see:

Code:
	LDY #$14
	JSR bankswitchY

Replace by :

Code:
	LDY #$1A
	JSR bankswitchY
Save

Et voilĂ , you have freed some space in the bank 14.


If it's yoru bank 1C that is not enough... you will have to optimize your monsters (reduce the animations)...
 

n8bit

Member
dale_coop said:
You could also move some code from the BANK 14 to another bank (for example BANK 1A):

This was my initial thought and I tried moving some code from $14 to $18 before posting to the FB group and forum and got the same results as before. I double checked my code and compared to yours and I did exactly what you were describing, but no luck. $14 is still sitting at 0k free and $18 is at 16k free. I just assumed I was not doing it right.

Might try just using a variable like Benj described to change the player health...
 

n8bit

Member
Ok. Been messing with this a lot lately. Was moving stuff to bank $18 and that was working but since running out of space on $1C I decided to go the other route and use a variable to determine the boss health.

Since I am using Dale's "select on start screen" scripts I figured I would just use the "curSelection" variable to determine the amount of damage the player could do if in easy mode. Unfortunately it is not working and regardless of which mode I pick (normal or easy) the bosses always take 5 hits. Below is an excerpt from my "jump on kills" script that contains the variable and branches I am using.

Code:
;;---- Jump On Kills code begin ----
    TYA
    STA tempy
    LDX tempx
    LDA Object_vulnerability,x
    AND #%00010000
    BNE jumpOnMonster
    LDX player1_object
    JMP dontJumpOnMonster
jumpOnMonster:
    LDX player1_object
    ;TXA
    ;STA tempx
    ;JMP playerWasHurtDuringCollision
    ;LDX player1_object
    LDA selfBottom
    CMP otherCenterY
    ;;adjustments to handle monster death animations
        BCC +
    JMP dontJumpOnMonster
    +
    ;;end adjustments
    ;;; JUMP ON MONSTER
    
    LDA curSelection
    CMP #$01
    BEQ easyMode 
    BNE notEasyMode
    
    easyMode:
    LDX player1_object
    LDA #$00
    SEC
    SBC #$04 ;;player jump recoil
    STA Object_v_speed_hi,x
    LDX tempx
        LDA Object_health,x
        SEC
        SBC #$10
        CMP #$01
        BCC deactivateCurObj
        JMP notMunsterDeath
        
    notEasyMode:
    LDX player1_object
    LDA #$00
    SEC
    SBC #$04 ;;player jump recoil
    STA Object_v_speed_hi,x
    LDX tempx
        LDA Object_health,x
        SEC
        SBC #$01
        CMP #$01
        BCC deactivateCurObj
        JMP notMunsterDeath
    
    deactivateCurObj:
    
    ;;;;DeactivateCurrentObject
    LDA Object_x_hi,x
    STA temp
    LDA Object_y_hi,x
    STA temp1
    LDA Object_type,x   ;; used for Monster Drops
    STA temp2

Thoughts?
 

NeoBenj

Member
In your code I assume
curSelection=0 => Normal Mode
curSelection=1 => EasyMode
right?

Try replacing:
Code:
LDA curSelection
CMP #$01
BEQ easyMode 
BNE notEasyMode

With this:
Code:
LDA curSelection ;Load curSelection in Accumulator
BNE + ; If not equal to 0, branch to +
JMP notEasyMode; Else, Jump to notEasymode
+

And
Code:
LDA Object_health,x
SEC
SBC #$10
CMP #$01
BCC deactivateCurObj

With this:
Code:
LDA Object_health,x
SEC
SBC #$10
CMP #$01
BMI deactivateCurObj; If inferior to 1, INCLUDING negative value, branch to deactivateCurObj
With BCC, if the result of your substraction is a negative value, it won't work.
 

n8bit

Member
NeoBenj said:
In your code I assume
curSelection=0 => Normal Mode
curSelection=1 => EasyMode
right?

Yup. Tried your suggestions. Still no luck...

Code:
    ;;; JUMP ON MONSTER
    
	LDA curSelection ;Load curSelection in Accumulator
	BNE + ; If A is not equal to 0, branch to +
	JMP notEasyMode; Else, Jump to notEasymode
	+

    LDX player1_object
    LDA #$00
    SEC
    SBC #$04 ;;player jump recoil
    STA Object_v_speed_hi,x
    LDX tempx
        LDA Object_health,x
        SEC
        SBC #$10
        CMP #$01
        BMI deactivateCurObj
        JMP notMunsterDeath
        
    notEasyMode:
    LDX player1_object
    LDA #$00
    SEC
    SBC #$04 ;;player jump recoil
    STA Object_v_speed_hi,x
    LDX tempx
        LDA Object_health,x
        SEC
        SBC #$01
        CMP #$01
        BCC deactivateCurObj
        JMP notMunsterDeath
    
    deactivateCurObj:
    
    ;;;;DeactivateCurrentObject

This is really baffling to me because everything I know says it should work, but I have a habit of missing small things...
 

NeoBenj

Member
;;; JUMP ON MONSTER

Back to the Variable solution and dividing by 2 to the size of the code, please try to:

1-Create the variable DamageInflicted
2-Set it with a value of 1 (your NormalMode value).

Replace the code with this:
Code:
;;JUMP ON MONSTER

LDA curSelection ;Load curSelection in Accumulator
BEQ + ;if curselection equal 0, branch to +
LDA #$0A ; If not set 10 (in hex) to the Accumulator.
STA DamageInflicted ; Store 10 into DamageInflicted
+
LDX player1_object
LDA #$00
SEC
SBC #$04 ;;player jump recoil
STA Object_v_speed_hi,x
LDX tempx
LDA Object_health,x
SEC
SBC DamageInflicted
CMP #$01
BMI deactivateCurObj
JMP notMunsterDeath
        
deactivateCurObj:
    
;;;;DeactivateCurrentObject[code]
 

NeoBenj

Member
Also if you have a free value in your Hud, you can expose the DamageInflicted as a hud value. Doing so, you will be able to monitor the damage you inflict in real time. ;)
 

n8bit

Member
NeoBenj said:
Back to the Variable solution and dividing by 2 to the size of the code, please try to:

1-Create the variable DamageInflicted
2-Set it with a value of 1 (your NormalMode value).

Tried this as well and I had the same issue I previously had when I tried to subtract using a variable. The player does no damage to monsters/bosses in either mode, when jumping on the monsters the player dies. It is as if it is unable to subtract with a variable and needs an actual value there. This is why I was trying a branched approach.
 

n8bit

Member
After more testing, it looks like using a variable for subtraction just does not work for this. Back to the drawing board again...
 
Top Bottom