Solved

Creating a Mapping Tool for a RPG Game

Posted on 2002-07-02
8
284 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
  • 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

827 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