User Tag List

Results 1 to 7 of 7

Thread: Advanced moving platform techniques?

  1. #1
    Clicker Fusion 2.5 DeveloperSWF Export Module
    N64Mario's Avatar
    Join Date
    Nov 2008
    Location
    USA
    Posts
    1,306
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)

    Advanced moving platform techniques?

    I've seen examples and engines with moving platforms that JUST go left/right and up/down ONLY. But how to you code an ADVANCED moving platforms?
    I'm talking about moving platforms that have curves, move by looping around in circles, moving platforms that perform a figure 8 route. How would I be able to make the player stand on these kinds of moving platforms?

  2. #2
    Clicker Fusion 2.5 DeveloperSWF Export Module
    N64Mario's Avatar
    Join Date
    Nov 2008
    Location
    USA
    Posts
    1,306
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)

    Re: Advanced moving platform techniques?

    Sorry to bump this, but no one has an answer for this?

    Of the examples Ive seen, the left/right and up/down only platforms have 1 absolute value for X and Y movements. They only switch from positive to negative values when they either collide with backdrop, or with an invisible object to turn them around.

    In the examples, the code says 'Player: set X position of X("Player")+Alterable Value A("Platform")', set Y position of Y("Player")+Alterable Value B("Platform"). Where Alt.Value A would be Velocity X, and Value B being Velocity Y.
    But how would moving platforms work that have curves, can move in circles, star shapes, or figure 8, where velocities occur? Can moving platforms work if they use path movement, or another kind of movement other than 'static'?

  3. #3
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Advanced moving platform techniques?

    If you have a platform working with velocity X and Y, then the only thing that needs to be done to change the platform's paths is to manipulate those values over time to produce more complex paths. For platforms that follow curved paths, the Sin() and Cos() functions are generally used, as when run on increasing values they produce a "wave" of values from 1 to -1.

    So by constantly increasing a value somewhere (call it MoveValue), you can do the following:

    Always
    -> Set XVelocity("Platform") to Sin(MoveValue)*10
    -> Set YVelocity("Platform") to Cos(MoveValue)*10

    ...which I think (I'm just typing this out from memory) will make the platform move around in a smooth circle, because of the waves produced by Sin() and Cos() being half a step out from each other.

  4. #4
    Clicker Fusion 2.5 DeveloperSWF Export Module
    N64Mario's Avatar
    Join Date
    Nov 2008
    Location
    USA
    Posts
    1,306
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)

    Re: Advanced moving platform techniques?

    Okay, so out of curiosity, what would happen if I DON'T have velocity X and Velocity Y alterable values? What would work if the moving platforms use path movement, or other kind of movement? Examples being bouncing ball, mouse movement, etc.
    Would moving platforms still work then? Or would alterable values still be needed to position the player with the moving platform correctly?

  5. #5
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export Module
    Yima's Avatar
    Join Date
    Feb 2008
    Location
    Sweden
    Posts
    104
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Advanced moving platform techniques?

    I'll jump in and reply here as well. The problem with the kind of platforms you are describing, especially if you want the player to be standing on them properly, is that you have to know how they are moving.

    There are a couple of possible solutions, but none of them (as far as I know) involve any built in movement patterns - simply because you cannot reliably extract information about X and Y movement when you use bouncing balls or ready made paths.

    So, the first thing one needs to do is accept that whatever paths you are planning to use, you have to implement them the mathematical way. Also, it's a very good idea to use fastloops for this, for two reasons.

    The first is that you don't want the detectors for the player and the platform to accidentally move past each other - you really do need to check the collisions for each pixel moved (both when the playe moves, and when the platform moves).

    The second reason is one that I found out yesterday (I had been wrestling with this same problem for a while then, when DavidN kindly pushed me in the right direction). As DavidN correctly describes it, you can make a circle by using the method he presented.

    The problem is that for smaller resolution games (like my current project, that is 800x600 without scrolling), a multiplication of the sine and cos values by 10 results in a circle that is about as big as the game window.

    The solution is not to shrink the value you multiply with either, as if you do that to say 2 or 3, you end up with a very low resolution circle that moves in a octagonal pattern, making clearly defined turns.

    Here is where fastloops can be used to your advantage, but you have to take it one step further. The first thing to do is to add three alterable values to your advanced platform object - I call them Xres, Yres, and Maxres (where res stands for resolution).

    In the loop event that would normally move the platform either horizontally or vertically, you instead increase the Xres or the Yres value by one, until it reaches the value of Maxres. Once this happens, you reset the value that has reached the limit, and move the platform.

    This, depending on how high you set the Maxres value, will result in different sized circles (higher values on Maxres gives smaller circles, and vice versa).

    Moving on to how you handle the player position, I ended up with a arguably weird solution. Instead of trying to position your normal player object, the one that has all the "conflicting" physics that will make it want to fall through platforms or do other random things, you switch it out for a simpler version. This object know only how to move back and forward, and is told to stay firmly one player height above the platform.

    To solve the X movement of this object, you need to register how far from the left edge of the platform the player landed - I called this value CurrentX. Then, each time the platform moves, you set the players X position to the platforms X position + the value of CurrentX, and when the player walks left or right, you alter the value of CurrentX to reflect this movement. Switch back to the normal player object either if the player moves off the platform or the jump button is pressed.

    I'll admit that there are a lot of other things to consider here, such as where to place the different loop events to avoid weird problems. While I am a newbie when it comes to MMF2, I've learned both by myself and by learning from others that the program tends to act illogical at times, meaning that you have to spend adequate time developing workarounds.




  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,275
    Mentioned
    26 Post(s)
    Tagged
    0 Thread(s)

    Re: Advanced moving platform techniques?

    I may be way off here, but couldn't you just set a Flag to ON or set an alterable string to "OnPlatform" when you land on a moving platform and just make an extra check in your code? Making a whole new object to represent the player seems like a lot of work when you still probably want all the character's abilities anyway. I guess I am thinking of more complex games like Strider, so maybe you are thinking of using this in an uber simple platformer?

    Sorry to interrupt. ^_^'

    Mobichan

  7. #7
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export Module
    Yima's Avatar
    Join Date
    Feb 2008
    Location
    Sweden
    Posts
    104
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Advanced moving platform techniques?

    Quote Originally Posted by mobichan
    I may be way off here, but couldn't you just set a Flag to ON or set an alterable string to "OnPlatform" when you land on a moving platform and just make an extra check in your code? Making a whole new object to represent the player seems like a lot of work when you still probably want all the character's abilities anyway. I guess I am thinking of more complex games like Strider, so maybe you are thinking of using this in an uber simple platformer?

    Sorry to interrupt. ^_^'

    Mobichan
    I kinda like simplicity - especially when you are developing for a PC audience, of which the majority won't run off to buy a gamepad to manage a lot of complex moves. If you look at the game "I wanna be the guy", for example, you'll see that things can get "complex" enough even without advanced movement patterns.

    That being said, it's not much more work involved having two player objects, as long as you make sure to put them in the same group. Any fancy stuff, like shooting, kicking or doing anything else that can be done while standing still (if you start jumping you're off the platform anyway, and the problem is no problem anymore) by working with the group instead of the separate objects.

Similar Threads

  1. Advanced moving platforms in platform game
    By Yima in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 16th March 2016, 09:03 PM
  2. 2 Platform Movements overlapping on a moving platform
    By SuperDisk in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 1st July 2013, 11:20 PM
  3. Moving Platform in Platform Movement Object
    By radel999 in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 16th July 2012, 01:49 PM
  4. Advanced techniques in MMF2
    By SEELE in forum Articles
    Replies: 10
    Last Post: 14th May 2009, 03:04 PM
  5. Platform techniques help needed
    By guyme in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 25th July 2007, 04:06 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
  •