Page 1 of 1
Posted: Thu Apr 24, 2003 10:36 am
by BackupUser
Restored from previous forum. Originally posted by Madman.
some command to copy a rectangle part of some image into the video buffer or some other image. This function would be very handy for tilebased levels, like many many RPG style games use this kind of levelengine.
Its doubtlessly faster to quickly copy the displayable map together from a tileset-gfx and scroll the finished imagefile than handle 500+ sprites as proposed in my earlier thread (that seems to have vanished by now)
PB doubtlessly is by far the best Basic, but a missing command like this should be implemented asap imho. All other Basic dialects have compareable commands.
Please consider adding such function. TY !

Posted: Thu Apr 24, 2003 10:47 am
by BackupUser
Restored from previous forum. Originally posted by freak.
Why not use the ClipSprite() command, and then DisplaySprite()
Does the job quite well for me.
Timo
http://freak.coolfreepages.com/
Posted: Thu Apr 24, 2003 12:33 pm
by BackupUser
Restored from previous forum. Originally posted by Madman.
So you load the entire tileset into memory for each tile you must display, shrink the viewport and display that ?
Lets calculate a bit:
Considered 800x600 screenresolution, and a tilesize of 16x16 pix,
we need 50 tiles for x and approx 38 for y axis just to fill the screen (no scrolling here yet)
50x38 = 1900. Hmm. You flush around 1900 sprites to achieve something, that can be done with a single gfx ?
Now lets make the level a bit bigger. Lets say we make the level 1600x1200 pix.
Unless we use bigger tiles (32x32) you have 3800 sprites to handle.
Now if PB loads the entire gfx and only displays the clipped area, you need 1900x more RAM than a simple graphic.
Thats a waste of ressources dont you think ?
Posted: Thu Apr 24, 2003 12:54 pm
by BackupUser
Restored from previous forum. Originally posted by freak.
No need to load the tileset more that once.
You can clip always a different region, before displaying it.
So in the Loop, or wherever you display your tiles, you always
use ClipSprite() to clip the part you want to display next, and then
DisplaySprite(). Before the next DisplaySprite() you just clip another region.
Timo
http://freak.coolfreepages.com/
dooh :)
Posted: Fri Apr 25, 2003 8:09 pm
by Madman
Why is that everyone is working against my tile-engine ? LMAO !!
Who was the one posting his example ? THCS i think ? Can you please repost ? Thx !!
Posted: Sat Apr 26, 2003 9:48 am
by THCM
Hi Madman,
again my example:
Given:
#SpritesID = Loaded Picture 24 Bit PNG 640x144
#SpritesX = 10 ;No of Sprites in a line
#SpriteSizeX = 64
#SpriteSizeY = 48
Animpointer = No of Sprite to display (0-29 there are 30 frames in the picture)
y = AnimPointer / #SpritesX * #SpriteSizeY
;y-pos of Sprite in loaded picture
x = (AnimPointer-((AnimPointer / #SpritesX) * #SpritesX)) * #SpriteSizeX
;x-pos of Sprite in loaded picture
ClipSprite (#SpritesID, x, y, #SpriteSizeX, #SpriteSizeY)
;sets the spriteclipping
DisplayTransparentSprite(#SpritesID, Xpos , Ypos)
;displays only the clipped sprite at xpos, ypos
The ClipSprite command only defines the source area in a larger picture, which will be blitted to the screen using a displaycommand.
I think it's not the usual way, but works fine and is very fast. There's no need to have a command you suggested! The ClipSprite is also very nice, if you want to draw always the same animationframe on the screen (Stars, Particles etc!)
Bye, Yours