Results 1 to 6 of 6

Thread: Game: Shooting towards the mouse

  1. #1

    Thread Starter
    Lively Member feneck's Avatar
    Join Date
    Mar 2007
    Location
    Australia, Queensland, Gympie
    Posts
    85

    Talking Game: Shooting towards the mouse

    I'm making a pretty basic game, however:

    How do I make it so when I click, a line (the bullet) gets created on my ship and sent towards the position of the mouse when clicked (as in, I want it to go to were the mouse *was* at the time of the click, not follow the mouse around, lol)

    Thanks

    REMEMBER TO RATE

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Game: Shooting towards the mouse

    Moved To Games And Graphics Programming

  3. #3
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    280

    Re: Game: Shooting towards the mouse

    This should get you started.

    Clicky
    Slower than a crippled Vista
    More buggy than a fresh XP install
    Look! Down the road, some 50 miles behind the drunken snail.
    It's Ubuntu!

  4. #4

    Thread Starter
    Lively Member feneck's Avatar
    Join Date
    Mar 2007
    Location
    Australia, Queensland, Gympie
    Posts
    85

    Exclamation Re: Game: Shooting towards the mouse

    yes, i know how to detect all that (even tho I am working with VB6)

    What I want to do is, create the bullet were the player is (I can do this) and have the bullet move at a reasonable speed TOWARDS the mouses position?

    REMEMBER TO RATE

  5. #5
    Addicted Member Veritas2.0's Avatar
    Join Date
    May 2008
    Posts
    181

    Re: Game: Shooting towards the mouse

    Here is a super basic project to atleast give you an idea of what do to. It doesn't work great but it is a start in the right direction.
    You'll need to edit it heavily though as right now all it does is move in a diagonal based on the quadrant you clicked in relative to the green circle. Also when you move the green circle the "bullet" stops traveling.

    To get around the direction you would need to calculate the speed in both the x and y directions using the sin function.
    Attached Files Attached Files
    Simple little bugs 13 : Me 1

    Law of Bugs - That one bug you missed will be found almost immediately, by your customer.

    I wonder if anyone has ever asked for a User Surly interface?

  6. #6

    Thread Starter
    Lively Member feneck's Avatar
    Join Date
    Mar 2007
    Location
    Australia, Queensland, Gympie
    Posts
    85

    Re: Game: Shooting towards the mouse

    Wow. Thankyou very much Veritas2.0, very helpful ^.^ but still, i'm not sure if i want to do it this way. Anyone else have some other idea's?

    REMEMBER TO RATE

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