KevKelley Posted July 8, 2023 Share Posted July 8, 2023 Just wondering out loud here. I had played around with pointers to reuse things like the score sprites and had wondered - is it possible to read specific parts of the sprite, like if a pixel is on or off? Quote Link to comment Share on other sites More sharing options...
+Karl G Posted July 10, 2023 Share Posted July 10, 2023 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. Quote Link to comment Share on other sites More sharing options...
KevKelley Posted July 11, 2023 Author Share Posted July 11, 2023 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. Quote Link to comment Share on other sites More sharing options...
+Gemintronic Posted July 11, 2023 Share Posted July 11, 2023 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. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.