0 Favourites

[Suggestion] Expression for Layer Parallax?

  • Hi,

    Is there any expression that refers to the layers parallax?

    For storing a Layer's Parallax values in a variable?

  • 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?

    <img src="http://i.imgur.com/HoP5AVQ.png" border="0" />

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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?

  • 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.

  • 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.

  • 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

  • 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.

  • 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).

  • 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.

  • 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."

  • Oops, looks like the parallax expressions were missed by accident. I'll try to add them to the next build.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)