How do I Fix this sprite mirroring issue?

0 favourites
  • 8 posts
From the Asset Store
A set of 10 pixel art animated magic effects with icons. 2 Fire, 2 Earth, 2 Wind, 2 Water, Portal, Explosion.
  • I've experienced this problem while working on a personal project, but I recreated the problem In an example .capx. So I have a sprite that has the 8 direction behavior and it is set up so when I press the left arrow, it sets the sprite to mirrored and when I press the right arrow, it sets the sprite to not mirrored. Anyway, the problem is, when I hold left arrow and right arrow at the same time, it always sets itself to be mirrored no matter what order I press the keys in. I'll try to explain better what it's supposed to do, so if i'm holding down the right arrow to move right and I press the left arrow to stop the sprite it should stay un-mirrored, but if I do that it still sets it to be mirrored. Sorry if I'm hard to understand, it's like three am and I've been trying to fix this all night. I was hoping one of you knew how to help me with this, Thanks in advance <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile"> https://www.dropbox.com/s/e3dvsd8eauafb ... .capx?dl=0

    Edit: Fixed!

  • hi, can u please upload the file on sendspace, not on dropbox because there is a problem in downloading the file on dropbox

  • Cam112549 - yeah, dropbox seems to be having trouble right now.

    Doesn't 8 direction already take care of mirroring? I don't think you have to manually do that...

    There could be a number of things going on: if your code checks for the right arrow first, then the left arrow, then if both keys are down, the left arrow will be processed last, so your sprite will end up mirrored. So, checking left first may improve things - but then you would have the same issue going the other direction.

    when your sprite is moving right, its 8direction.vectorX will be poitive. So you could set your sprite to mirrored only when both the left arrow is down and the 8direction.vectorX is negative. That way pressing left arrow to stop the motion wont make your sprite mirrored until it actually starts moving to the left.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • yea AllanR is right cuz the 8 directions behavior does the mirroring automatically and u can make the following if u dont want the sprite to be left or right, u can make this...

    condition : 1.left arrow is down

    2.right arrow is down

    action : set animation to ur animation that is not pointing in any direction

    ... i hope u send a example for what is happening with u.

  • I recreated the bug again using the platform behavior, seeing as it doesn't mirror automatically, but it still does it. Here's the sendspace link: https://www.sendspace.com/file/tq6rgw

    Edit: Fixed!

  • AllanR I fixed it thanks to your help. I compared vectorx to see if it was positive or negative and it works! Thank you so much

  • yea, now i understand the bug correctly, i didnt understand it until u linked the project example

  • and btw i didn't told u to make a platformer behavior man ! XD U just have to do it in the 8 directions behavior

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