Solved

Creating a Mapping Tool for a RPG Game

Posted on 2002-07-02
8
281 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

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…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

770 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