|
-
Nov 15th, 2001, 11:50 PM
#1
Thread Starter
New Member
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.
-
Nov 16th, 2001, 08:24 AM
#2
Good Ol' Platypus
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)
-
Nov 16th, 2001, 09:38 AM
#3
Thread Starter
New Member
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.)
-
Nov 17th, 2001, 02:59 PM
#4
Fanatic Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|