[4.5.6] Combating Sprite Limits - Forcing Blank Sprites to Not Draw

TalkingCat

Member
Perhaps someone will come in handy. Doesn't draw empty tiles for gameObject tile #$7F and Monster graphic tile #$FF
Code snippet for inserting into MetroidvaniaMod [4.5.9] script doDrawSprites_PlatformBase.asm
Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    doDrawSpritesLoop:
    
            LDA (temp16),y
            clc
            ADC temp3
            STA tempC ;; the calculated table position, with offest.
                        ;; tempC becomes the "tile to draw".
            INY
            LDA (temp16),y
            STA tempD ;; the next value is the attribute to draw.
            INY         ;; increasing again sets us up for the next sprite.
                        ;; now we can use tempA-D to draw our sprite using the macro.
                        
            LDA tempC
            CMP #$7F
            BEQ +
            CMP #$FF
            BEQ +
                            
                
                ;;;;;;;;;;;; Here, we need to evaluate if this tile should be drawn
                ;;;;;;;;;;;; based on the comparison to camX.
                JSR evaluateTileAgainstCameraPosition
                BEQ thisTileIsInCamRange
                    JMP thisTileIsOffScreen
                thisTileIsInCamRange       
                DrawSprite tempA, tempB, tempC, tempD
            +
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        
        
        thisTileIsOffScreen:
Снимок экрана 2023-05-16 120816.pngСнимок экрана 2023-05-16 120746.png
 

dale_coop

Moderator
Staff member
Yes.
I usually use #$00 and #$80 because those are the most useful empty ones.
(when you create a new object, those ones are the default sprites set to the objects)
 
Top Bottom