The Score Var and other HUD stuff is sure Buggy

User avatar
drexegar
Posts: 44
Joined: Wed Mar 21, 2018 12:33 pm

The Score Var and other HUD stuff is sure Buggy

Post by drexegar » Thu Sep 06, 2018 12:42 am

If I change my jump kills to 100 points in the collision script, after I do 2 or them the last digit dispersals, and it looks like I have 20 points,

if I want to make my digits smaller like 3 digits only, that will mess up after a couple points and ill lose a digit and eventually random sprites will replace the last digit.

Sometimes I Iose points for jumping on a character.

If a enemy leaves the bounds and is destroyed by leaving that area where the enemy is at, and moving to the next room, I lose my last digit.

Is their a fix for this? Should I just full around with the asm and find a slightly better way to fool proof writing numbers down?

UPDATE: it seems that when I add my health graphic the score bugs went away, now i need to see what cause my health to be drawing into the background. I'm guessing I have to use or delete anything in the HUD not being used so I don't end up with empty bugs?
User avatar
dale_coop
Posts: 1302
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: The Score Var and other HUD stuff is sure Buggy

Post by dale_coop » Thu Sep 06, 2018 8:25 am

There is a "bug", an issue ... with the HUD Variables and the HUD Update code
Everytime your player is hurt, the HUD variable myHealth is modified (decreased), and the HUD myHealth code is executed.
Everytime a monster is killed, the HUD variable myScore is modified (increased), and the HUD myScore code is executed.
Everytime you take a PowerUp "health", the HUD variable myHealth is modified (increased), and the HUD myHealth code is executed.
Everytime you take a PowerUp "key", the HUD variable myKeys this modified (increased), and the HUD myKeys code is executed.
Everytime you take a PowerUp "coin", the HUD variable myMoney modified (increased), and the HUD myMoney code is executed.

AND if those variables are NOT on displayed your HUD... when the an HUD update code is executed, it breaks the HUD (freeze it). The HUD is updated again correctly, when your screen is loaded (when the player comes in another screen)

So a fix would be to comment all the HUD update codes related to HUD variables you don't use/display on the HUD.

For exemple in the increase "myMoney" HUD update code:

Code: Select all

		LDA #$01 ;; amount of score places?
		STA hudElementTilesToLoad
		LDA DrawHudBytes
		ORA #HUD_myMoney
		STA DrawHudBytess
I you don't have that info (MONEY) on your HUD, it will freeze the HUD.
So you have to search in all the scripts, and comment those lines.
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
User avatar
drexegar
Posts: 44
Joined: Wed Mar 21, 2018 12:33 pm

Re: The Score Var and other HUD stuff is sure Buggy

Post by drexegar » Thu Sep 06, 2018 10:48 am

dale_coop wrote:
Thu Sep 06, 2018 8:25 am
So a fix would be to comment all the HUD update codes related to HUD variables you don't use/display on the HUD.

For exemple in the increase "myMoney" HUD update code:

Code: Select all

		LDA #$01 ;; amount of score places?
		STA hudElementTilesToLoad
		LDA DrawHudBytes
		ORA #HUD_myMoney
		STA DrawHudBytess
I you don't have that info (MONEY) on your HUD, it will freeze the HUD.
So you have to search in all the scripts, and comment those lines.
Ahh nice idea! But where is the myMoney HUD code located? I look though all scripts in the project settings of the platform module, and I could only find score and health. Does the platform module even use the myMoney Code?

My Hud is working good now, but the health bar is off (you only updating the life after you get hit so reading is of by 1 and wont empty when you die and wont show full health until you get hit). That has to manually fix right?

Im going to have to force it on one of the collsions tile to force update the health, I already figure out how to make one disable and re enable control functions through a variable I added into the control scripts.
User avatar
Imagaryboy
Posts: 18
Joined: Mon Aug 20, 2018 9:05 am
Location: Cologne

Re: The Score Var and other HUD stuff is sure Buggy

Post by Imagaryboy » Thu Sep 06, 2018 11:52 am

drexegar wrote:
Thu Sep 06, 2018 10:48 am
dale_coop wrote:
Thu Sep 06, 2018 8:25 am
So a fix would be to comment all the HUD update codes related to HUD variables you don't use/display on the HUD.

For exemple in the increase "myMoney" HUD update code:

Code: Select all

		LDA #$01 ;; amount of score places?
		STA hudElementTilesToLoad
		LDA DrawHudBytes
		ORA #HUD_myMoney
		STA DrawHudBytess
I you don't have that info (MONEY) on your HUD, it will freeze the HUD.
So you have to search in all the scripts, and comment those lines.
Ahh nice idea! But where is the myMoney HUD code located? I look though all scripts in the project settings of the platform module, and I could only find score and health. Does the platform module even use the myMoney Code?

My Hud is working good now, but the health bar is off (you only updating the life after you get hit so reading is of by 1 and wont empty when you die and wont show full health until you get hit). That has to manually fix right?

Im going to have to force it on one of the collsions tile to force update the health, I already figure out how to make one disable and re enable control functions through a variable I added into the control scripts.
Were you able to resolve your problem? I have the same issue where the health is displayed by 1 off.
User avatar
drexegar
Posts: 44
Joined: Wed Mar 21, 2018 12:33 pm

Re: The Score Var and other HUD stuff is sure Buggy

Post by drexegar » Thu Sep 06, 2018 3:55 pm

Imagaryboy wrote:
Thu Sep 06, 2018 11:52 am
Were you able to resolve your problem? I have the same issue where the health is displayed by 1 off.
Im not fixing it right now, but my solution is to use the tile I made so in the check points when he dies and get back on the screen he will land on a block that will force update his health which should of been updated in the first place.
User avatar
Imagaryboy
Posts: 18
Joined: Mon Aug 20, 2018 9:05 am
Location: Cologne

Re: The Score Var and other HUD stuff is sure Buggy

Post by Imagaryboy » Thu Sep 13, 2018 9:18 am

Ahhh I'm going crazy with my health display, nothing works as it is supposed to:

-My player has 8 HP
-When the player dies, the last HP never disappears
-The player then starts with the last HP again
-If the player then gets hit again, the HP bar is full again and depletes normally with each hit
-again: the last HP never disappears
-health pickup works only when the player has less than 3 HP (I can't replenish beyond the 3 HP mark with health pickup)

It's such an important thing in my game and it's really frustrating that I can't get this to work properly. Am I the only one who has these problems?
Hope you can help me out :|
User avatar
dale_coop
Posts: 1302
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: The Score Var and other HUD stuff is sure Buggy

Post by dale_coop » Thu Sep 13, 2018 9:20 am

For your "HP", you are using myHealth variable?
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
User avatar
dale_coop
Posts: 1302
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: The Score Var and other HUD stuff is sure Buggy

Post by dale_coop » Thu Sep 13, 2018 9:27 am

For your player death and when he restart with the last HP problem, you need to modify the "HurtWinLoseDeath\Adventure_HandlePlayerDeath.asm" script, to refill your HP when he dies... like this (line 22):

Code: Select all

	TXA
	STA tempx
	TYA 
	STA tempy
	
	;;;;;;;;;;;;;;;;;;;
	LDX player1_object
	LDA Object_x_hi,x
	STA temp
	LDA Object_y_hi,x
	STA temp1
	CreateObject temp, temp1, #$08, #$00
	;; need to do this redundantly, otherwise, the death object will be in same slot as player
	LDX player1_object
	DeactivateCurrentObject
	;;;;;;;;;;;;;;;;;;;
	;;StopSound  ;;<<-- don't want the music stop after the player dies
	
	LDA #$FF
	STA player1_object
	
	;; HERE: when player dies, we give back his HEALTH :
	LDA #$08	
	STA myHealth
	
	LDX tempx
	LDY tempy
For your Hp can't be more than 03 when getting a PowerUp, you need to modify your "PowerUp_IncreaseHealth.asm", like this (line 7):

Code: Select all

;;; Increase Health code for player.
;;; works with variable myHealth
;;; works with HUD variable HUD_myHealth.
	LDA myHealth
	CLC
	ADC #$01
	CMP #$09	;;<<-- HERE: the limit max (the myHealth can NEVER be)
	BCS skipGettingHealth
	
	TXA
	STA tempx
	;;;you may want to test against a MAX HEALTH.
	;;; this could be a static number in which case you could just check against that number
	;;; or it could be a variable you set up which may change as you go through the game.
	inc myHealth
	LDA myHealth
	
	LDX player1_object
	STA Object_health,x

	;;; we also need to set up the routine to update the HUD
	;; for this to work right, health must be a "blank-then-draw" type element.
	STA hudElementTilesToLoad
		LDA #$00
		STA hudElementTilesMax
		LDA DrawHudBytes
		ORA #HUD_myHealth
		STA DrawHudBytes
	
	LDX tempx
	
skipGettingHealth:
	PlaySound #SFX_INCREASE_HEALTH
	
Note: I suggest you to use custom scripts: copy the original scripts and make your modifications . Then assign the custom scripts in the "Project settings > Script settings" for your project (instead of the originals).
Doing that, when you will make a new project, yoru new project will use the original scripts... not your modified ones (what if, in your next project you don't use 08 HP, ...)
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
User avatar
Imagaryboy
Posts: 18
Joined: Mon Aug 20, 2018 9:05 am
Location: Cologne

Re: The Score Var and other HUD stuff is sure Buggy

Post by Imagaryboy » Thu Sep 13, 2018 10:12 am

Thank you so much, that really works! :D

The only thing that's left now, is the last HP that won't disappear. Hope there is also a solution for that^^
User avatar
dale_coop
Posts: 1302
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: The Score Var and other HUD stuff is sure Buggy

Post by dale_coop » Thu Sep 13, 2018 10:46 am

Ok, your "last HP that won't disappear"... when doing what?
If it's after the player death, the modification of the "Adventure_HandlePlayerDeath.asm" should set it back (to $08 in your case, cf my script)
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
Post Reply