Jump to content
IGNORED

Is it possible to insert different chunks of sprite data into one sprite?


Random Terrain

Recommended Posts

Thanks to SeaGtGruff, I know how to make sprites share sprite data. For example, you can have long sprite data made up of number shapes and have various sprites display any of those numbers (like you see in Tone Toy 2008). But what if you want to change certain parts of a sprite instead of the whole thing? Say you want to have Space Invader-like aliens and you create 20 top halves and 20 bottom halves that all match perfectly. Is there a way to randomly insert the top sprite data into the top of the sprite and randomly insert the bottom sprite data into the bottom part of the sprite so you never know exactly what the alien will look like? Is it possible to do it without getting flicker? Anything I try makes the two parts flicker.

 

 

Thanks.

Edited by Random Terrain
Link to comment
Share on other sites

Thanks to SeaGtGruff, I know how to make sprites share sprite data. For example, you can have long sprite data made up of number shapes and have various sprites display any of those numbers (like you see in Tone Toy 2008). But what if you want to change certain parts of a sprite instead of the whole thing? Say you want to have Space Invader-like aliens and you create 20 top halves and 20 bottom halves that all match perfectly. Is there a way to randomly insert the top sprite data into the top of the sprite and randomly insert the bottom sprite data into the bottom part of the sprite so you never know exactly what the alien will look like? Is it possible to do it without getting flicker? Anything I try makes the two parts flicker.

 

 

Thanks.

Yes, there is a way-- but to do it with the default (non-customized) bB kernels, you must use RAM. If you're using the Superchip option-- no problem, you may have RAM to spare! But if you are *not* using the Superchip option-- ouch, you don't have much precious RAM to spare as it is! :)

 

What you need to do is (1) reserve some bytes of RAM for this purpose, such as deciding that variables a through h will be used to store an 8-line shape for player0; (2) instead of using the "player0:" statement to define player0's shape, just set the hi and lo pointers for player0 to the beginning of the RAM area; and (3) set the RAM locations to the necessary values to define the player's shape. You could also (4) use the "player0:" statement to define a long sprite that has all the different parts you want to use for the player, and then (5) change the pointers for the player so they point to the RAM location, and (6) copy the desired portions of the shape into the appropriate bytes of RAM.

 

My brain is kind of fried right now, so I can't post an example right away, but I actually posted an example of doing a RAM player a couple of years ago. If you search the batari Basic forum, you should be able to find it. I'll look for it and post a link, although it's just an example of how it could be done, and it doesn't utilize all of the suggestions I mentioned above.

 

Michael

Link to comment
Share on other sites

Hmm, I guess it was a demo for the early Superchip stuff that I did, before Superchip support was officially added to bB, so I should probably put together a new demo. As I said, my brain is fried right now, so it won't be until this weekend that I can focus enough to do one. :ponder:

 

Michael

Link to comment
Share on other sites

Hmm, I guess it was a demo for the early Superchip stuff that I did, before Superchip support was officially added to bB, so I should probably put together a new demo. As I said, my brain is fried right now, so it won't be until this weekend that I can focus enough to do one. :ponder:

I was just looking at that too. Whenever you get a chance, that would be great. I hope to do it without Superchip and without bankswitching if I can. I might find out that it wastes too many variables, but it's worth a try. Even if I never use it in a finished game, somebody else might.

 

 

Thanks.

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...