|
Post by hartnell on Apr 19, 2007 6:38:19 GMT -5
It would be nice to be able to create and maps from scratch while the game is running. And modify them in-game as well. --hartnell
|
|
|
Post by u9 on Apr 27, 2007 11:59:13 GMT -5
Yeah
|
|
|
Post by Guilect on Apr 27, 2007 15:37:14 GMT -5
Well aren't all the commands to do that already available?
you would have a tileset graphic. You can load this with the command Graphics.LoadImage
then you would want to make a map You can use the command Graphics.CreateImage
Set this image (your map) as the render target so you can draw your tiles on it You can use the command Graphics.RenderImage
then you would want to pick the tiles from the tileset and place them on your map You can use the command Graphics.CopyRegion
When done making your map you can display it You can use the command Graphics.SetImage
VBScript does not have READ and DATA commands but the following few lines do the trick.
example:
Dim myMap(15)
myMap(0) = "1212121212121212" myMap(1) = "2900100000000001" myMap(2) = "1000004356560002" myMap(3) = "2013422000023001" myMap(4) = "1210002140012202" myMap(5) = "2000400070001001" myMap(6) = "1084300000001202" myMap(7) = "2070000004541001" myMap(8) = "1060010001002202" myMap(9) = "2051213011000001" myMap(10) = "1040000024242202" myMap(11) = "2031000000300101" myMap(12) = "1021100000000102" myMap(13) = "2012345454556301" myMap(14) = "1000000000000002" myMap(15) = "2121212121212121" ' read level data Dim grid(15,15) Dim temp For y = 1 To 15 For x = 1 To 15 Temp = myMap(y) grid(x, y) = Mid(Temp, x, 1) Next Next
|
|
|
Post by hartnell on Apr 28, 2007 4:43:27 GMT -5
I meant a whole ninja-quick map system where we can poke and peek the tilemap like commodore 64 memory, among other neat things. --hartnell
|
|
|
Post by Guilect on Apr 28, 2007 6:59:58 GMT -5
What commands did they have, what did they do, and what where their parameters?
|
|
|
Post by hartnell on Apr 28, 2007 10:09:44 GMT -5
commodore 64 poking and peeking?
poke memory_location peek memory_location
so..
poke 1024, 1
would store 1 in the memory location numbered 1024
A = peek(1024)
would retrieve the data in memory location 1024
-- hartnell
|
|
|
Post by Guilect on Apr 29, 2007 17:14:58 GMT -5
Oh, well while not exactly the same verbage as the Commodore... B2D has memory peek and poke; its just undocumented. It was implemented by me to try to find a faster way to create a UDT rather than using Classes. Tests showed that Classes were just as fast.
Dim objstat Set objstat = UDT objstat.allocate 2 Const old = 2 objstat.poken old, 55
system.debugPrint objstat.peekn(old)
you can : allocate DeAllocate Peekb Peekl Peekn Peeks Pokeb Pokel Poken Pokes Size
(where b = byte, l = long, n = integer, and s = string)
here is another example where I needed to define a PixelFormatDescriptor.
Option explicit ' byte = 1, integer = 2, long = 4, string Dim PFD Set PFD = UDT
PFD.allocate 40 const nSize = 0 const nVersion = 2 const dwFlags = 4 const iPixelType = 8 const cColorBits = 9 const cRedBits = 10 const cRedShift = 11 const cGreenBits = 12 const cGreenShift = 13 const cBlueBits = 14 const cBlueShift = 15 const cAlphaBits = 16 const cAlphaShift = 17 const cAccumBits = 18 const cAccumRedBits = 19 const cAccumGreenBits = 20 const cAccumBlueBits = 21 const cAccumAlphaBits = 22 const cDepthBits = 23 const cStencilBits = 24 const cAuxBuffers = 25 const iLayerType = 26 const bReserved = 27 const dwLayerMask = 28 const dwVisibleMask = 32 const dwDamageMask = 36 system.DebugPrint PFD.size
|
|
|
Post by u9 on Apr 30, 2007 4:43:42 GMT -5
I was thinking more along the lines of the following commands: MapSetTileset( image ) - New image to use for tiles MapSetTileSize( width, height ) - size of each tile MapSetTile( x, y, tileValue ) - change tile at x,y to a specific tile. I can imagine this is the most important one MapGetTile( x, y ) - read tile at x,y MapSetAtt is already implemented MapSetSize( width, height ) - Set the size of the entire map (probably in num of tiles in each direction) and while we are doing so well there might as well be a MapSave( filename ) basically stuff like that. I have never used the tilemaps myself so i'm not the right man to ask. I am just thinking what might be useful for people who do use it. With the ability to set a given tile it can be animated We really shouldn't go poking in memory addresses, that is very low-level.
|
|
|
Post by ptrxyz on Apr 30, 2007 6:42:12 GMT -5
Oh yes, that would really be a nice! That would allow to create dynamicl maps for RPGs or something. the commands u2 suggests sound really good.
|
|