No "Check Scale" Condition

Discussion and feedback on Construct 2

Post » Mon Jun 16, 2014 10:34 pm

So I can set an object's scale, but then I can never reference it's object scale directly because there is neither a Condition nor an Expression for an object's scale.
it really seems like a simple enough thing to add an expression for (since you can set it, I'd assume half the code is already there anyway)
B
19
S
5
G
1
Posts: 96
Reputation: 2,710

Post » Mon Jun 16, 2014 10:39 pm

MadameBerry wrote:So I can set an object's scale, but then I can never reference it's object scale directly because there is neither a Condition nor an Expression for an object's scale.
it really seems like a simple enough thing to add an expression for (since you can set it, I'd assume half the code is already there anyway)


The problem is: when you change the aspect ratio, what that expression should return?

The correct way to do it in C2 is to set an instance variable to the value of the scale you want, then to scale the sprite to this value.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Mon Jun 16, 2014 10:41 pm

This question comes up from time to time. My counter question is: what should the scale return if the object is twice as wide but half as tall?
Scirra Founder
B
398
S
236
G
88
Posts: 24,441
Reputation: 194,671

Post » Mon Jun 16, 2014 11:45 pm

Ashley wrote:This question comes up from time to time. My counter question is: what should the scale return if the object is twice as wide but half as tall?


A single scale value would be impractical because as you point out, changing the objects proportions would completely mess up the scale, so...

How about having 2 scale values ?

In your example it could be something like:
X Scale = 2.0
Y Scale = 0.5

Is something like that viable?
B
28
S
3
G
1
Posts: 29
Reputation: 1,698

Post » Tue Jun 17, 2014 12:43 am

It just seems weird to me that you can WRITE to the scale, but can't READ it.
And the above solution seems viable.

Also @Aphrodite, that's what I ended up doing. It just seems like a needless workaround, much like the "fake global bool using 0/1 int" thing.
B
19
S
5
G
1
Posts: 96
Reputation: 2,710

Post » Tue Jun 17, 2014 10:53 am

Well, it's already very easy to get the scale on each axis, just divide the width/height by the original width/height.
Scirra Founder
B
398
S
236
G
88
Posts: 24,441
Reputation: 194,671


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 11 guests