How do I set the maximum width for a sprite?

Get help using Construct 2

Post » Wed Oct 07, 2015 5:41 pm

How do I set the maximum width for a sprite and maximum value for an instance variable?
Burry me with my empty hands sticking out the ground, so that all can see, that the one who had the world on his hands, died with them empty.
B
19
S
4
G
4
Posts: 133
Reputation: 3,070

Post » Wed Oct 07, 2015 5:59 pm

Would the clamp expression help?

clamp(x,lower,upper)
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Oct 07, 2015 6:55 pm

If I knew to implement that :) There's not many good tutorials for top down games.. I watched many, but they don't teach the stuff I really need so sry if im boring you :/
Burry me with my empty hands sticking out the ground, so that all can see, that the one who had the world on his hands, died with them empty.
B
19
S
4
G
4
Posts: 133
Reputation: 3,070

Post » Wed Oct 07, 2015 7:39 pm

It's an expression..

From the manual:

clamp(x, lower, upper)
Return lower if x is less than lower, upper if x is greater than upper, else return x.

System every tick
> sprite set width : clamp(self.width,10,200)

this way the width of the sprite can never be more than 200 or less than 10
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Oct 07, 2015 7:40 pm

Also a simple event like:

Sprite.width > 200
-- sprite set width : 200

Does the trick..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Oct 07, 2015 9:03 pm

Yeah I tried the simple way before I made this post, didnt work :P The every tick suggestion worked, ty
Burry me with my empty hands sticking out the ground, so that all can see, that the one who had the world on his hands, died with them empty.
B
19
S
4
G
4
Posts: 133
Reputation: 3,070


Return to How do I....?

Who is online

Users browsing this forum: tannerdler and 22 guests