Sprite height adjustment

0 favourites
  • 9 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.
  • Hi Everyone!

    I have been plugging away at my game and ran into an issue with resizing a sprite.

    What I am trying to achieve is to squish the sprite slightly when it hits the ground, then have it spring back to it's original size.

    It works for the most part, but sometimes it goes spastic and the height amount shrinks and grows several times rapidly.

    Here's what I have so far...

    [attachment=0:34fkm3wn][/attachment:34fkm3wn]

    Does anyone have any suggestions, or maybe even a different way of doing it.

    Thanks in advance!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I copied your code except I replaced the on platform landed with a mouse click for quick testing, and I can't get it to do anything spastic. just a simple shrink then grow back to size...

    so either it's something to do with landing on the platform or something else entirely..

    maybe as it's landing on the platform, it's setting bounce back to 1 a few times, which might cause the spastic thing to happen..

    sidenote: I don't believe the every tick events are necessary.

  • Messed with it a bit further.. It's definitely the platform thing.

    Try setting the image point on your car sprite to the very bottom.

  • The problem is....

    if u change height it "cuts" away a bit from top and bottom (of the sprite) so the sprite can fall again.

    Then bounce = 1 again.....

    So if u assign the Origin-ImagePoint to the bottom it only cuts away from top..... so it can NOT fall again...

    Like spacedoubt said

  • Thanks for the responses spacedoubt and Naxos84 !

    I will double check to make sure the image point is at the bottom. I'm pretty sure it is, but it may be 1 pixel off.

    Maybe I'll post the capx later, if I can't figure it out by tonight.

  • Yep! You guys were right!

    The car sprite image point was one pixel off of the bottom. Works perfectly now. Thank you!

  • You could alternatively use animation frames for the squashing

  • Personally, I would've probably used animation frames, but I found this way very interesting and it kind of opened my mind to some other ways of doing things!

  • Animation frames makes a lot more sense, but I have a whole bunch of image points for the car sprite that are in places that aren't in quick assign positions. So instead of calculating where they would all be positioned manually, based on the new sprite size, I figured resizing the sprite using events might be easier.

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