• Welcome to Dark Bit Factory & Gravity.
 

Vertical Scroller

Started by DrewPee, November 17, 2007

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DrewPee

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
DrewPee
aka Falcon of The Lost Boyz (Amiga)
Ex-Amiga Coder and Graphic Designer
Administrator of > www.retrocomputermuseum.co.uk

DrewPee

Erm . . . ive just sorted out a vertical scroller (of sorts) now!!! lol!!!

I could do with help on the other matter though please?

Drew
DrewPee
aka Falcon of The Lost Boyz (Amiga)
Ex-Amiga Coder and Graphic Designer
Administrator of > www.retrocomputermuseum.co.uk

Jim

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
Challenge Trophies Won: