How do I mirror a sprite with touch controls?

0 favourites
  • 6 posts
From the Asset Store
Supports keyboard, mouse and gamepads. Supports several gamepads at once.
  • Hi, I'm making a game with touch controls, but only in the X axis. I'm using the DragDrop for the character behavior. Now, my problem is this: I want the sprite to get mirrored to the left if it is dragged and moved to that side, and not mirrored if it's not. Basically...what it is always done with left and right arrows if the game is a platformer. I tried almost everything, but didn't manage to do it. Any help is appreciated in advance ^^

  • on start of drag set original X position to a variable. then check current x position to that variable. if < then mirror, if > not mirror

  • It's ALMOST there, but I believe I like how it turned out!!! I mean...the character gets mirrored only when it comes across the original position, and I wanted it to get mirrored anytime I move to a direction (left or right). Aaaaaaaanyways, as I staded before, I kinda like the outcome nonetheless. Thanks man!!!

  • Ah, sos de Perú!! Hablás español entonces ^^ Sentite libre de comentarme en este idioma. Yo soy de Uruguay ^^ ^^ ^^

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • hay otra opción pero tendrías que calcular la posición del sprite en todo momento. elimina lo anterior y crea una variable "xprevia" luego cada 0.001 segundo cambias la variable al valor actual de X. después, si x actual es menor a xprevia, mirrored. si x actual es mayor a xprevia, not mirrored

  • No me anduvo así. Igual, como te dije, la manera anterior está bien Gracias!

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