Jump to content
  • 0

Particles


tgd20
 Share

Question

Hi All, I’m considering how to include a simple particle system in an X16 game - eg for explosions, with each particle being a single pixel.  I can’t find any examples of how to do this (assembly).  Does anyone have any suggestions or links?  Many thanks T

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

The only way I see is to use sprites. But you would need to sacrifice quite a lot of them just for that - like 50 or so, out of the 128 you have available. Each pixel would be a sprite, moving at it's own random trajectory, disappearing after a second or so.

What I did in Invaderz was to use a similar approach than animated GIFs. An explosion is a sprite, replacing or overlaying the exploding object. The explosion consists of let's say 8 different images you cycle through. Very different from what you want.

You could consider a mix of both, like was seen in "Parsec" on the TI99/4A:

Can't help with assembler code - I use C and CC65.

  • Like 1
Link to comment
Share on other sites

  • 0

The two options I can currently think of, are sacrificing many sprites for single-pixel particles. The other way would be to manually draw them in a bitmap layer.

Sacrificing sprites seems to be easier in my opinion. If you look into the VERA documentation, you will find that there are 128 sprites which could be enough depending on what you intend to do. If you use sprites, you could easily extend the particles to represent something bigger than a single pixel. The other advantage is, that AFAIK, sprites always appear on top (notice, however, the priority of lower sprites over higher ones as is stated at the bottom of this section in the docs). Moving sprites around is as easy as changing a number in graphics memory. The downside, of course, is that you might want to use the sprites for something else.

The alternative is to use one of the two tile/bitmap layers (which ever of them is on top of the other. I can't remember) in bitmap mode and draw the particles as single pixels there. These particles would appear above the other tile/bitmap layer, but beneath sprites. I think color 0 of the palette is transparent, so if you would like black particles you would need to set a different different palette entry to black. In this case you would need to remove the pixel from its old location (by setting the color of its old position to 0) and draw it at its new position.

Figuring out how to use the VERA can be a bit tricky at the start. I'm sure people will be willing to help. Or simply search this site for examples. I think there are plenty out here by now.

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

Guest
Answer this question...

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

 Share

×
×
  • Create New...

Important Information

Please review our Terms of Use