User Tag List

Page 2 of 3 FirstFirst 1 2 3 LastLast
Results 11 to 20 of 22

Thread: Looking for Custom Alternative to 8 Direction Movement

  1. #11
    Clicker Fusion 2.5

    Join Date
    Sep 2006
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So I did this:

    X Pos = X Pos + (speed*Cos(angle))
    Y Pos = Y Pos - (speed*Sin(angle))

    Only, now the diagonals aren't working right. As in the speeds are different, or rather slower, somehow than traveling strictly horizontally or vertically.

  2. #12
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    You have to store your Xpos and Ypos as alt. values and operate sin-cos calculations on that,
    X and Y object's positions are pixel integers and won't work well with decimal operators (sin_cos)


    start of frame >>
    set Xpos_Val to X position
    set Ypos_Val to Y position

    on movement >>
    set Xpos_Val to Xpos_Val + (speed*Cos(angle))
    set Ypos_Val to Ypos_Val - (speed*Sin(angle))
    set X position to Xpos_Val
    set Yposition to Ypos_Val

  3. #13
    Clicker Fusion 2.5

    Join Date
    Sep 2006
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That actually worked out quite well!

    Now, however, the Move Safely thing gets stuck in walls, likely from attempting to read from X and Y values that have decimal points associated with them.

  4. #14
    Clicker Fusion 2.5

    Join Date
    Sep 2006
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Got it all to work perfectly now, though I'm scared to think of how multiple objects will work.

  5. #15
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    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)
    DaveC's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Australia
    Posts
    2,112
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    Move Safely has no issues with floating point movements, why would multiple objects be hard to implement? If you're storing the X/Y values in a value of the object you're moving, each object will be independent.

  6. #16
    Clicker Fusion 2.5

    Join Date
    Sep 2006
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's just that I'm going to be putting this to use in a game with some complicated movement and obstacle management. Move Safely crashes on me when I mess around with it, trying to understand how to put it to use, so it's just the daunting task I have ahead of me that I'm not so keenly looking forward to.

    I wonder if there's an example around that uses the object extensively so I can see how it works when it comes to needing to check for collisions on multiple things (walls, projectiles, other enemies, jump plates, etc).

  7. #17
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Tuna's Avatar
    Join Date
    Feb 2008
    Location
    Central Texas
    Posts
    1,853
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I'd like to see an extensive example of Move Safely as well...

    EDIT: actually, I think i realize now that this component doesn't MOVE the object, but only checks for collisions during a move...

  8. #18
    Clicker Fusion 2.5

    Join Date
    Sep 2006
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think it does that as well. I had tried something similar to it within code itself to try to keep collisions working right, where X and Y position were preserved while not overlapping an obstacle, and then an event further down where if the object was overlapping an obstacle, it'd set the X and Y positions back. Of course it didn't go as planned, which is why I'm looking into this object now. Problem is, I'd like to use it with objects that'd have a number of different movement types and collision circumstances, and I'm not sure where to place all of the events like Prepare, Commence, and Move out, because defined movement would be all over the place.

  9. #19
    Clicker Fusion 2.5

    Join Date
    Sep 2006
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Started implementing Move Safely little by little. It likes to crash a lot... And I'm not sure why.

  10. #20
    Clicker Fusion 2.5

    Join Date
    Sep 2006
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Now it's just getting aggravating. I have two objects now with the exact same collision code and very similar movement schemes. One works fine when hitting backdrops, and one does not. Yet both work perfectly fine when hitting obstacles that are Active Objects.

    Do I need a separate Move Safely 2 Object per player/ enemy?

Page 2 of 3 FirstFirst 1 2 3 LastLast

Similar Threads

  1. Replies: 3
    Last Post: 23rd June 2015, 03:47 PM
  2. Custom 8 direction movement, problems with speed
    By Shawn in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 8th November 2013, 02:49 PM
  3. Path movement alternative for simple obstacle
    By Atherton in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 21st July 2010, 01:06 PM
  4. Cos and Sin math problem (custom 8 direction)
    By Shawn in forum Multimedia Fusion 2 - Technical Support
    Replies: 19
    Last Post: 2nd April 2009, 12:55 PM
  5. Custom 8 Direction Movement
    By JL32BiT in forum File Archive
    Replies: 1
    Last Post: 2nd July 2006, 06:08 AM

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
  •