0 Favourites

[SUGGESTION]More data types for the variables

  • It would be great if you could add some possible data types for the variables. What I miss the most is:

    *Boolean

    *Object

    *One dimensional array

    [edit]

    * a variable that can store a reference to a sprite instance (I know this might be tricky)

    * the possibility to scope the variable for only the current event sheet (private, public)

    * A true composite object, like the movie clip in flash (tricky as well...)

    [/edit]

    Thank you!

  • You might find it advisable to read the manual. For instance, THIS SECTION deals with Boolean variables.

  • I've read it, boolean is not exposed in the event sheet interface. I know there is array and dictionary but I think it would be easier to just be able to create them as ordinary variables.

    Just my thoughts.

  • You might find it advisable to read the manual. For instance, THIS SECTION deals with Boolean variables.While boolean are available for instance variables, they are not for globals. And I really wonder why. I know it's not a big deal to use an integer instead, but it kinda makes you scratch your head why they are available in one case and not the other

  • agreed Global Booleans should be available

  • Not sure why we have booleans at all, really. Toggling seems to be their only use and you can do that with normal vars and a single event as well.

    Also a string can essentially be a 1-dimensional array.

  • For arrays you can pass them by there UID.

    Put all your arrays in a family and then pass the UID as a parameter. When your in the function pick the instance of the family by uniqueUID and fill in Function.Parameter(0), or whatever index it is, for the expression.

    *Edit

    Booleans are most used when returning True or False values. A global boolean wouldn't really be useful because it's not connected to anything.

    Example: "Is the character moving?" Return Boolean: True (yes) or False (no)

    If the boolean is global it is just floating out there by it self and referencing nothing.

  • I remember reading one of Ashley's comments saying that global booleans are on his todo list, so it's not off their radar.

  • Well, I think there is a big difference in using 1 and 0 instead of a boolean. By using the correct data type we have type safety which makes it impossible to use the boolean as anything else, e.g. assigning it a 2 by mistake. It gets a lot clearer for you or any of your colleagues what you are trying to do and you don't need to use hungarian notation to explain the purpose of the variable. Nice to read that they are planning it for the future.

    As with using strings like arrays, it's the same thing here. Also for an array you would want to pop, push and slice, and event though it already exists as an object I think it would be clearer and nicer to be able to declare it as a variable.

    Some other features I thought of:

    * a variable that can store a reference to a sprite (I know this might be tricky)

    * the possibility to scope the variable for only the current event sheet (private, public)

  • A slight workaround...

    In my projects I create two constant vars one called FALSE set to 0 and another called TRUE set to 1

    This means when I'm using global/local vars that technically are acting as Boolean values my code is easier to read and understand

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • You can store references to objects by storing a UID in a number variable.

    Put a data storage object like Array or Dictionary in a container with another object, and you also get a separate storage for each individual object. So you can get per-object multi-dimensional arrays this way.

  • You can store references to objects by storing a UID in a number variable.

    Put a data storage object like Array or Dictionary in a container with another object, and you also get a separate storage for each individual object. So you can get per-object multi-dimensional arrays this way.

    Wow, going to try that now :)

  • I agree with Jeansson.

    A variable that can hold an object could come in handy in different situations.

    Creating an object by UID is not possible as far as I know.

    A possible use case is what I'm trying to accomplish in my current project:

    I create 1 or multiple decks of cards, each card consists of a background, value, suit and face sprite.

    This reduces file size considerably and offers much more flexibility in animating etc.

    Now, I want the user to be able to choose different skins for the game. Instead of having to duplicate the function that creates the deck for each different skin, a variable referencing an object in the projectbar passed on to the function would do the trick.

    Being able to create an object dynamically by string/name or UID would make that possible too. But another variable type for e.g. sprite/audio etc would be the best and would open up many more possibilities.

  • A little thing in regards to this topic i wanted to request/say.

    Could we have local variables for event sheets, instead of just groups/separate events? I made a post about this here, but it appears that it got buried. Just wanted to hear your thoughts about this.

  • eh. Don't need Sheet Boolean.

    If( bool != 0) there you go. boolean check

    or

    if (bool == 0) just make sure your if check is explicit for 0.

    Though it is weird that it's not there.

    Scope. Create a Group for the Event sheet. Everything goes into the group including the variable. This of course is private. However if you need public it's the strict OOP design model then. use getters/setters to set the group vars.

    How about this suggestion. Baking in the Function plugin.

    Having to use Function.Call("function_name") is a pain.

    New variables are baked in to the drop down list and checked in the expression lines. Why can't Functions be built in :)

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