Results 1 to 4 of 4

Thread: Help with map editor (using Image Controls)

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2001
    Location
    Ohio
    Posts
    7

    Question Help with map editor (using Image Controls)

    Hello. This is my first post here on this forum.

    I'm not new to programming, but have finally started learning DirectX for VB.

    I could use some help with a simple map editor that I am making just to lay out tiles on a map. It is for an RPG that I am trying to make in the style of the original Zelda.

    I decided to represent each tile on the screen (16x11 Zelda size screens, tiles 32x32) with image controls for the map editor. (The game itself is DirectX.) Right now, I just have it so that you have to click each tile to assign an image to the tile. What I would like, is to be able to click on one tile, and while holding down the mouse button, assign that same image to each tile that the mouse moves over. I'm stumped as to how to accomplish this. I've tried using the MouseMove for the image control, but that doesn't seem to do it... maybe I'm just doing it wrong.


    This is the code segment for just clicking on a tile. (Tile is the name of the Image Control - which is a control array.) currentTile is declared as a Picture.

    Code:
    Private Sub Tile_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
      If Button = vbLeftButton Then 
        selectedTile = Index 'used for setting properties 
        Tile(Index).Picture = currentTile <----- This is the image assignment 
        TileInfo(Index).tilepic = currentTileImage 
      End If 
    End Sub

    I tried doing similar code in the MouseMove event for Tile (that I mentioned above didn't work).

    Any sugetions would be great. Let me know if I need to explain more.

    Thanks.

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    If it's a PictureBox then try using .Image instead of .Picture. If not, I'm not sure what's wrong with your code.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2001
    Location
    Ohio
    Posts
    7
    The code I have works just fine. I just want the interface to be more user friendly. They way I have it now is that you have to actually click on each individual tile to assign a graphic to it.

    The "tiles" that I'm refering to are a control array of Image controls.

    What I want to be able to do is essentially "paint" the the graphic to multiple "tiles" as long as the user still has the mouse button down. Like if you were using the StarCraft editor: you can hold the mouse button down and drag your water and crystals etc., instead of having to individually click the mouse button each time you want to lay down some grass (for example).


    The way my editor is layed out is a controll array of Image controls (named Tile, so that I have Tile(0-279). They are laid out in a 20x15 grid. And I have a seperate 'Toolbar' that contains all the graphic that can be assigned to a Tile. (I just changed this from the first post since I wanted a 640x480 res. and be able to keep the 32x32 pixel tile size.)

  4. #4
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Oregon
    Posts
    962
    I don't think you can do it with indivual image controls. Try making all the tiles images into picture boxs, and instead of an array of image boxes, use one picture box of the same size. The use bitblt to paste the image where you want it. You will also need a backbuffer (another picturebox the size of the tiles), and a draw loop. I belive fox has a tutorial on this. His website is: http://fox.acky.net/english/index.html
    Involved in: Sentience

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width