How do I change sprite size based on position?

Get help using Construct 2

Post » Sat Feb 13, 2016 9:05 am

Message: Screampunk can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
capx: http://sta.sh/024ww4b75x9n

I'm trying to put together a 2D horror / adventure game.
The background is something simple I threw together in Photoshop.

I'd like the player to increase / decrease in size ever so slightly as they move up & down to simulate fake depth.
I'm not quite sure how, though. Can someone help me out please?
You could just have the standard "PlayerBox" change size; I imagine adding player sprites on with the same events wouldn't be that hard.
B
3
Posts: 6
Reputation: 189

Post » Sat Feb 13, 2016 6:08 pm

on up set size or set height, width
on down set size or set height, width
B
29
S
13
G
10
Posts: 355
Reputation: 8,312

Post » Sun Feb 14, 2016 12:15 am

Message: Screampunk can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Thanks for the response, but there's no "on up" or "on down" here.
This is all I have: http://sta.sh/025ilt1bcx6d
B
3
Posts: 6
Reputation: 189

Post » Sun Feb 14, 2016 3:09 am

they are actions of the event.
and you need to add controls or event that moves the object.
B
29
S
13
G
10
Posts: 355
Reputation: 8,312

Post » Sun Feb 14, 2016 4:04 am

I appreciate that, but it's not telling me anything.
B
3
Posts: 6
Reputation: 189

Post » Sun Feb 14, 2016 5:34 am

You could start with something like this:

Set scale to self.y

But that makes the scaling ridiculous. So we can reduce the effect

Set scale to self.y/500

That's better in that size difference from the top to the bottom is less drastic. But it's still not perfect since it's too small. You can fix that with an offset:

Set scale to self.y/500 +1

Now you can fine tune it by tweaking the values till you get a result you like.

Another way to do it would be to make the formula From two different scales at two different ys. Then just use some algebra to make an exact equation. You could also use lerp here as well.
B
85
S
27
G
84
Posts: 5,062
Reputation: 57,358


Return to How do I....?

Who is online

Users browsing this forum: KazaaMafia, Kenthria, QuantumMMX and 10 guests