Platform game - Doubt over several enemies

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.
  • Hello everyone! I would like to ask your help. I'm having problems when I need to deal with multiple enemies in my platform game. For example, when I have 10 enemies distributed across the level, it seems that one of them ends up influencing others. The biggest problem is in gravity: only one enemy moves correctly, the others end up exhibiting a bizarre movement. I'd like to know, then, how developers using CF2.5 can build platform games with multiple enemies that behave so well. I believe that they use ForEach loops, but I can not succeed with them :( I can not see how I make a ForEach loop to call other loops to deal with the gravity of multiple enemies.

    So... I really need help. I would be very grateful if any of you could give me a hand in this difficulty.


    Best regards,
    Leonardo


    EDIT: Sorry for my poor english... Portuguese is my native language.

    Tap And Go! released on Google Play Please login to see this link.

    Edited 2 times, last by Ls2 (May 31, 2017 at 1:21 PM).

  • Hey Ls2! I know exactly what you're saying and struggled in the beginning with that same problem. I whipped up a quick example for you to look at using the ForEach object. make sure you have it from the download manager otherwise, I don't think this will open.

    The example is really generic with just some balls bouncing up and down using gravity fastloops and the ForEach object so they can all bounce correctly without affecting each other. I wish I could explain things in more detail but sometimes I don't even always know "how" things work, but that they just do lol. Hope this helps you though. :)

  • Here is an example of making enemies move with for each loops and platform movement object: Please login to see this attachment.

    My example here shows how each individual object can get a platform movement object and make it act individually. It also shows how you can link two objects together by writing a fixed value of an object into an alterable value. Then scoping them out with "Alt value = Fixed value" or "Fixed value = alt value" to scope the "child" (who has fixed value of object written inside it) or the "parent" (Who has its fixed value written somewhere else) respectively. Note: those two conditions given AREN'T "Compare two general values"

    For having fast loops inside for each loops, you can insert a "On each one of this object" below a "On loop" condition, though that fast loop will need to be ran inside the for each loop. If you have a fast loop that calls a for each loop inside, then a regular "On for each of object" alone will do the trick (You can still call LoopIndex("LoopName") inside the for each loop).

    - BartekB

    Join the Click Converse Discord! - Please login to see this link.

  • Thank you render8 and BartekB. Your examples are really helpful for me!

    render8
    the example is well documented! But I couldn't understant this condition:
    Pick object with fixed value = LoopFV(For Each, "gravity")... What does this mean?
    BartekB
    Amazing example! I'm amazed with the solution to detect ground limits! If I understood correctly, after the start, there will be one PMO for each square, right? If my playable charactere uses PMO too, should I use:

    PMO of ("Playable") = Fixed ("PMO")

    in each event that controls my character? PMO monstrously simplify the object's behaviour handling! I'm amazed, really. Did you already used this in some game that you developed? Is there a performance decrease when a big number of PMO runs at the same time?


    I'm really thankful for these examples!

    Tap And Go! released on Google Play Please login to see this link.

  • Yes, all enemies/squares will have an individual PMO.

    In the condition:
    Please login to see this picture.

    The first object is what you're picking, and the second object is the object you already have picked (Have one of, either in for each loop or a special event.)

    This is because Fusion only scopes the object that you click on in this window:
    Please login to see this picture.

    So for your example, if you have player in a for each loop, you'd use Fixed value of PMO equals PMO("Player") (Note: You only need this if you need to communicate between player and PMO)
    You won't need this if you have one player and one PMO specific for the player movement.

    I have used this for my game/s for a while, however I ditched PMO cause it isn't good with multiplayer (can't force position of things/gets buggy), so I use the same method for NPCs and "PMO"s written in events which works practically the same way. There isn't any performance issues atm.

    - BartekB

    Join the Click Converse Discord! - Please login to see this link.

Participate now!

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