Solved -- Kill boss to open new area (Dale is the Man!)

DarthAT

Member
4.5.9 MetroidVania
Hello everyone,

I appreciate the help you all have been giving me. I am now hoping you can point me in the right direction for the next part of my game. I have a screen that I warp into that is locked from moving Left or Right (I have checked the screen flags for both Left and Right screen to scroll). What I am hoping to accomplish now, is to defeat the boss in this area and thus triggering the night or day (whichever) that has screen flag for right screen to scroll unchecked, so the player can continue on moving to the right after the forced boss battle.

Does this make sense?

I look forward to your help and ideas to achieve this!
 

SciNEStist

Well-known member
I've not tried this myself to be honest, but I think the idea is to write to the screen flag to unlock scrolling. for example, when your boss dies, you would put this somewhere in the code:

Code:
LDA #%00000000
STA ScreenFlags00

that would turn off ALL screen flags, thus removing your scrolling limitation.

If that doesnt work, maybe someone who has worked more with scrolling can help us.
 

dale_coop

Moderator
Staff member
To remove the scrolling on one side :
Code:
 LDA ScreenFlags00
 AND #%11101111
 STA ScreenFlags00
 

DarthAT

Member
I searched my asm files for screen flags, but came up short. Not sure exactly where to add this code to?
 

dale_coop

Moderator
Staff member
You'll need to place it where your boss is killed.
It could be in the handle object collision or in the monster hurt script (depending how you are handling the boss monster death)
 

DarthAT

Member
Haha, I have no idea how it is being handled. I will go home today and see if I can figure it out... if not you will be hearing from me tomorrow for more help. LOL
 

DarthAT

Member
Okay, so that code is already added to the Common > Handle Monster Hurt - Routines\Base_4_5\Game\MOD_PlatformerBase\Common\hurtMonster_PlatformBase.asm in my script settings.
 

Attachments

  • hurt monster.PNG
    hurt monster.PNG
    83.3 KB · Views: 6

DarthAT

Member
So can someone explain to me what is happening in the script here>
From what I can see:
#%10000000 handles hiding/unhiding the hud (to me it would be #$00
#%01000000 handles hiding/unhiding of sprite (this would be #$01)
%111011111 based on what you the hurtMonster code says, should handle left right edge scrolling (I have no idea what this would be)

How is this determined and why is not working?
 

Attachments

  • hide hud.PNG
    hide hud.PNG
    72 KB · Views: 4

dale_coop

Moderator
Staff member
Your handle monster script, kill the monster... then checks how many monsters there is on screen, if no more monster, it will unlock the right scrolling.

We need to determine where is the code that kills your boss monster...
How do you kill your monster?

If you use the a weapon object (or projectile) and if that script is not executed when you kill your monster, maybe it's because the "destroy" or your boss monster is done in the Handle Object Collision.
If you jump on him to kill him... then you will need to modify the handle player hurt (because the "jump on kill" is implemented in that script).
 

DarthAT

Member
Okay,

I kill my monster using a projectile (game object #$03).

So the original code you suggested was already coded in Hurt Monster, so I need to move (copy) that code to the Handle Object Collision?

You say:
"If you use the a weapon object (or projectile) and if that script is not executed when you kill your monster, maybe it's because the "destroy" or your boss monster is done in the Handle Object Collision."
What am I looking for in the code? Am I looking for a Variable called Destroy? Then placing that code after it?
 

dale_coop

Moderator
Staff member
can you share your handle collision script ?
Just to see if the monster death is handled here… or in the handle hurt monster script.
 

DarthAT

Member
So I found this snippet of code in the doHandleObjectCollisions_PlatformerBase.asm, that said JSR doHandleHurtMonster. I actually did not have a doHandleHurtMonster.asm, what I had was hurtMonster_PlatformBase.asm. So I thought that might be the problem, so I found a doHurtMonster.asm and edited that and replaced the other, but it still did not work. :(
 

Attachments

  • JSR.PNG
    JSR.PNG
    36.6 KB · Views: 5

DarthAT

Member
Here are my two scripts:
doHandleHurtMonster
doHandleObjectCollisions_PlatformerBase
 

Attachments

  • asm.scripts.zip
    2.2 KB · Views: 4

DarthAT

Member
Been banging my head against the wall the last few days trying to figure this... Breaking down code to the best of my ability, but it just wont work. At times, after I defeat the monster, my sprite CAN move to the next screen, but the camera does not follow, he just disappears onto the other screen as the old screen stays.
 

dale_coop

Moderator
Staff member
I checked the code... everything seems correct... I deep dive into the engine... and I noticed that the scrolling engine always re-read the flags of the current screen when scrolling. It's the reason it won't work with the MetroidVania module >_<

I think you will have to find another way of unlock your boss room...


Else, if that feature is very important for your game (and you are fine with doing experiments)...
You could change your current "handle camera" script for the one from the scrolling platformer module ("MOD_PlatformerBase\Subroutines\doUpdateCaemra_L2R_PlatformBase.asm", that one will have the unlock scroll working).

Change it like that:

2022-08-12 11_36_21-Project Settings.png
 
Last edited:

DarthAT

Member
DALE!!!! You have a beautiful mind!!!! Replacing that script did the trick!

As always, I hope to become a Jedi Knight like you Dale and learn the ways of ASM... When you say you did a deep dive and checked the scrolling engine, can you tell me exactly what asm file you where looking at, so that I can try and see what you saw?
 

dale_coop

Moderator
Staff member
The scrolling is handled by the Handle Camera script... So, I did read it, to see what it exactly does with the screen flags.
I notice it reads/reloads the screen flags of the current screen almost every time it scrolls.
And when I did check the Handle Camera scripts of the other modules, I notice they reads/reloads the next screen during the scroll... so the current flags are never reload/replaced but the screen original values.

Not really sure why Joe wrote two different way of dealing with that :unsure:
 
Top Bottom