DrawSpriteRect pic$, x, y, start_x, start_y, breite, h?he [, frame]
An out-take of the loaded pic$ with spec. hight,width and startpos x,y will be draw onto x,y
pic$ - picture ID
x - x coordinates
y - y coordinates
start_x - x coordinates for startpoint in load pic.
start_y - y coordinates for startpoint in load pic.
width - width picture out-take
hight - hight picture out-take
frame - frame if used...
That would be nice to draw some tilesets and a levelengine for jump&runs....
Polyvector will do that for you .... and more besides (like lighting effects) :good:
OK. Tanks.
I will have a look on it.
Thats the problem i mentioned. The documentation is very rare....
But very good support here. Thx.
Or you use SETSCREEN :)
@Schranz0r
What do you want to say with Setscreen?
With that command i can set up my resolution for the screen.
I need an command to draw some parts of an .png onto the screen.
For example to draw tiles for a levelengine.
I cant understand the relation to setscreen?
Greets M
You can draw onto a new sprite, storing the picture instead of having to redraw it every time the player is standing still. On the other hand you have to draw it twice as long as the player is moving since you still have to draw the new sprite on screen.
Whoops... CREATESCREEN, sorry!
ROTOZOOMSPRITE uses x y insertion and a scalar to resize it.
If you need it to be framed, ROTOZOOMANIM will work.
Hi.
Thx for explanation.
But. In fact i need some other functions here.
Obviously, i have to make some functions for myselfe.
I need a special function, which loads a png, bmp into the memory. Then with the new function
i can draw some parts out of this picture onto the screen. With sprites?
So.
I have som DIM arrarys for the level (1AA 1AB and so on)
And with that i will generate a tilemap onto the screen.
I?v looked on some tutorials with Polyvector. But its a little bit hard to convert blitz3D programms into GLBasic.
Not special the language. But there are some very cool commands in Blitz3D which are missing here in glBasic....
So i have to programm it by myselfe.
If i have a substantial progress i will share it with you.
Meanwhile: thinking and woundering.........
If you want a tilemap there are a few examples in the forums and on some homepages. I think there was even a tutorial somewhere. What most of us do when doing tilemap is to just load the picture with LOADANIM and specify the size of each tile. Then we can use DRAWANIM to draw all tiles on the screen according to an array we have made previously. If you look up DRAWANIM in the help file you can see a small example of how to do it.
So please help me here. Im confused....
I tried to load the arrays. So they are OK now..
But when i want to use some comparisons it wont work.
I can print the dim array onto screen. I get 1AF 000 and so on:
(http://img2.imageshack.us/img2/7088/array.jpg)
But if i want to compare that and draw a sprite it wont work? Why??
SORRY...
I found that: Forget the space room...? :zzz: :zzz:
(http://img4.imageshack.us/img4/917/array2.jpg)
Sorry for the spaming....
And here my first Version, Wizard Engine from Blitz3D to GLBasic....
http://wizard.lexigame.de/datas/wizard.zip (http://wizard.lexigame.de/datas/wizard.zip)
Use Cursors to move
Use F10-F12 to see the array number
Use +/ - on Numpad for Strech
Use F1 to set back to 0
So my solution for this topic to draw tilesets is:
Types and Sprites.
- loadimage AS Tsprite
- set up the rows for the different lines in the picture
- draw that with
IF BMPZeile=1 AND Layer$[x+mapoffsetX][y+mapoffsetY]<>"000" THEN ZOOMSPRITE player5.pic[BMPSpalte],x*32*strechx,y*32*strechy,strechx,strechy
So it works...
Look for my new spriteenginge...with 300 FPS....(instead of 48 FPS at Blitz3D)
glow=red,2,300]And here my first Version, Wizard Engine from Blitz3D to GLBasic....[/glow]
http://wizard.lexigame.de/datas/wizard.zip (http://wizard.lexigame.de/datas/wizard.zip)
I'd love to see this command too.
In my case, I have a what you could think of as a set of selectable tiles where there are a lot more than fit on the screen at any time. The set of tiles can be scrolled left & right to find the one you want to select.
The tiles that get scrolled are created dynamically by the program, so there's no image file I can load as animation frames.
Additionally, as the set of tiles can scroll, the first and last tiles on the screen will often be partial ones, so I can't just draw animation "frames" to the screen to get around the problem as drawanim doesn't support drawing partial frames.
My ideal solution is to create a bitmap as wide as there are tiles, then just draw the correct sized section from that large bitmap to the screen.
From what I can tell, my solution has to be
Create screen (large)
Draw all sprites to the big "screen"
each frame, swap to the new screen
use grab sprite to grab the section I want to display
swap back to the back buffer
drawsprite
This seems a lot of overhead as opposed to a drawspriterect command.
I've never used polyvector, but the solution seems to be even worse
Create screen (large)
Draw all sprites to the big "screen"
use grab sprite to grab this big image to a single sprite
each frame create a poly
Use 4 polyvector commands changing the tx value to the start of what I want to draw
endpoly
Again, this seems a lot more overhead (in terms of lines of code) then should be required.
My biggest problem with either of these methods though is that they aren't really intuitive whereas a drawspriterect is.
Quote from: FutureCow on 2009-Oct-09
I'd love to see this command too.
In my case, I have a what you could think of as a set of selectable tiles where there are a lot more than fit on the screen at any time. The set of tiles can be scrolled left & right to find the one you want to select.
The tiles that get scrolled are created dynamically by the program, so there's no image file I can load as animation frames.
Additionally, as the set of tiles can scroll, the first and last tiles on the screen will often be partial ones, so I can't just draw animation "frames" to the screen to get around the problem as drawanim doesn't support drawing partial frames.
Okay, I'm confused - if I understand correctly, surely you need nothing more than any other scrolling tile based map? If so, the answer is very simple indeed.
At the screen edges, you do not need to draw "partial" frames - you simply draw them outside the dimensions of the screen - ie. if you have a sprite that is 64x64 pixels, you can quite happily draw it at -32,-32 and just the bottom right will be visible on the screen. Why over complicate matters?
The reason I wasn't able to draw offscreen was that unlike the tiled map solution, my "tiled map" didn't go right to the edges of the screen. To use this sort of solution I'd have to draw my "map tiles" then draw over them with a mask to hide the bits that would normally be hidden by the edges of the screen. With the way my program was built, it was getting overcompilcated and messy, I ended up redesigning my interface to simplify things.
Use Viewport for this
Ahh, so drawing outside the viewport will not resort in anything being displayed? I didn't realise that, I thought it's only advantage was to give you a scaled version of the main display where you could set where you wanted it's (0,0) coordinate to be. I didn't realise it would crop as well.
Yes, it crops too, it also scales 3D so you can have your own little 3D view in the 2D view if you want :-)