[Gambas-user] RPG Board

Benoit Minisini gambas at ...2...
Sat Aug 23 22:08:25 CEST 2003


Le Samedi 23 Août 2003 04:01, Devilyn a écrit :
> Hello,
> Ok I want to make a tile based board. So I figure I would use a image box
> or picture box. So I figure that if I made a array the size of a small box
> maybe 32X32. with diffrent numbers in it to hold values.. like 1 for tile
> A, 2 for tile B, 3 for tile C. Now I know in Microsoft Visual Basic you use
> the API call BITBLT to cut out one tile at a time out of a tileset like a
> big .bmp file with about 26 tiles in it. In Gambas is it possible or do I
> have to cut all my tiles into peices. So I have 1 tile in each .bmp file.
> Also what do I have to do to put the tiles in a picture box using a array?
> This is just a start for me. If anyone knows or can make a small demo with
> this It would be of a great help. I have no Idea how to paste several
> difftrent tiles into a picture box with gambas. If I can make a small board
> out of several tiles and save the array number deal into a text file it can
> be used in a game that is 2d tile based. but how is it done? Devilyn
>
>

Try something like that:

' 1) Create a cached DrawingArea named "MyDrawingArea"
' 2) Create a Timer that regularly calls the following code
' 3) Put all your tiles in one bitmap file (don't use bmp, use png)

Draw.Begin(MyDrawingArea)
' Draw one tile
X = CalcXFromTileIndex(TileIndex)
Y = CalcYFromTileIndex(TileIndex)
Draw.Picture(TilePicture, X, Y, SrcX, SrcY, TileWidth, TileHeight)
' Repeat the previous for each board
...
Draw.End

Of course, if you want speed, you must use C ! :-)

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list