Sprite height adjustment

Get help using Construct 2

Post » Fri Aug 01, 2014 4:20 am

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...
problem_code.jpg


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

Thanks in advance! :)
You do not have the required permissions to view the files attached to this post.
Be sure to check out my Metroidvania game, A Hole in the Earth
B
59
S
24
G
3
Posts: 359
Reputation: 5,683

Post » Fri Aug 01, 2014 4:34 am

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.
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Fri Aug 01, 2014 4:43 am

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.
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Fri Aug 01, 2014 9:36 am

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
B
6
S
1
Posts: 30
Reputation: 1,059

Post » Fri Aug 01, 2014 1:36 pm

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.
Be sure to check out my Metroidvania game, A Hole in the Earth
B
59
S
24
G
3
Posts: 359
Reputation: 5,683

Post » Sat Aug 02, 2014 11:14 pm

Yep! You guys were right!
The car sprite image point was one pixel off of the bottom. Works perfectly now. Thank you! :D
Be sure to check out my Metroidvania game, A Hole in the Earth
B
59
S
24
G
3
Posts: 359
Reputation: 5,683

Post » Sun Aug 03, 2014 1:52 am

You could alternatively use animation frames for the squashing
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Sun Aug 03, 2014 8:58 pm

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!
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Tue Aug 05, 2014 12:10 am

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. :)
Be sure to check out my Metroidvania game, A Hole in the Earth
B
59
S
24
G
3
Posts: 359
Reputation: 5,683


Return to How do I....?

Who is online

Users browsing this forum: Exabot [Bot] and 9 guests