Solved

Creating a Mapping Tool for a RPG Game

Posted on 2002-07-02
8
288 Views
Last Modified: 2010-05-02
I have written the RPG Game but want the user to be able to map his journey on the way.
I have a toolbar which contains various images i.e. Small Room, Monster, Sword etc. and I want the user to be able to double click one or drag/drop and then be able to position it on a picture box or an appropriate container.

I haven't got a clue about how to approach this so any ideas, however small will be appreciated.

Andy.
0
Comment
Question by:HelpAndy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 8

Expert Comment

by:glass_cookie
ID: 7125631
Hi!

Regarding the double clicking, you could use this code to determine the position on the map that's clicked:

Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
MsgBox X, Y
End Sub

or, if you do not mind your program processing a little more, do this:

Dim X1 As Integer, Y1 As Integer

Private Sub Picture1_DblClick()
MsgBox X1 & ", " & Y1
End Sub

Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
X1 = X
Y1 = Y
End Sub


As for the saving of the map part of your program, you could do something like save all the positions in some format like this:

Sword 345,675
Monster 346,678
Monster 2865,293

while you loop through the saved file, you could then load the pictures in the form of an array : )

That's it!

glass cookie : )
0
 

Expert Comment

by:carlosferreira
ID: 7125697
Hi -

I don't really have an answer mainly because I'm not sure if you are envisioning as an interface.  I came across and interesting vb project which does critical path analysis.  In essence what it does is creates a graph on the form which icons placed where you specify it to be (right click on form - select node).  The graph can be saved and retrieved in xml format.  I thought it was a brillant way of allowing someone to visually draw something on a blank form.  It would probably be worthwhile to go thru the project to see how it is implemented.  It was originally presented in a project for VBPJ and the link of the article can be found here:

http://www.devx.com/upload/free/features/vbpj/2000/11nov00/ja0011/ja0011.asp

The actual code can acutally be downloaded here:

http://www.joyofvb.com/Downloads/Implementation%20Workshop/CPA.zip

I haven't actually read the article but the code is a good study.

I hope this helps.

Carlos
0
 

Author Comment

by:HelpAndy
ID: 7126336
Thanks for the input guys!

I had a thought last night that when you paste an image in MS Paint you can then position it within the overall picture.
I wonder if this is done via obtaining the windows handle of what you have pasted allowing you to move it around before deciding on the exact position.
Is this done via the API ?
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 8

Accepted Solution

by:
glass_cookie earned 100 total points
ID: 7128936
Hi!

I'm not very sure how it's done, but another alternative is to move a picture box around the form by draging it.

I saw it in a book that I borrowed from the library some years ago but I forgot about it :|

Let me look for it...


OK found it:

Download...
http://www.vb-helper.com/HowTo/dragpic4.zip
Description: Drag a PictureBox (2K)

That's it!

glass cookie : )
0
 

Author Comment

by:HelpAndy
ID: 7129300
Glass Cookie, you are a Diamond!
0
 
LVL 8

Expert Comment

by:glass_cookie
ID: 7129591
Thanks for the points, and your last comment : )

Thank you : )
0
 

Author Comment

by:HelpAndy
ID: 7129717
I see you live in Singapore.
I almost made it there but got ill.
I worked in Hong Kong for a while and love your part of the world.
0
 
LVL 8

Expert Comment

by:glass_cookie
ID: 7130858
Hi!

I've been to Hong Kong too quite a few times : )  You've got great food in Hong Kong ; )

Hope you'll like it the next time you come to Singapore : )

That's it!

glass cookie : )
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question