Jump to content
IGNORED

Reading Specific Parts of Sprites


Recommended Posts

I assume you mean with bB? The answer would be yes, but you would have to access it via assembly as a pointer. Here's examples that should work with the standard kernel or the multisprite kernel to load either the first byte or the last byte of the player 0 sprite into temp1, and from there you can check the bits manually in bB as normal.

 

Since sprites are stored upside down, getting the first (top) byte of the sprite is done by getting the last one stored:

    asm
    ; load player 0 height into Y register
    ldy player0height
    ; decrement Y by 1
    dey				
    ; load top of player 0 sprite into A register
    lda (player0pointer),y	
    ; store A register into temp1 variable
    sta temp1				
end

 

Getting the last (bottom) byte of the player0 sprite is nearly the same, but the Y register is set to 0:

    asm
    ; load 0 into Y register
    ldy #0
    ; load bottom of player 0 sprite into A register
    lda (player0pointer),y	
    ; store A register into temp1 variable
    sta temp1				
end

 

Let me know if that answers your question.

Link to comment
Share on other sites

I guess more specifically I was wondering if it were possible to use a sprite for multiple variables, like have a sprite that is 20 pixels high but set player height to 10. So perhaps you look at the 11th row to read that value as a number.

 

I had no real immediate use for it but was wondering if it was something possible. 

Link to comment
Share on other sites

You could probably do something based on Al_Nafurs technique for sharing sprites.  The sprite data is just a plain old DATA statement at that point.  You could probably then treat the DATA statement as a static array and bobs your uncle.

 

..but, in truth I still barely understand how it works or sprite data pointers in general.

 

 

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...