Dark Bit Factory & Gravity
PROGRAMMING => Freebasic => Topic started by: DrewPee on November 17, 2007
-
Could anybody help me with a vertical scroller routine using tinyptc please?
I have done a scroller of sorts but really really not happy about it! :whack:
Would it also be possible to enable a zoom function into this as well?
i.e. if a character is 8 pixels by 8 pixels (as my spectrum font is . . .) could i make this say 64 x 64 pixels instead (I know it would look blocky but this is something I have an idea for!).
Can anybody help me with this one please?
Thanks in anticipation . . .
Drew
-
Erm . . . ive just sorted out a vertical scroller (of sorts) now!!! lol!!!
I could do with help on the other matter though please?
Drew
-
If you're just using PTC and drawing pixels, then it's just a case of repeating each source pixel many times.
You might have
for y=0 to srcy-1
for x=0 to srcx-1
pix = srcgfx[x+y*srcx]
for h=0 to yscale-1
for w=0 to xscale-1
screen[dstx+w+(dsty+h)*SCREENWIDTH]=pix
next
next
dstx += xscale
next
dstx -= srcx*xscale
dsty += yscale
next
Where xscale and yscale are the x and y repeat counts, so you might want 8 and 8 for a 64x64 graphic, and dstx, dsty are the screen position of the sprite, scrx and srcy are the source size (8,8), and SCREENWIDTH is the screen width.
(Code untested)
Jim