Parenting objects to an active?

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Hey,

    Ive been trying to figure out if MMF2 has any type of parent/child system for objects like actives? I need to group a set of changeable graphics together so that they will move at exactly the same time, when in use with the 8 direction movement.

    I tried just setting the x, y position to a target but there is noticeable lag. I need timing to be exact.
    Ive heard of fastloops, it speeds the process up? I need something efficient enough for flash and mobile platforms. I not sure if fastloops will work properly on every platform...

    I need something like this because Im currently working on a new game and it will feature a customizable character. Things will be changeable like armor, clothing and hair style. When the character walks, I need the hair and clothing to move exactly with it.

    Is there a method to doing this that I might not be thinking of?

    Thanks

    Please login to see this link.

  • I'm pretty sure you could make a custom 8-directions movement to do it without the lag. Try searching "custom 8 directions movement" or something like that in the file archive to see what I mean, as I'm almost certain some people have done it before...

    My Please login to see this link. (which I actually use), my Please login to see this link. (which I mostly don't use), and my Please login to see this link. (which I don't use anymore pretty much at all really). If there are awards for "'highest number of long forum posts", then I'd have probably won at least 1 by now. XD

  • Normally you use a simple (invisible) box for any game mechanics, and place graphics on it once all movement is done.

    To achieve what you want to do, I suggest doing something like this:

    Use two variables (put in the player box), named "Xspeed" and "Yspeed".

    When "Right button is pressed": Set "Xspeed" to 1 (or whatever max speed you want for your character).
    When "Left button is pressed": Set "Xspeed" to -1 (same as above).
    When "Up button is pressed": Set "Yspeed to -1.
    When "Down button is pressed": Set "Yspeed to 1".

    Below these player input checks, you add two events:

    If "Xspeed"<>0: Start loop "Move player X" abs(Xspeed) times (in the loop, you want to move the player one pixel at a time. The number of times the loop is run is determined by the speed of the player).

    If "Yspeed"<>0: Start loop "Move player Y" abs(Yspeed) times

    After these two events you can handle the loops.

    On loop "Move player X": Set X position of Player box to (X position of Player box + (abs(Xspeed)/Xspeed))

    On loop "Move player Y": Set Y position of Player box to (Y position of Player box + (abs(Yspeed)/Yspeed))

    After these movements are done, you are free to put any graphics you like on top of the player object, making sure you alter the direction of the graphics depending on what way the player is facing.

    One important reason that using loops is a good idea, is that you can do pixel by pixel collision detection. All you need to do is add, for example:

    On loop "Move player X"+Player box is overlapping a backdrop: Set X position of Player box to (X position of Player box -(abs(Xspeed)/Xspeed))

    In the line above, when the player overlaps a backdrop, we push the player back one pixel relative to the direction he was heading, moving him out of the obstacle. A better solution for this might be using detectors to check for collisions, but this is a more advanced topic normally related to platform game engines. In your case, I believe the above solution might work.

  • In the past Ive tried making my own custom movement but got hung-up on collisions. Ive got an old project laying around somewhere, it was missing a line like this:
    "Set X position of Player box to (X position of Player box -(abs(Xspeed)/Xspeed))"
    and it was also missing "On Loop" conditions, the player object would always get stuck on backdrops.
    Probably the only thing that will use fastloops is my player object, so performance issues may not arise? Im going to test for each platform.
    Thanks for the explanation! Im going to try this out.

    Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!