- Baby Steps in Drawing Sprites
- 21 Nov 2012 01:59:37 pm
- Last edited by Rabadash8820 on 25 Nov 2012 10:28:10 pm; edited 1 time in total
Alright, so I'm moving past my z80 paradigm of drawing only single dots and characters on the screen at a time...I want to use sprites! My first big question is, quite simply, how does one draw a sprite? I've read multiple tutorials on how to do this, but none seem to give a straightforward answer. I get that you have to define your sprite in a sort of binary matrix, like below:
Code:
Derp, I could do that with a matrix in TI-Basic. But how do you then get that "matrix" into plotScreen so as to be drawn. This page, http://z80-heaven.wikidot.com/sprites, seems almost unfinished, because its section "Placing the Sprite on the Screen" has nothing under it. This page, http://z80-heaven.wikidot.com/sprite-routines, shows how to place a sprite but doesn't tell you where or how you should place a matrix like above into the code (a step which I assume is necessary no matter what). And most other tutorials just say, "use Ion PutSprite to do all your sprite stuff." That may be great down the road, but if I can't just put a stationary smiley face on the screen by myself then I'm probably not going to understand Ion, and I won't be a very good programmer in general:P So, in conclusion, I understand the whole binary representation of a sprite, but I don't understand how to get this sequence of bytes onto the display. Any advice will be appreciated. Kthxbai
Edit by Catherine: Added in [ code ] tags. Next time, put it around any bit of code you're typing and it'll format it nicely.
Code:
smileyFace:
.db %00000000
.db %01100110
.db %01100110
.db %00000000
.db %00000000
.db %10000001
.db %01000010
.db %00111100
Derp, I could do that with a matrix in TI-Basic. But how do you then get that "matrix" into plotScreen so as to be drawn. This page, http://z80-heaven.wikidot.com/sprites, seems almost unfinished, because its section "Placing the Sprite on the Screen" has nothing under it. This page, http://z80-heaven.wikidot.com/sprite-routines, shows how to place a sprite but doesn't tell you where or how you should place a matrix like above into the code (a step which I assume is necessary no matter what). And most other tutorials just say, "use Ion PutSprite to do all your sprite stuff." That may be great down the road, but if I can't just put a stationary smiley face on the screen by myself then I'm probably not going to understand Ion, and I won't be a very good programmer in general:P So, in conclusion, I understand the whole binary representation of a sprite, but I don't understand how to get this sequence of bytes onto the display. Any advice will be appreciated. Kthxbai
Edit by Catherine: Added in [ code ] tags. Next time, put it around any bit of code you're typing and it'll format it nicely.