Hide The Player Sprite (4.5)

Bucket Mouse

Active member
EDIT: DANGIT, I POSTED THIS TOO SOON....further bug-testing revealed that if you warp to a second screen, another you will appear at the warp spot. The script draws you twice if you didn't just come from a cutscene screen, but if you eliminate the CreateObject part, you don't reappear at all -- you're gone forever. DALE HELP


This is doHideHudAndSpritesOnSpecialScreens.asm. It's located in Game/Subroutines.

I've added a third Screen Flag here; it removes the player sprite on a specific screen when checked. To use it, just simply replace the regular ASM with this one, then open Project Settings and change the name of Screen Flag 2 to Hide Player.

If you have to ask what the use of this is, then you haven't tried to make a cutscene yet. I am working on adapting the "Simple autotext/cutscenes" script for 4.5. You'll see it soon if I can get it to work.

Code:
;;;;;;;
;;;;;;;
;; UNDER WHAT CONDITION SHOULD WE HIDE SPRITES?
	LDA ScreenFlags00
	AND #%10000000
	BEQ doNotTurnOffSprites

		HideSprites
		JMP doneWithExtraScreenCheckForSprites
	doNotTurnOffSprites:
		ShowSprites
	doneWithExtraScreenCheckForSprites:

	LDA ScreenFlags00
	AND #%01000000
	BEQ doNotTurnOffHud
		HideHud
		JMP doneWithExtraScreenCheckForHud
	doNotTurnOffHud:
		ShowHud
	doneWithExtraScreenCheckForHud:
	
	LDA ScreenFlags00
	AND #%00100000
	BEQ doNotTurnOffPlayerSprite
		LDX player1_object
		DestroyObject
		JMP doneWithPlayerSprite
	doNotTurnOffPlayerSprite:
		LDX player1_object
		CreateObject newX, newY, #$00, #$00
	doneWithPlayerSprite:


	doneWithExtraCheck::
 

dale_coop

Moderator
Staff member
humm...
Instead of destroying/creating the player object, you could try to just set his Status flag to not be drawn (and not observe collisions)...
The code would be:

Code:
;;;;;;;
;;;;;;;
;; UNDER WHAT CONDITION SHOULD WE HIDE SPRITES?
	LDA ScreenFlags00
	AND #%10000000
	BEQ doNotTurnOffSprites

		HideSprites
		JMP doneWithExtraScreenCheckForSprites
	doNotTurnOffSprites:
		ShowSprites
	doneWithExtraScreenCheckForSprites:

	LDA ScreenFlags00
	AND #%01000000
	BEQ doNotTurnOffHud
		HideHud
		JMP doneWithExtraScreenCheckForHud
	doNotTurnOffHud:
		ShowHud
	doneWithExtraScreenCheckForHud:
	
	STX tempA
	LDX player1_object
	LDA ScreenFlags00
	AND #%00100000
	BEQ doNotTurnOffPlayerSprite
		LDA Object_status,x
		AND #%11000001
		STA Object_status,x
		JMP doneWithPlayerSprite
	doNotTurnOffPlayerSprite:
		LDA Object_status,x
		ORA #%00111110
		STA Object_status,x
		JMP doneWithPlayerSprite
	doneWithPlayerSprite:
	LDX tempA


	doneWithExtraCheck:
 
Hey dale listen I put the code in doHideSpriteswith special screen but when I tried to load it I got a bunch of label errors do you know how to address those?
 
Last edited:

baardbi

Well-known member
Do any of you guys know where the script doneWithExtraScreenCheckForSprites is called from? I'm trying to make this change to the script in BASE_4_5\Game\Subroutines but nothing happens. It looks like the script isn't being called. Checking the "Hide Sprites works", but when I put a JMP RESET at the top of the script to test, it still runs fine without restting the game. So where is the Hide Sprites code being run from...? Strange.
 

baardbi

Well-known member
OK. Nevermind. I just found out that in the MetroVania module this code is located in extraScreenLoad_PlatformBase.asm.
 
Top Bottom