User Tag List

Page 3 of 4 FirstFirst 1 2 3 4 LastLast
Results 21 to 30 of 37

Thread: Polygon-based A* Pathfinding Example (extensionless)

  1. #21
    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,651
    Mentioned
    34 Post(s)
    Tagged
    0 Thread(s)
    I found this suggestion on the forum. In order to change the angle back to a direction value divide it by 11.25

    ATan2(0 - moveY( "o_Player" ), moveX( "o_Player" )) / 11.25

    An idea would be to create an active (skin) to always follow the player and set its direction to the angle of the player /11.25

  2. #22
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLC

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,490
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MEHRDAD View Post
    1) How can use graphic left /right/up/.... for the player?
    2) Is it possible "turn before walking" too?
    1.) Aenever's suggestion will work here. There's no need for a separate "skin" or anything though - just replace the actions that set the object's angle, with actions to set the animation direction instead (using his formula).

    2.) It depends what you mean. You could easily make it so that when the player object gets to a waypoint it stops, gradually rotates to face the next waypoint, and then only starts moving again once it's facing the right way - but that would look a bit strange (okay for radio-controlled toy tanks, but not much else).

    You could also make it so that when the player object gets to a waypoint, it continues walking but only gradually turns to face the next waypoint - but this is way more complicated than it sounds.
    Imagine you click inside a polygon - the player object will walk right up to the wall and stop. Now, if you click somewhere else, the player object needs to turn on the spot before moving, or it will walk into the wall. Likewise if you click a target behind the player, that's also a case where they should turn before moving. The same thing would happen any time the player object doesn't turn tightly enough to avoid an obstacle. Most of the time though, you'd want the player to gradually turn at each waypoint, without stopping. You could also make it so the player object starts turning just before it reaches the next waypoint, but then it would start cutting corners.

    Ultimately, to get around these problems, you'd need to add collision detectors and all kinds of stuff that are way beyond the scope of this example (it would end up being 200+ events).

  3. #23
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleMac Export ModuleSWF Export ModuleXNA Export ModuleFirefly 3D Module
    MEHRDAD's Avatar
    Join Date
    Jan 2009
    Location
    Iran
    Posts
    504
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @MuddyMole @ aenever

    Sorry, I couldn't figure it out. Is it possible to a little mfa example? or other things?

  4. #24
    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,651
    Mentioned
    34 Post(s)
    Tagged
    0 Thread(s)
    Sure, no problem. The Deactivated lines set the player direction by angle, the near identical lines below the devactivated lines use the built in direction by dividing the angle value by 11.25

    Please note: I dropped the colours from 16 Million to 65536 to help compress the MFA to fit on the forums file limit of 1mb. You might want to cut and paste the code to the original pathfinding example.
    pp34 Dir instead of Angle.mfa

  5. #25
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleMac Export ModuleSWF Export ModuleXNA Export ModuleFirefly 3D Module
    MEHRDAD's Avatar
    Join Date
    Jan 2009
    Location
    Iran
    Posts
    504
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @aenever
    GREAT!!!. Much appreciated!!. works perfectly now.
    I only want a "turn before walking" system too. Do you have any suggestions? Of course, @MuddyMole explained but I don't understand right.

  6. #26
    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,651
    Mentioned
    34 Post(s)
    Tagged
    0 Thread(s)
    @MEHRDAD
    Can you provide a video example of what your after and perhaps some sprites? I kind of know what you mean yet I need a reference; then I'll see if I can implement it

  7. #27
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleMac Export ModuleSWF Export ModuleXNA Export ModuleFirefly 3D Module
    MEHRDAD's Avatar
    Join Date
    Jan 2009
    Location
    Iran
    Posts
    504
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK Sure. Please See "Broken Sword" Game. Character play a custom change direction If you click in other directions and after that start to walking to point.

    Please see in 40:27" and so on

    https://youtu.be/2bNTwBmZQ

  8. #28
    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,651
    Mentioned
    34 Post(s)
    Tagged
    0 Thread(s)
    I see, so the turn around animation is only used when changing from the opposite direction. I also note the turn around animation is only used in the traditional 4 directions from left to right & vice versa; and from top to bottom (even though this example looks like it's 8 directions, the turn around was only used for the 4 directions).

    Have I got it right? If so, I think I have an idea to implent it. It's more of an animation solution rather than embeding it into the pathfinding engine though.

  9. #29
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleMac Export ModuleSWF Export ModuleXNA Export ModuleFirefly 3D Module
    MEHRDAD's Avatar
    Join Date
    Jan 2009
    Location
    Iran
    Posts
    504
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK your right. But it use 8 directions for turning. I want for 8 too. Thanks so much!

  10. #30
    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,651
    Mentioned
    34 Post(s)
    Tagged
    0 Thread(s)
    I've got a concept happening. It works better for 4 Directions. I'm going to see if I can transfer my concept to the Pollypath example, it should end up being less complicated because there are no joystick presses just direction changes. I have concerns that it too may only work well in 4 directions, yet I'll share what ever I come up with. Maybe it will enourage someone else to come up with an even better solution for you.

    Turn Around 4 Dir.mfa

    Turn Around 8 Dir B.mfa

Page 3 of 4 FirstFirst 1 2 3 4 LastLast

Similar Threads

  1. New Pathfinding Example (extensionless)
    By MuddyMole in forum Fusion 2.5
    Replies: 28
    Last Post: 17th January 2022, 01:19 PM
  2. Easy Pathfinding Widget (extensionless)
    By schrodinger in forum Fusion 2.5
    Replies: 206
    Last Post: 31st December 2019, 04:22 AM
  3. Pathfinding using nodes of a polygon
    By voodooidiot in forum Fusion 2.5
    Replies: 4
    Last Post: 6th August 2018, 04:35 PM
  4. Polygon-based Shadowcaster
    By MuddyMole in forum File Archive
    Replies: 9
    Last Post: 31st October 2013, 01:41 PM
  5. Tree-Based Pathfinding Example (VERY basic WIP)
    By Dines in forum File Archive
    Replies: 15
    Last Post: 11th July 2007, 06:09 PM

Posting Permissions

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