Mirror multiple objects?

  • Hi there!

    I want to mirror an object (an enemy) if player.x is less than enemy.x and not mirror if player.x is greater than enemy.x

    So far, no problem. If I have two enemies (same sprite) then it doesn't work so well so I was wondering if there's a way to only mirror/not mirror the enemy that is on-screen?

    Thanks in advance,

    Tommy

  • Well there is a condition 'is on screen' but the fix for this is usually to add a system 'for each enemy' so it checks each one.

  • Thank you for your reply but I have already tried the "On-screen" condition but it didn't work. I will try "for each" and see if I can figure it out. Thanks again :)

  • The order you do the check in will determine whether the correct enemies get picked.

    checking "player.x < enemy.x" will NOT pick enemies (it will pick player), so it will affect all enemies.

    so swap it around...

    "enemy.x < player.x" will pick all (and only) enemies with x less than player. in this case, no "for each" is required.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You are a hero! Your solution was so simple and it's works great...for the mirroring part.

    Now I have a problem with the bullets and the angle of motion.

    I have it like this now:

    On bullet created

    ...Enemy is mirrored -> Bullet Set angle of motion to 0 degrees

    ...Enemy is not mirrored -> Bullet Set angle of motion to 180 degrees

    If one of the enemies is mirrored but the other one is not, both bullets go in the same direction?

    Edit: I added the "Is on-screen" condition and now it works fine as long as the enemies aren't both on screen at the same time. It would be nice if they could be on screen at the same time but it's not necessary. Thanks again for the help, I really appreciate it :)

  • don't do it on bullet created - it wont remember which enemy spawned the bullet. do it when the enemy spawns the bullet so you can check right there whether the enemy is mirrored and set the angle appropriately

  • Awesome, it works great! I should have been able to figure that out myself but I didn't so I'm very grateful for your help :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)