Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Snake X on June 09, 2010, 10:15:56 am

Title: sprite question
Post by: Snake X on June 09, 2010, 10:15:56 am
how many hex values can be stores in pic0-9 at max?
For example: [28937A3847FDAA137139B1478247E82671]->pic1
Title: Re: sprite question
Post by: SirCmpwn on June 09, 2010, 10:30:09 am
Depends on your free RAM.  These values are simply appended to the end of the binary, and you can store as much data as you have RAM to hold it.  Personally, I use newlines and new brackets to keep things organized, but you should be able to use as much as you like.  While I was working on HL2, I had 1536 digits of hex in a single set of brackets [].
Title: Re: sprite question
Post by: jsj795 on June 09, 2010, 10:50:59 am
I have a sprite question too... For 5x5 sprites sheet, do you still need to put in hex code for 8x8 sprites?
So it would go like,
[8x8 sprite 1 ->Pic1
[8x8 sprite 2
[8x8 sprite 3

etc.?
Title: Re: sprite question
Post by: SirCmpwn on June 09, 2010, 11:20:04 am
Yes.  You could technically combine them using partial bytes and a 5 bit system, but this is a hell of a lot more trouble than it is worth.  Just put each 5x5 sprite into your program the same way you would use an 8x8 sprite.  You should be aware, though, that Pt-Off will clear an 8x8 area around your sprite, not 5x5.
Title: Re: sprite question
Post by: jsj795 on June 09, 2010, 12:52:11 pm
so what should i do to clear the sprite? well, my sprite is 7x5 not 5x5, it's the tile that's 5x5...
anyways, how can i clear only sprite and not the whole 8x8 tile
Title: Re: sprite question
Post by: DJ Omnimaga on June 09, 2010, 12:55:18 pm
I generally separate my brackets depending of the type of sprite/tiles I have stored. I'll put player sprites in one set, enemies in another set of brackets and tiles in another, for example.
Title: Re: sprite question
Post by: SirCmpwn on June 09, 2010, 12:56:26 pm
Pt-Change( will clear it.  Alternitavely, redraw every sprite each frame, that's what I do.
Also, have a 5x5 black square sprite and call Pt-On( with the square sprite to clear it to black, and Pt-Change( with the square sprite in the same spot to clear it to white.
Title: Re: sprite question
Post by: jsj795 on June 09, 2010, 12:58:54 pm
I think I'll do the Pt-Change(
That seems to be easiest. So that won't clear the tiles and only clear the sprite, right?

@DJ yeah that's what I do. I keep the tilesheet in one pic, character in another pic.

MY 666 POST!!!
Title: Re: sprite question
Post by: SirCmpwn on June 09, 2010, 01:01:02 pm
Pt-Change will invert the sprite.  To clear a 5x5 sprite to white, do this:
Code: [Select]
[1F1F1F1F1F000000->Pic1
...
Pt-On(X,Y,Pic1
Pt-Change(X,Y,Pic1
This will only affect a 5x5 area, and will make it white.

(My 700th post)
Title: Re: sprite question
Post by: DJ Omnimaga on June 09, 2010, 01:03:05 pm
Thanks for the tip Sir. I assume that if your terrain isn't all plain white, that the usage of masked sprites is inevitable, though, right?

And congrats jsj795 for turning evil :P
Title: Re: sprite question
Post by: SirCmpwn on June 09, 2010, 01:05:00 pm
It depends.  The tile mapper should clear the screen before drawing the map, anyway.  However, the sprites on top should be maksed.  But it's not that hard to mask sprites, just do Pt-On with a filled sprite and Pt-Change with the stuff you want to clear off.
Title: Re: sprite question
Post by: jsj795 on June 09, 2010, 01:05:10 pm
I think what Pt-Change will do is to invert all the pixels that your character has, and leave the white pixels in the 8x8 sprite alone, which means even if the terrain is black, you still will have black. So no need to mask (or at least that's how I understood)

Edit: ninja'd and kind of wrong info too :P lol
Title: Re: sprite question
Post by: SirCmpwn on June 09, 2010, 01:07:23 pm
Um, I'm not entirely following you here...
Pt-On will turn on the pixels in your sprite, and leave the rest alone.
Pt-Off will overwrite the screen pixels with your own pixels, which will turn off the zeros and turn on the ones.
Pt-Change will change pixels on the screen.  If a pixel in your sprite is black and a pixel on screen is white, the on screen pixel becomes black.  If a pixel in your sprite is black and the pixel on screen is black, the pixel on screen becomes white.
Title: Re: sprite question
Post by: jsj795 on June 09, 2010, 01:11:40 pm
So if I do a Pt-On(5x7 Sprite
and then I do a Pt-Change(5x7 Sprite (the same one that I did with Pt-On)
then nothing will be disrupted except my 5x7 will be erased, right?
Title: Re: sprite question
Post by: SirCmpwn on June 09, 2010, 01:12:17 pm
Right.