0 Favourites

[suggestion] for variable

  • After working with C2 for a few months I find that I would love a default variable feature.

    As it is now when you create a new variable either as global/local/object you can only set a basic value(text/number/boolean). The suggestion is to allow for either reference to another variable or even a piece of code.

    I am not saying this a mandatory feature or must have, just an convience to reduce event's. As an example theory of use which I was thinking today.

    var highPoint = (layoutWidth / 2)

    in the moon bullet behaviour

    Moon.Bullet.gravity: (Moon.x < highPoint ? -20 : 20)

    the purpose of this is that even without doing an event the moon will rise when it's left of the layoutwidth and descend when it's on the right. This is just a simple theory sample. But it could lead to some more embeded results for variable.

    alternatively instead of js code, it could be linked to a function

    Moon.Bullet.gravity: celestialGravity

    Sun.Bullet.gravity: celestialGravity

    onFunction("celestialGavity")

    set return value = (Moon.x < highPoint ? -20 : 20)

  • So what you're asking for is the ability to use expressions in the objects parameters, rather than having to assign them at run time?

  • Love the suggestion! You can think of it as a virtual variable or a really simple getter.

  • So what you're asking for is the ability to use expressions in the objects parameters, rather than having to assign them at run time?

    Yes that sums it up. In some cases it would only be applied naturally on creation of object or start of layout. Other times like gravity on platform or bullets and so on it would be applied per render.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • This has already been on our todo list a while... hopefully we'll get round to it eventually.

  • oh well. that's just awesome :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
random bugs and suggestions
90 4,517
Tom's avatar
Tom Construct Team Founder
Unread hot topic
73 5,924
part12studios's avatar
part12studios
Unread hot topic
63 3,822
eli0s's avatar
eli0s