Mirror Pinned Image Randomly Stops Working

0 favourites
  • 5 posts
  • Hi Everyone,

    Youtube Video Showing Problem:

    Subscribe to Construct videos now

    CAPX file if needed for review: CAPX

    I'm having a problem with mirroring an enemy image. In the attached CAPX you will find that I am using the box technique on both the Player and the Enemies. Right now I am focusing on enemies and simple movement.

    When the enemies hit the edge mark, they start to go the opposite way and the image is mirrored. The enemy always goes the opposite way without any issue but the mirroring part seems to break sometimes. In the youtube video you'll see a highlighted/glowing (was using debugger) enemy that seems to not mirror itself until it reaches the middle of the level, but it is supposed to mirror itself immediately after changing directions. Only one is doing that though, the rest are mirroring properly.

    <img src="http://img823.imageshack.us/img823/3585/af27.png" border="0">

    I'm honestly stumped on this one because the issue does not happen all the time. To recreate the issue, open the CAPX and preview the game. Create a couple of enemies (press the space bar) and eventually one will break. If one does not break, reload the preview and try again. Try to create the third enemy maybe 5 seconds after the first two.

    One thing I did notice, it kind of looks like the broken ones end up mirroring when a specific other enemy hits the edge instead, is it possible that the instances got crossed somehow? It is weird though because the other enemy still mirrors properly itself, and when I check the debugger the IDs are all correct.

    Any help on figuring this out is appreciated. I'm sure it is something simple but I'm just not seeing it, especially since it only messes up sometimes instead of all the time.


  • <img src="smileys/smiley20.gif" border="0" align="middle" /> Got It

    I knew it was something simple. Just had to move two where the mirroring would occur, which of course is after the enemy hits the edge like I stated earlier <img src="smileys/smiley36.gif" border="0" align="middle" />

    <img src="http://img706.imageshack.us/img706/9169/f5db.png" border="0" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It would probably be a lot easier to use containers for this. Then the enemy-image would automatically be linked to the enemy.

    I'm not sure what is going wrong in your current code, but I would put the enemy-image actions in the on created event as subevents (not sure if it would make a difference, but it looks cleaner.

  • Ah yes, it's always good practice to look through your eventsheet and see if you are doing stuff every tick that only has to be done once and put it in or under an event triggered once.

  • Thanks for the advice LittleStain. I'll look into containers.

    For now, it works as intended so I am happy <img src="smileys/smiley1.gif" border="0" align="middle" />

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