Declaring Variables in Script

0 favourites
  • 2 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • I've been trying to create a system for reading and writing variables through expressions (i.e. a function to evaluate an expression like "Var1 == 0 & Var2 = 1" and similar functions to change/add/subtract variables). For a while, I've been assuming the best way to do this is to declare the variables in the Event Sheet as normal, then interact with them through code but it occurred to me after another readthrough of the (brilliant) scripting documentation that I could just declare the variables in script (let Var1 = 1, etc.) and avoid the awkwardness of Event Sheet/Javascript cross-communication altogether.

    I'm still not completely confident with Javascript and would still keep the majority of the project in visual code. With that in mind, are there any particular pitfalls or dangers to handling most of my variables in javascript?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's hard to comment without knowing more about what you're trying to do. In general, in software there are often several ways to achieve something, and the best way depends on your goals. However if you're comfortable with it and it works for you, it's probably not a bad option.

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