User Tag List

Results 1 to 3 of 3

Thread: How to get a sprite to face towards mouse pointer ?

  1. #1
    No Products Registered

    Join Date
    Jul 2014
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to get a sprite to face towards mouse pointer ?

    Hi, can anyone give some advice please on how to get a sprite (top down character shooting type game) to face towards the mouse pointer ? Ive created the gun sights/crosshairs, and have made these follow the mouse pointer using Always, Position, Xmouse etc. Character is set as 8 direction movement, how can I get it to face the direction of where the crosshairs are ?

  2. #2
    Clickteam Clickteam
    Olivier's Avatar
    Join Date
    Jun 2006
    Posts
    3,000
    Mentioned
    9 Post(s)
    Tagged
    1 Thread(s)
    You need to set the direction of your Player object to look at your Crosshair object. In the Event Editor under your Player Active object > Direction > Look in the direction of and then select your Crosshair object.
    Code:
    • Always
       - (Player) Look at (0,0) from (Crosshair)

  3. #3
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,310
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    It also depends on whether you made all the art for the player facing directions or want to rotate the sprite manually. Olivier's idea works only if you set different rotated images to the different directions of your sprite's animation. If you intend to just rotate the player, make an image that is facing right, put it in the "0" direction of the animation (that is the default direction). Now you would need to make some code like so:

    +Always
    -- Set Angle of Active to (ATan2(Y( "Active" ) - YMouse, XMouse - X( "Active" ) )) <---- (this is what you would put in the expression editor when it asks what angle to set)

    This is a great resource as well: http://www.create-games.com/article.asp?id=1898

    Good Luck,

    Reg

Similar Threads

  1. object following mouse pointer?
    By flyingpixel in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 21st September 2015, 09:09 PM
  2. Throwing with the mouse pointer
    By vergilkilla in forum Fusion 2.5
    Replies: 3
    Last Post: 10th May 2014, 01:10 PM
  3. Mouse Pointer & Mouse controlled obejct
    By danjo in forum Multimedia Fusion 2 - Technical Support
    Replies: 9
    Last Post: 28th April 2012, 12:17 AM
  4. Mouse Pointer
    By Crls in forum Multimedia Fusion 2 - Technical Support
    Replies: 12
    Last Post: 17th April 2010, 08:18 PM
  5. Mouse pointer help
    By Dynamite in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 27th February 2007, 08:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •