User Tag List

Results 1 to 5 of 5

Thread: Character bounces while looking at mouse cursor

  1. #1
    No Products Registered

    Join Date
    May 2016
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Character bounces while looking at mouse cursor

    I made a custom mouse cursor that is always set at the position of the mouse. My player character is set to always look in the direction of the mouse cursor. When standing still, everything is fine, and my character looks toward the mouse cursor. However, when moving (using 8 directional movement) there are some problems. If my character is moving in a direction opposite of the mouse cursor, it will bounce when I unpress the movement key. Also, if I put my mouse cursor at the edge of the screen and then move back and forth the character will move toward the cursor. I just want him to look at the cursor, not move toward it. It is for a shooter game.

  2. #2
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleFirefly 3D ModuleInstall Creator Pro
    aenever's Avatar
    Join Date
    Jun 2013
    Posts
    1,691
    Mentioned
    34 Post(s)
    Tagged
    0 Thread(s)
    Can you post a basic .mfa example?

  3. #3
    No Products Registered

    Join Date
    May 2016
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    File

    Here, use the arrow keys to move and alt+f4 to exit.

    MovementTest.mfa

  4. #4
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleFirefly 3D ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    chrilley's Avatar
    Join Date
    Jul 2006
    Posts
    1,020
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    What happens is that whenever you move the object its default 8-direction movement overrides the direction you set via events. Once you let go of the controls the object still has some speed that it gradually loses due to the de-acceleration value and since it is also always moving in its current direction it will home in on the target cursor. That makes it appears as if it is bouncing.

    There are various ways you can go about to avoid this. I've attached one solution that I like.

    Basically you split your player object into a collider(playerCollider) object and its visual representation(playerSprite) that is constantly placed at the collider's coordinates. The playerSprite doesn't take any controller input into account and will keep looking at the target cursor while remaining on-top of the player's position.
    Attached files Attached files

  5. #5
    No Products Registered

    Join Date
    May 2016
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This works perfectly! Thank you.

Similar Threads

  1. Mouse Control and mouse cursor
    By DEKE15 in forum Multimedia Fusion 2 - Technical Support
    Replies: 12
    Last Post: 4th December 2016, 10:38 PM
  2. Setting character to look at cursor whilst moving
    By Pen_Jones in forum Fusion 2.5
    Replies: 2
    Last Post: 3rd August 2016, 11:47 PM
  3. Set Hand Cursor on Character Image objects
    By AndyH in forum SWF/Flash Export Module Version 2.0
    Replies: 0
    Last Post: 13th October 2010, 03:29 PM
  4. edit box without mouse cursor
    By Shmuper in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 23rd April 2010, 04:35 AM
  5. mouse cursor
    By SpaceBuddy in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 8th April 2010, 10:41 PM

Tags for this Thread

Posting Permissions

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