[Suggestion] Expression for Layer Parallax?

Discussion and feedback on Construct 2

Post » Sun Aug 11, 2013 1:12 pm

Hi,

Is there any expression that refers to the layers parallax?

For storing a Layer's Parallax values in a variable?Xionor2013-08-11 21:45:47
B
10
S
3
Posts: 233
Reputation: 1,537

Post » Sun Aug 11, 2013 7:28 pm

This is kinda confusing.. isn't it better if you have a variable that sets the parallax, instead of the other way around?

Like this?
B
121
S
41
G
40
Posts: 841
Reputation: 27,857

Post » Sun Aug 11, 2013 9:38 pm

@andreyin That depends on what you're trying to do. For what I'm making I need to retrieve the Parallax value during the course of the game.


@Ashley

layer.parallaxX
layer.parallaxY

Both are Layer Properties available to the SDK here but aren't implemented inside Construct 2 itself. Can these be implemented somewhere down the road?Xionor2013-08-11 21:46:39
B
10
S
3
Posts: 233
Reputation: 1,537

Post » Sun Aug 11, 2013 10:33 pm

If you follow andreyin's idea, you can then retrieve the "varParallax" during the course of the game :P but yeah wouldn't hurt to have a "LayerParallax" expressions.
B
51
S
20
G
10
Posts: 571
Reputation: 9,819

Post » Sun Aug 11, 2013 11:19 pm

@Jase00

If you need to dynamically refer to different instances in different families, with different IIDs on different layers and dynamically change the properties of other such, properties according to layer parallax, andreyin's method just doesn't cut it.

One of the reasons being that you can't really connect that pre-set variable neither to the layer nor the objects in it as values.

Example:
Sprite.LayerNumber instantly gets you a layer number.

Set Layer Parallax(Sprite2.LayerNumber) to Layer(Sprite1.LayerNumber).ParallaxX,    would instantly set the Parallax of one Sprite to that of another.


With your method you first have to check which layer the first Sprite is on it is, and then match the layer number to the variable that contains the layer's parallax(more complicated than it sounds), then set Sprite2's Layer's parallax to that.

If you do this all the time eventually you just lose track of the whole process.


It just gets too complicated and gimmicky. Xionor2013-08-11 23:26:49
B
10
S
3
Posts: 233
Reputation: 1,537

Post » Sun Aug 11, 2013 11:30 pm

Hmm... Maybe I'm just completely missing the point but,

"and dynamically change the properties of other such, properties according to layer parallax,"

You'd just basically pretend that "VarParallax" IS "Layer.ParallaxX". Though I can tell you know what you're talking about so maybe I'm really missing the point lol.

If it's the case of that you have like 100 layers with individual parallaxes or something, then yeah this method would be pretty crap since it would take a long time to create individual variables for each Layers' Parallax. :P
B
51
S
20
G
10
Posts: 571
Reputation: 9,819

Post » Sun Aug 11, 2013 11:44 pm

@Jase00

The problem is you can't directly put VarParallax in an expression about the Sprite that's on the layer, without first doing other checks.

First you have to find which VarParallax the sprite's Layer is assigned to then use that hard-coded varaible in all operations further down the Sub-event chain. If you need to change to a diffferent layer's parallax a few Sub-events down you have to start all the way from the top again to select the proper layer.
Also if you need to check the variables of MULTIPLE layer's parallaxes, then you're in for quite a few lines of Events and actions just to figure it out.

Also in the event of 100 layers, not only does it take a while, it's also very difficult to manage.Xionor2013-08-11 23:47:37
B
10
S
3
Posts: 233
Reputation: 1,537

Post » Mon Aug 12, 2013 12:43 am

I still don't understand it, but it wouldn't hurt to have a Layer.ParallaxX and Layer.ParallaxY.

In any case, the free version doesn't allow that many layers (it only allows about 3 or 5 IIRC).
B
121
S
41
G
40
Posts: 841
Reputation: 27,857

Post » Mon Aug 12, 2013 10:39 am

Xionor what he was trying to say was, if you never use the manual setting, there is no need to check it.

If the setting started as a variable, all you have to do is check the variable.
B
222
S
59
G
32
Posts: 901
Reputation: 39,213

Post » Mon Aug 12, 2013 10:44 am

@Paradox

Quoting myself

"The problem is you can't directly put VarParallax in an expression about the Sprite that's on the layer, without first doing other checks.

First you have to find which VarParallax the sprite's Layer is assigned to then use that hard-coded varaible in all operations further down the Sub-event chain. If you need to change to a diffferent layer's parallax a few Sub-events down you have to start all the way from the top again to select the proper layer.
Also if you need to check the variables of MULTIPLE layer's parallaxes, then you're in for quite a few lines of Events and actions just to figure it out."
B
10
S
3
Posts: 233
Reputation: 1,537

Next

Return to Construct 2 General

Who is online

Users browsing this forum: Darknessed and 8 guests