|
-
May 24th, 2000, 11:02 AM
#1
Thread Starter
New Member
A greeting,
Well, im trying to make SimGame knockoff
I know how to find the coordinates of the mouse, but I need to know how to place an image where the mouse is when the user clicks on the form.
Im sure this is a pretty simple question, but any help will be greatly appreciated.
Thanks alot in advance
Xanth
-
May 24th, 2000, 06:56 PM
#2
Junior Member
form1_click()
x-mouse-coordinate (or what ever you called it)= image1.left
y-mouse-coordinate (or what ever you called it) = image1.top
end sub
Hope that helps
Please visit my website http://www.geocities.com/perfectlyperfect2000
For a Gamer, Programming is the Ultimate Game
-
May 24th, 2000, 09:54 PM
#3
PowerPoster
It's right the other way around:
-
May 24th, 2000, 10:09 PM
#4
Fanatic Member
It would be more "game-like" to use the center of the image as opposed to the corners:
Code:
Image1.Move X - (Image1.Width / 2), Y - (Image1.Height / 2)
r0ach™
Don't forget to rate the post
-
May 25th, 2000, 01:03 AM
#5
PowerPoster
I think that all is a bad idea to use real coordinates for a sim game... Would be much easier to handle if you use a 2D array, just think about drawing the houses (or whatever)... but however r0ach is right, better take the center
-
May 25th, 2000, 03:32 AM
#6
Thread Starter
New Member
Well, Im not sure about making a 2d array, im not really that advanced into VB yet, or I would give it a try
But, about the other things, i tried them all, and the image just kept jumping around in the upper left hand corner of the form, this is the code I have to get the mouse coords..
Option Explicit
Type POINTAPI 'Declare types
x As Long
y As Long
End Type
Declare Function GetCursorPos Lib "user32" _
(lpPoint As POINTAPI) As Long 'Declare API
Perhaps I need to do some math to the coords once I get them? Or would I need to use a different call?
Thanks for all of your help guys, I really appreciate it..
Xanth
-
May 25th, 2000, 03:43 AM
#7
-
May 25th, 2000, 03:44 AM
#8
PowerPoster
(or better take r0ach's code )
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
|