[suggestion] compare scale

Discussion and feedback on Construct 2

Post » Sat Feb 01, 2014 12:47 pm

@lennaert - that's not possible. The editor cannot possibly know if the object aspect ratio will change at runtime.
Scirra Founder
B
387
S
230
G
88
Posts: 24,251
Reputation: 192,464

Post » Sat Feb 01, 2014 2:47 pm

[[email protected]] lennaert - that's not possible. The editor cannot possibly know if the object aspect ratio will change at runtime.[/QUOTE]


At the moment the function is called to be applied at runtime, can it not check if the current objects ratio is different from the original? and depending on that apply or not ?


In the editor you might be able to apply the scale comparision, but if you tinkered with the individual width or height somewhere along the way, changing the ratio, it does not work at run time.

You could have a console error log indicating ratio difference, ommiting the comparison check, and for example always return 0 or false in this scenario.




Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,562

Post » Sat Feb 01, 2014 5:56 pm

I think one of the ideas for the foundation of C2 is that the tools be as intuitive as possible. Having things that sudden don't work isn't a good idea.

Though, one idea is to have another boolean for sprites for "Always maintain aspect ratio". But, it's easy enough to manually do that. Just like an easy way to know the individual scales is using something like what @jayderyu said.

Another idea, is that whenever your set scale for a sprite, then you can have an instance variable that keeps track of that scale. Thus a comparison can easily be done with that.
B
20
S
4
G
1
Posts: 185
Reputation: 2,563

Post » Sat Feb 01, 2014 6:02 pm

[[email protected]] I think one of the ideas for the foundation of C2 is that the tools be as intuitive as possible. Having things that sudden don't work isn't a good idea.[/QUOTE]

It wouldnt be sudden, as it would be in the manual, and in the webconsole.


[QUOTE=danialgoodwin]
Though, one idea is to have another boolean for sprites for "Always maintain aspect ratio". But, it's easy enough to manually do that.
[/QUOTE]

This would generate the same issue you pointed out, it suddenly wouldnt work ? (changing width or height)

[QUOTE=danialgoodwin]
Another idea, is that whenever your set scale for a sprite, then you can have an instance variable that keeps track of that scale. Thus a comparison can easily be done with that.[/QUOTE]

These would be off if you changed only width or height.
lennaert2014-02-01 18:05:21
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,562

Post » Sat Feb 01, 2014 6:29 pm

This is unnecessary it can already be done with events...

Place sprites you want to scale on a single layer, there is a compare layer scale condition...

As long as I can move left, right and fire, I'm Happy...
B
42
S
15
G
11
Posts: 655
Reputation: 12,260

Post » Sat Feb 01, 2014 7:05 pm

get object scale does indeed feel like its missing, and there's an incredibly easy and obvious solution to the issue Ashley raises:

GET OBJECT X SCALE
GET OBJECT Y SCALE

Most of the time, for most games objects are scaled uniformly in X and Y. Sacraficing the obviously useful and bizarely missing "get object scale" for the fact that people will scale x and y separately a minority of times seems very unnecessary to me.

If you offer get x scale and gex y scale then the user can use EITHER one arbritrarily to retrieve their objects scale if he always sues the "scale object" action...which most people would do for most cases.

Cheers,
Mike

@ Pixel perfick,
What you suggest is a very convoluted "solution" for a very simple problem, which would in most games be far more trouble than its worth, with terrible ramifications for z-order and so many other things.Brashmonkey2014-02-01 19:05:44
B
49
S
9
G
4
Posts: 425
Reputation: 7,037

Post » Sat Feb 01, 2014 7:15 pm

I would say convoluted is having two conditions for the same thing...

An objects size is it's scale, beyond 1:1 if you want to know an objects "scale" compare the scale of the layer it is on...

nothing to do with Z order...

There are enough confused souls on these forums, do we need more?Pixel perfick2014-02-01 19:28:37
As long as I can move left, right and fire, I'm Happy...
B
42
S
15
G
11
Posts: 655
Reputation: 12,260

Post » Sat Feb 01, 2014 8:34 pm

Lol, can't believe this thread is still going.

Its all pretty simple, if you want to scale an object you use a multiplier, 0.01 to 1 is equal or smaller, bigger than one is bigger than current size(IE 2 is twice size). If you need to keep track of what the current scale is... use a variable.

I dunno maybe some third party might make a behavior....
Image ImageImage
B
168
S
50
G
164
Posts: 8,236
Reputation: 105,591

Post » Sat Feb 01, 2014 9:07 pm

i dont know which idea is better i want only do that:
if scale of sprite is bigger than 1 -> every tick set sprite.scale -0.1
B
109
S
26
G
43
Posts: 1,883
Reputation: 33,655

Post » Sun Feb 02, 2014 12:47 pm

@ delgado,

You can use the formula current width/image width to get an objects scale...therefore, what you'd need to do is:
every tick:
IF (Sprite.Width/Sprite.ImageWidth))>1 THEN set scale to max((Sprite.Width/Sprite.ImageWidth)-0.1,1)

This scales the object back down to a scale of 1...the max part makes sure it can't scale smaller than 1 (100 percent scale)


@ Pixel perfick,

To clarify my points: (caps are for emphasis and not intended as rudeness or yelling.)

1) If you can set width, it stands to reason you can retrieve width..and you can. If you can set height, it stands to reason you can retrieve height...and you can. If you can set opacity, it stands to reason you can retrieve opacity...and you can. This is why retrieving scale seems missing...because you CAN set object scale but can NOT retrieve object scale (without jumping through a hoop and figuring out the formula I gave delgado above...or wasting time and variables to keep track of every sprites scale). My suggestion (retrieve objects x scale and retrieve objects y scale) resolves this issue perfectly, in the manner that any user would expect...there would be zero confusion.

2) Retrieve object X scale and Retrieve object Y scale would NOT be 2 conditions for the same thing, it would be two conditions for two separate things, which happen to be interchangeable IF the object's X and Y scale are always identical, which IS THE CASE if the user only uses the already existing feature to SET OBJECT SCALE...which many people do, and which is WHY this keeps coming up.

3) The fact that it can already be done in events has NOTHING to do with whether or not there should be a built in feature, or whether or not it seems missing based on all the other features that DO EXIST. (please realize all of the things mentioned in point 1 could be done with events, as could 90 percent or so of all the other built in features of C2)..do you concede therefore that this was a moot point?

4) People simply want to be able to check the scale of their objects (independently of each other and having NOTHING to do with the layer any given sprite might be on) relative to the original size of that objects images and relative to the action SET OBJECT SCALE which their game is using. This has nothing to do with the layer the object is on..at least not in any way remotely related to what people are asking for.

5) The layer sprites are on have a LOT to do with z-order, because if a sprite is on a back layer, it can never go over anything on a front layer and vice versa. This means, if you're using one or more layer specifically to control or retrieve the scale of certain sprites, then those Sprites in question are slaves to the z-order of the layer, relative to other layers and other sprites on different layers. This might impose a massive limit in Z-order control to the person making the game, as well as just being needlessly confusing.

6) Using layers to control or retrieve the scale of sprites (especially if you have countless sprites all scaling separately, as different rates, all at once, which is highly likely) is inherently convoluted because you are using one completely different thing to control or retrieve information for another thing. This is practically the definition of convoluted.

I must say I AM confused about your suggestion of using layers In order to help end my confusion, could you please make an example file that achieves delgado's goal using the method you suggested in your one sentence solution. Place sprites you want to scale on a single layer, there is a compare layer scale condition..............

Lets say there are 10 sprites, all which have been set to separate random scales using the set scale action...please show me how to check their current scales using this layer method you speak of.

Thanks,
Mike
Brashmonkey2014-02-02 12:54:45
B
49
S
9
G
4
Posts: 425
Reputation: 7,037

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 1 guest