Allocating "shadows" to every enemy, and positioning them by enemy feet

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 all,

    Hope someone can help me with a techie question:
    I'm working on making a Streets of Rage - style beat 'em up, and I'm trying to give every enemy a "shadow" - i.e. a little black oval by their feet. When they get knocked over or thrown by the player (so they're in mid-air), the "shadow" becomes visible - and then it disappears when they hit the ground again. (It's a nice way to help players tell what Y-coordinate each enemy is on, even if they're in mid-air at the time.)

    I've managed to code it so that as soon as an enemy spawns,

    - the system randomly generates a unique ID number for them, and stores it in alterable value I
    - the system creates a "shadow" active object (a little black oval) at the exact same X and Y coordinate as the enemy
    - the "shadow"'s alterable value I gets set to the same thing as the value I of the enemy at that particular X and Y coordinate.

    So, that seems a good start; for every enemy there's a shadow with a matching "primary key" in alt value I, which I'd hoped I could use to pair them together. But, I can't get it to work. I tried to do an event like:

    IF "shadow" alt value I = "enemy" alt value I, THEN set "shadow" X and Y = "enemy" X and Y

    ...and it didn't work. When I tried this with multiple enemies on screen, all the shadows got attached to just one single enemy (so it looked like there was one guy with one really thick shadow, and several other guys without a shadow at all).

    I also tried this kind of thing:

    IF "shadow" alt value I = "enemy" alt value I
    AND "shadow" is overlapping "enemy"
    THEN set "shadow" X and Y = "enemy" X and Y

    ...but this didn't work either.


    I'm 100% certain that all the "assigning unique value I" stuff works. (I was able to confirm that by creating a couple of counters, then adding events to say "if mouse hovers over enemy, set counter 1 to enemy's alt val I ; if mouse hovers over shadow, set counter 2 to shadow's alt val I".) It's just this last step of getting the shadow's position to be set to that of the enemy with the same I value where I'm getting stuck.

    There's gotta be someone else out there who's ran into this problem before; can you point me in the right direction?

    Thanks in advance

  • It sounds like you're thinking too complex. If you truly ONLY want shadows that appear when a character or enemy is on the ground and disappear when said character or enemy is in the air then you don't need to use any unique IDs.

    Fusion automatically pairs objects. I've made the simplest example that I can think of. Click on the objects to make them "jump." You can most likely also get away with creating shadows on the fly instead of having to have 1 shadow for each enemy in the level editor.

    The only downside is that you need to create a system for removing the shadow once said enemy is dead. If the enemies "fade" away or disappear like they do in typical beatemups I recommend NOT destroying the enemy once it becomes "invisible." Instead move the enemy into an area outside of the level. Once the enemy is in said area destroy it then. The shadow will follow so make sure you also destroy any shadows that are also in this "kill" zone.

  • Fusion automatically pairs objects that are created together. If an enemy is destroyed then you can just say - destroy shadow - and Fusion will destroy the paired shadow.

    But you can also tie the shadow to the direction or animation - depends on what movement you're using - for example,

    * Start of Frame
    New Objects : Create Enemy at (135,365) layer 1
    New Objects : Create Shadow at (0,16) from Enemy


    * Start of Frame
    New Objects : Create Enemy at (515,210) layer 1
    New Objects : Create Shadow at (0,16) from Enemy


    * Always
    Shadow : Set position at (0,17) from Enemy


    * Enemy is facing a direction left or right
    Shadow : Reappear


    * Enemy is facing a direction up or down
    Shadow : Make invisible

    Casual games: Please login to see this link.

  • If you haven't already, check out my beat em up engine on the clickstore (
    Please login to see this link.

    Check out the video:
    Please login to see this link.

    As you can see I had the shadows move with the enemies as they fell or were thrown instead of vanishing. As mentioned above, events are paired so you can really simplify things and not have to worry about giving them ID's.
    As such you could choose to make them invisible or have them shrink in size or transparency.

    Please login to see this link.

Participate now!

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