Resize player and hitbox?

Get help using Construct 2

Post » Sat Nov 30, 2013 11:29 pm

Okay, so I have a couple power-ups here. One increases your size, the other decreases it. The problem I am running into is that the hitbox does not stay in the right position.

When the height increases, the hitbox ends up a foot too low. It's the right size, just it moves down, and I can't get it back up onto the player properly. So, he ends up standing a foot off the ground.

When the height decreases, the opposite happens. The hitbox ends up a foot too high, and he sinks in the ground.

I have the player pinned to the hitbox at the start of the layout.

I set the first power-up to increase scale when touched. It sets the scale of the player to 0.9 and the hitbox to 1.2. That makes them a little bigger and about the right size.

I set the other power-up to decrease the player's scale to 0.5, and the hitbox to 0.7. It makes them smaller, as it should.

How do I get the hitbox to be in the right position? I tried a few things with set position, pin and unpin, and whatnot, but nothing really made it move to the right position. It always ends up either a foot too high or too low.
B
79
S
30
G
35
Posts: 340
Reputation: 22,996

Post » Sat Nov 30, 2013 11:57 pm

Just did a quick demo, as long as your origin point for the pinning is at the bottom of both sprites, then it'll scale without embedding/floating into the scenery. :)
Image
B
27
S
9
G
5
Posts: 488
Reputation: 11,948

Post » Sun Dec 01, 2013 12:04 am

Capx

Download Capx

Demo

http://johnnysix.net/games/ScaleMe/JohnnySix2013-12-01 00:05:31
Image
B
27
S
9
G
5
Posts: 488
Reputation: 11,948

Post » Sun Dec 01, 2013 12:11 am

Thanks, I got it sorted! :)

I had to move the origin of the hitbox to the bottom-middle. Not sure what it was doing way up in the exact center. Usually I move them down.

I guess I moved the origin points for the player, but not the hitbox.

It's always the little things, lol.DrewMelton2013-12-01 00:14:18
B
79
S
30
G
35
Posts: 340
Reputation: 22,996


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, JackTYGA, MeteoorSC and 29 guests