Omnimaga

General Discussion => Technology and Development => Computer Programming => Topic started by: Xeda112358 on March 14, 2018, 01:39:13 pm

Title: How To Add Two Sprites
Post by: Xeda112358 on March 14, 2018, 01:39:13 pm
For a few years now, I've been playing on-and-off with various ideas related to parsing and evaluating expressions. Today as I was working out the code for adding two values, I came across the case of adding a 'sprite' variable to some other variable.

If you had a programming language where you had two sprite variables, what would you want or expect 'sprite1+sprite2' to do, if anything? For that matter, how about adding an integer or float to it? How about multiplication or division?

I know, for example, that I would want 'sprite1 or sprite2' to return a sprite with it's contents bit-wise ORed together.
Title: Re: How To Add Two Sprites
Post by: Streetwalrus on March 14, 2018, 02:28:39 pm
I would handle the sprites more or less like strings, where adding them would concatenate them into one. In the very specific case of z80 calcs where we mostly handle 8-wide sprites, stacking them on top of each-other seems like the most straightforward way to do it.