Solved

Creating a Mapping Tool for a RPG Game

Posted on 2002-07-02
8
275 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now