Results 1 to 8 of 8

Thread: New Sim-Like game

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    2

    Question

    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

  2. #2
    Junior Member
    Join Date
    Mar 2000
    Posts
    18
    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



  3. #3
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    It's right the other way around:
    Code:
    Image1.move x, y

  4. #4
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    Location
    South Africa
    Posts
    722
    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

  5. #5
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    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

  6. #6

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    2
    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

  7. #7
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    You're to experienced to see the simple functions

    Well, put my code into the Form_MouseDown event, them it will work

  8. #8
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    (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
  •  



Click Here to Expand Forum to Full Width