Sprites, Tile Sets, and Polyvector positioning

Previous topic - Next topic

Synthetic

I ran into a limit of 4k sprites. I tried to get around this by using polyvectors and a tile set but couldn't figure them out completely so I searched the forums and found a post about animated sprites. In this thread GernotFrisch posted some sample code with a PSprite function. I tried it out, figured out somewhat how they work, and altered it to see if I could get it to do what I want but was unsucessful. Basically, I wanted to position the output at any x,y position on screen. I was able to move the Hello PSprite text up and down but not right and left by just a number. Spaces in the word variable worked but I was hoping to accomplish a way to position the output to any x position on screen not just the distance of a space. Is there something obvious I'm overlooking in positioning the polyvector output?
"Impossible is a word people use to make themselves feel better when they quit."

My AMXMODX plugins for Day of Defeat 1.3 can be found here.

Kitty Hello

Hmm.. The PSprite example I gave it just to copy/paste parts of a block from a sprite(tileset) to the screen.
Here's how to move the text:

Code (glbasic) Select
// 272x176 = 17x22 pixels per char
LOADSPRITE "smalfont.bmp", 0

a$ = "Hello PSprite"
WHILE TRUE
    MOUSESTATE mx, my, b1, b2
    FILLRECT 0,0, 800,600,RGB(0,255,255)
    FOR i=0 TO LEN(a$)-1
        // See mx, my ->it's the sprite's x/y pos
        // I simply add the i'th width of a character for each one
        PSprite(0, ASC(MID$(a$, i, 1)), 17,22, i*17+mx, my)
    NEXT

SHOWSCREEN
WEND

FUNCTION PSprite: id, tile, width, height, x, y
LOCAL sx, sy, tx, ty, dx, dy
LOCAL p2x, p2y
LOCAL cols, c
    GETSPRITESIZE id, sx, sy
    cols = INTEGER(sx / width)
    tx = MOD(tile, cols) * width
    ty = INTEGER(tile/cols) * height
    c=RGB(255,255,255)

    width=width-1
    height=height-1
    STARTPOLY id
        POLYVECTOR x,      y       ,tx      ,ty       ,c
        POLYVECTOR x,      y+height,tx      ,ty+height,c
        POLYVECTOR x+width,y+height,tx+width,ty+height,c
        POLYVECTOR x+width,y       ,tx+width,ty       ,c
    ENDPOLY
ENDFUNCTION

Synthetic

Thanks for the help GernotFrisch! =D
"Impossible is a word people use to make themselves feel better when they quit."

My AMXMODX plugins for Day of Defeat 1.3 can be found here.