Linear Ping Pong Tween to Scale "0", Sometimes Flips Sprite Object?

0 favourites
  • 3 posts
From the Asset Store
Goodbye to sprite fonts, when you have something new on the anvil for your upcoming Games !
  • This isn't really a "How To", so I figured I would create a thread here. Purely out of curiosity, as I've already gotten the issue sorted out.

    I'm working on a teleportation system today. Where the player jumps into a teleporter sprite, shrinks in size(using tween), teleports to another teleporter sprite, then goes back to normal size(finishing the tween).

    Originally I was doing a Linear Tween with Ping Pong enabled, and setting the Scale down to "0 x 0". Half way through the tween, the Player is set to the position of another teleporter, then the tween goes back to it's normal size using the ping pong effect. While using a scale of 0 x 0, it had an odd effect of sometimes flipping the sprite object upside down. But, the second I changed the scale to an incredibly small value, "0.001 x 0.001" it works fine. I thoroughly tested it with the small value, rather than 0, and everything seems perfect now.

    After the teleportation happens, the PlayerBox(collision box for the Player Sprite Object) uses the Move To behavior to be be pushed up and to the right of the teleporter sprite. All of that worked fine the entire time. Next I'm adding in a check to see whether the player enters the original teleporter mirrored or not. Then, make it so the PlayerBox is pushed up and to the left of the teleporter if it's mirrored on entry.

    I'm just really curious as to why a scale of 0 x 0 sometimes flipped the sprite upside down. Then after enough teleportation events took place, it would eventually flip itself right-side up. It seemed to happen very randomly, and no set count of teleports to flip. I've uploaded a small screenshot below, to show what I've got so far. Which is currently working as intended.

    Again, this is just out of curiosity. I just found it sort of strange. For some reason, a part of my mind decided to try a very small scale rather than 0 x 0. Thinking that having the sprite disappear entirely was for some reason causing the flipping action to happen. (0.o)

  • I'm pretty sure I've seen several bugs that happen when scaling something to exactly 0. My only guess is it's possibly a floating point error and the sprite actually ends up scaling to -0.00000000017 or something, flipping/mirroring it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm pretty sure I've seen several bugs that happen when scaling something to exactly 0. My only guess is it's possibly a floating point error and the sprite actually ends up scaling to -0.00000000017 or something, flipping/mirroring it.

    Ahh, okay. That makes sense now that you've mentioned it. Thanks for your input :)

    I'm making a mental note, to never scale any object down to absolute 0 x 0 moving forward. I was playing around with it for about 15-20min, thinking *This is odd.. What the heck.. 0.o*

    It was fun to watch it running along the bottom of the platforms for a bit here and there though. Felt like gravity was reversed, and yet not at the same time.

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