User Tag List

Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 21

Thread: How do I change jump speed? - FastLoop Custom Platform Movement by DavidN

  1. #1
    Clicker Fusion 2.5 (Steam)HTML5 Export Module (Steam)

    Join Date
    May 2016
    Location
    Canada
    Posts
    106
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How do I change jump speed? - FastLoop Custom Platform Movement by DavidN

    Hello again everyone.

    I wanted to build my own platforming engine so I got started here:

    http://www.clickteam.com/clickteam-blog?p=custom-platform-movement


    Everything is going well, except I want to be able to change the speed of how fast the player moves in air when they jump and then fall.

    As of now, the player moves up 1 pixel at a time, and moves down 1 pixel at a time:

    On loop "Grav"
    "Grav_" of (player) < 0:
    - Set Y position of Player to Y of Player - 1

    On loop "Grav"
    "Grav_" of (player) > 0:
    - Set Y position of Player to Y of Player + 1


    The player moves up and down too fast, so I want make the player move up 0.5 pixels at a time, and move down 0.5 pixels at a time.

    How would I go about doing this?

  2. #2
    Clicker Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleInstall Creator ProUnicode Add-on
    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)

    Join Date
    Jul 2006
    Posts
    573
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    You could use an alterable value for the y position of the player. Then set the players y position to that value. You should also research into sub-pixel movement.

  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,267
    Mentioned
    26 Post(s)
    Tagged
    0 Thread(s)
    Danworth is correct. You need to reserve two of your alterable values and name them floatX and floatY. Instead of changing the object’s x and y position directly, you will be changing these alt vals and then setting the object position to the alt vals. This allows you to position things at decimal value positions. Fusion will automatically round the value to the whole number (since there is no such thing as a decimal position in screen coordinates) and position it properly.

  4. #4
    Clicker Fusion 2.5 (Steam)HTML5 Export Module (Steam)

    Join Date
    May 2016
    Location
    Canada
    Posts
    106
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright. I created a new test project and did exactly what you two said and managed to make an object move at a speed of 0.5 pixel every frame; perfect.

    I tried implementing the exact same method to my game.


    On loop "Grav"
    Grav_ of (player) > 0:
    - Set Y position of (player) to Y position of (player) + 1

    I modified it to now be

    On loop "Grav"
    Grav_ of (player) > 0:
    - Set floatY of (player) to floatY of (player) + 1


    I modified every event that directly moves the position of the player so that it would now modify the Alterable Values for floatX of (player) and floatY of (player).

    I'm currently only adding and subtracting (1) from the floatX of (player) and floatY of (player) just to see if I can replicate the physics as they were before I made the player's X and Y coordinates based off of the float values.

    Unfortunately, this results in the player moving like this:
    https://i.gyazo.com/0b4b1c73652d8f82...7cef54eafd.mp4

    As you can see, it's not moving like it did before I made the player's based off of Alterable Values:
    https://i.gyazo.com/0bc5e0c81ded7527...f5ca3e01f6.mp4


    Any ideas as to why this is happening? I'm willing to give out the .mfa file if that will help diagnose the issue.

    P.S. I made sure to set floatX to be the player's X coordinate and set floatY to be the player's Y coordinate, and made it always set the player's X position to floatX and the player's Y position to floatY.

    Thanks for the responses

  5. #5
    Clicker Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleInstall Creator ProUnicode Add-on
    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)

    Join Date
    Jul 2006
    Posts
    573
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    You'll need to set the position within the loop also. as within the loop will be faster than "always". so:

    On loop "Grav"
    Grav_ of (player) > 0:
    - Set floatY of (player) to floatY of (player) + 1
    - Set Y Position of player to floatY.

  6. #6
    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,267
    Mentioned
    26 Post(s)
    Tagged
    0 Thread(s)
    Also make sure you set your object's position initially as a float. I usually do it as "Set xFloat to X Position(active)*1.0" and "Set yFloat to Y Position(active)*1.0" This will initialize the objects with their correct starting position and also force Fusion to use float values. I tend to also add 1.0 instead of 1 to make sure floats are always being forced.

  7. #7
    Clicker Fusion 2.5 (Steam)HTML5 Export Module (Steam)

    Join Date
    May 2016
    Location
    Canada
    Posts
    106
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay so I just made the player's Y position get set to the floatY(player) during the "Grav" loop and did the same for the player's X position for the "Horiz" loop, and I added/subtracted 1 from the floatX and floatY value wherever the player object used to 1 added or subtracted from it's X or Y position.

    This is working better, only now my player object is a bit jittery while moving across a backdrop or active and it is now able to phase through backdrops and active objects that it used to not be able to go through:
    https://i.gyazo.com/bf6991f661221eef...9b1e782f44.mp4

    Any ideas on how to fix this one?

  8. #8
    Clicker Fusion 2.5 (Steam)HTML5 Export Module (Steam)

    Join Date
    May 2016
    Location
    Canada
    Posts
    106
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mobichan View Post
    Also make sure you set your object's position initially as a float. I usually do it as "Set xFloat to X Position(active)*1.0" and "Set yFloat to Y Position(active)*1.0" This will initialize the objects with their correct starting position and also force Fusion to use float values. I tend to also add 1.0 instead of 1 to make sure floats are always being forced.
    Ah good idea.

    I just implemented that now, thanks!

    I believe it is using floats now, still of course have the strange jittering and phasing going on as mentioned about.

  9. #9
    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,267
    Mentioned
    26 Post(s)
    Tagged
    0 Thread(s)
    You need to detect for overlaps within the fastloop. If you detect on, then you need to change your float in the opposite manner that you did to move it. So if you added a value to move, you need to subtract the same value. Or vice versa. Then stop the loop.

  10. #10
    Clicker Fusion 2.5 (Steam)HTML5 Export Module (Steam)

    Join Date
    May 2016
    Location
    Canada
    Posts
    106
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mobichan View Post
    You need to detect for overlaps within the fastloop. If you detect on, then you need to change your float in the opposite manner that you did to move it. So if you added a value to move, you need to subtract the same value. Or vice versa. Then stop the loop.
    Okay thanks. I have it so if it detects the player is overlapping a backdrop, it will subtract 1 from their floatY value. Which is the opposite of adding one to the floatY value, which I have done for when the player is falling down.

    I managed to fix the vertical jitter of the player while they're on a backdrop. Unfortunately, I changed one event and made a bunch of other changes that I undid so I can't remember how exactly I removed the vertical jittering. Now the only issues are the jittering still remains while on an active object (with the 'obstacle' qualifier) and I'm able to pass through any backdrop horizontally with ease:
    https://i.gyazo.com/e28cbff81fad29e9...1a08e7ffe7.mp4

    We're so close

Page 1 of 3 1 2 3 LastLast

Similar Threads

  1. DavidN's Custom Platform Movement jump
    By Emerson3 in forum Fusion 2.5
    Replies: 6
    Last Post: 3rd June 2015, 04:17 PM
  2. Trouble with DavidN's Fastloop Custom Platform Movement
    By TheFieryPlumber in forum Multimedia Fusion 2 - Technical Support
    Replies: 15
    Last Post: 27th June 2014, 01:04 PM
  3. DavidN's Fastloop custom movement question (horizontal speed)
    By Macaw in forum Multimedia Fusion 2 - Technical Support
    Replies: 14
    Last Post: 16th August 2013, 09:41 AM
  4. DavidN's Custom Platform Movement Help
    By SuperChiken in forum The Games Factory 2 - Technical Support
    Replies: 16
    Last Post: 7th August 2009, 08:06 PM
  5. DavidN custom platform movement
    By Zabooza in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 16th March 2009, 08:19 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
  •