Tile Map Maker
Tile Map Maker
Tile Map Maker
Tile Map Maker
Tile Map Maker
Tile Map Maker Tile Map Maker Tile Map Maker Tile Map Maker Tile Map Maker Tile Map Maker Tile Map Maker Tile Map Maker
Tile Map Maker Tile Map Maker
Tile Map Maker
Go Back  Xtreme Visual Basic Talk > > > Tile Map Maker


Reply
 
Thread Tools Display Modes
  #1  
Old 05-29-2009, 09:30 PM
rambo123 rambo123 is offline
Newcomer
 
Join Date: Apr 2009
Posts: 6
Default Tile Map Maker


Hi all,

I am creating a simple tile based map maker to arrange 160 tiles into a 128 x 128 tile grid. Can I please have some advice or suggestions on the best possible method?

I have seen two examples:
1. Paints the tile grid (very quickly and smooth) onto the form but it's a lot of code without comments.

2. Paints the tile grid in a picture box using either PaintPicture or StretchBlt. Simple code, comments and zoom! The problem is that PaintPicture is slow but when zooming it displays the colours correctly where StretchBlt colours display wrong.


Final question, should I create my own or adapt the 2nd free source project to my needs? And if the latter any ideas how to fix the colour issue? I can provide links to both examples on request.


Advance Thanks for help.
Reply With Quote
  #2  
Old 05-30-2009, 12:05 AM
vb5prgrmrTile Map Maker vb5prgrmr is offline
Senior Contributor

* Expert *
 
Join Date: Mar 2009
Posts: 1,087
Default

You only found two? A quick search at yahoo and i found a half dozen!

Okay, so are building a background that is 128x128 image.(width/height) from a possible 160 different images (not saying that all 160 images could be used).

Well, however you do this it will eventually be up to you but I can suggest to speed up the rendering time of the 128x128 map. You should look into double buffereing, which is simply assembling your map in the background and then displaying it all at once.

Good Luck
Reply With Quote
  #3  
Old 05-30-2009, 07:58 AM
Flamespewer Flamespewer is offline
Freshman
 
Join Date: Sep 2008
Posts: 35
Default

i just recently did this for my mario game.
heres some pseudocode

First you want to make a .txt with the map as an array. then just read it in and according to the number pick the right tile from the tileset and put it into the MAP picture box in the right place. you only do this once.

from there you just bit blt from the MAP to the Form(or another picturebox)

you can also incorporate scrolling easily


Code:
Private Sub OPEN_FILE()
    Open FILE For Input As #2
        For i = 0 To screeny
            For k = 0 To screenX
                Input #2, MAP(i, k)
            Next k
        Next i
    Close #2
    Assemble_screen
End Sub

Code:
Private Sub Assemble_screen()
    For k = 1 To 30 ' the tiles that are possible.
        topval = ((Int((k - 1) / 25)) * 16) ' this just picks the right tile in my tileset
        leftval = (((k - 1) - ((topval / 16) * 25)) * 16) 'same with this
        For i = 0 To screeny
            For j = 0 To screenX
                Select Case MAP(i, j)
                    Case k
                        BitBlt MAP.hDC, (j * 16), (i * 16), 16, 16, Tileset.hDC, leftval, topval, vbSrcCopy 'bitblt onto screen
                End Select
            Next j
        Next i
    Next k
    Call draw_screenview
 End Sub

Code:
 Private Sub draw_screenview()
    Form1.Refresh 'refresh form
    BitBlt Form1.hDC, 0, 0, Form1.Width, Form1.Height, MAP.hDC, 0, 0, vbSrcCopy 'bitblt from Assembled map onto form.
End Sub
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Tile Map Maker
Tile Map Maker
Tile Map Maker Tile Map Maker
Tile Map Maker
Tile Map Maker
Tile Map Maker Tile Map Maker Tile Map Maker Tile Map Maker Tile Map Maker Tile Map Maker Tile Map Maker
Tile Map Maker
Tile Map Maker
 
Tile Map Maker
Tile Map Maker
 
-->