jorotroid said:Whoa! This is looking amazing. I am particularly loving the background so far.
Mugi said:ah, the sprite hud guy himself!
it's largely thanks to you that my game looks anything like i wanted it to
speaking of the hud, did you reimplement yours on 4.1.0 already?
how did you solve the issue with it being stuck on 0HP after dying ? I got it working but im not really that good with assembly, so would be nice to hear more from that.
jorotroid said:I'm glad you found my spirte hud was useful to you!
I haven't reimplemented much at the moment. So far most of my time with 4.1 has been exploring and "mapping" out where stuff has moved/changed in the code. But I can make that higher on my priority list. But if ChronosV2 puts out his sprite HUD first, you might want to consider using his as I think it will be more customizable. I'll probably try his at some point and go with whichever one uses less space (I'm going to need every bit for my game).
By it being stuck on 0HP after dying, do you mean after you die and respawn, it is stuck on 0HP? I don't recall if I had that issue. I did have an issue where at 0HP, the healthbar would fill back up. That I did solve, but I am a little fuzzy on how I did it at the moment. I'll probably remember things better as I reimplement them.
Mugi said:I'll stick with my variation of yours, as it does everything i need it to, and it's really compact as far as code goes now.
as for the issue, for me it was stuck permanently at 0HP after dying and respawning, until the emulator was resetted. (the health worked, it was just the hud not updating.)
i fixed it simply by changing your "death check" (in predraw, that checks for #$FF and writes #$00 on it to not tilt the HUD) to write #$00 into Object_health,x instead of temp3, since that, it has functioned as intended.
as for setting it up, instead of handleobjectcollisions.asm, you have to set the trampoline into bank14.asm now, and just set the macro into a custom define. (i just call the macro from predraw straight now.)
as for later updates, do tell me if you write more compact code, as i will propably need all the bits i can save on my game too (i posted my variation of your hud code in your thread, since it only counts up to 8 HP and only half or full sprite to draw, the draw logic is much smaller than yours.)
edit: im also extremely interested on, if you start digging up how to strip of the default hud code, since that stuff eats some serious space as far as i understood.
(i was glancing over it a little but havent really dug in yet, it seems to be kinda allover the place. Like you, most of my time has been exploring the new code and redoing my physics.)
.include SCR_SPRITE_HUD
checkForSpriteHUDDraw:
LDA gameState ; We want only want to make the HUD in the main gameState.
BNE drawingSpriteHud
RTS
drawingSpriteHud:
; Draws the health symbol at the left side of the bar.
DrawSprite #$08, #$E0, #$7C, #%00000001, spriteOffset
inc spriteOffset
inc spriteOffset
inc spriteOffset
inc spriteOffset
; on death, player_object gets it's health set to #$FF which the HUD doesn't really appreciate,
; so we are checking, and if HP is #$FF we set it to #$00
LDX player1_object
LDA Object_health,x
CMP #$FF
BNE thePlayerIsAlive
LDA #$00
STA Object_health
JMP letsGetThisHUDStarted
thePlayerIsAlive:
LDA Object_health,x
STA temp3
letsGetThisHUDStarted:
;; Draw the Health Bar
DrawStatusBar #$18, #$E0, temp3, #$7F, #$11, #$7E, #$11, #$7D, #%00000001
MACRO DrawStatusBar arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8
;; arg0 x position of bottom bar segment
;; arg1 y position of bottom bar segment
;; arg2 value bar is displaying
;; arg3 location of empty graphic
;; arg4 location of 1/4 graphic
;; arg5 location of 1/2 graphic
;; arg6 location of 3/4 graphic
;; arg7 location of full graphic
;; arg8 attribute data (bits 0 and 1 determine which palette is used)
LDA #$00
STA temp2 ;Number of full sprites
STA temp1 ;if there is a partial sprite and what is it
LDA #$04
STA temp ;Number of empty sprites
LDA arg2
;see if health empty
AND #%00001111
BEQ readyToDrawHealthBar
; store full sprite number
LSR a
STA temp2
; no bit was left over
BCC drawHealthBar
; bit left over, our half sprite
LDA arg5
STA temp1
drawHealthBar:
LDA temp
SEC
SBC temp2 ;Number of full sprites
STA temp ;Number of empty sprites
BEQ readyToDrawHealthBar ;If we only have full sprites, then we can go ahead and draw
LDA temp1
BEQ readyToDrawHealthBar ;Does an empty sprite need to be replaced with a partial sprite?
DEC temp ;remove 1 empty sprite for partial
readyToDrawHealthBar:
LDX temp2
LDA arg0
STA temp2 ;Now temp2 is the x position of drawing from left to right
fullSpritesLoop:
TXA
BEQ partialSpriteDraw
DrawSprite temp2, arg1, arg7, arg8, spriteOffset
inc spriteOffset
inc spriteOffset
inc spriteOffset
inc spriteOffset
LDA temp2
CLC
ADC #$08
STA temp2
DEX
JMP fullSpritesLoop
partialSpriteDraw:
LDA temp1
BEQ readyToDrawEmptyBars
DrawSprite temp2, arg1, temp1, arg8, spriteOffset
inc spriteOffset
inc spriteOffset
inc spriteOffset
inc spriteOffset
LDA temp2
CLC
ADC #$08
STA temp2
readyToDrawEmptyBars:
LDX temp ;Loaded into X for iteration
emptySpritesLoop:
TXA
BEQ doneWithHealthBar
DrawSprite temp2, arg1, arg3, arg8, spriteOffset
inc spriteOffset
inc spriteOffset
inc spriteOffset
inc spriteOffset
LDA temp2
CLC
ADC #$08
STA temp2
DEX
JMP emptySpritesLoop
doneWithHealthBar:
ENDM
Mugi said:was a long night but here it is!
i finally finished writing the code up for my stage selection and the entire screen framework is finally complete and implemented.
have at it!
this is a screen with a cursor selectable warp location with unlimited multiwarps (you can input as many warp locations as you want.)
the multi-warp code is also mostly written (just needs a cleanup) but not implemented yet.
again, placeholder graphics, still out of inspiration for the graphics on this one