How to assign a boolean parameter of a function to a boolean instance variable of a sprite ?

Not favoritedFavorited Favorited 0 favourites
  • 4 posts
From the Asset Store
Cute cartoon girl character with Walk, Jump, and Idle animations for 2D games.
  • Dear all,

    I have a function named "createTank" in Construct 3 wich accepts integers and booleans as parameters: posX:int, posY:int, isPlayer:bool, justCreated:bool.

    With this function I create an object at posX and posY using the given parameters: createTank.posX and createTank.posY.

    Now, to the just created sprite I would like to set its boolean variable "justCreated" by passing the value from the function, but when I select in the sprite action menu the action "set boolean", I can only choose true or false from the top down menu. I don't find a way to set the sprite boolean instance variable with createTank.justCreated on that panel.

    I have circumnavigated the "problem" by using "System" and check if the boolean value of the function parameter is true, and set the sprite boolean inst. variable accordingly.

    The question: am I doing something wrong here ? Is there another direct way to use that function parameter to set a boolean sprite variable ?

    I've read also from a c3 blogger that he suggests to avoid the use of booleans in C3, and use integer insteads. But I find the use of booleans also helpful, that's why I would like to use it.

    Thanks for your attention and have a nice day,

    Sergio

    P.S.

    Apologize for my terrible english.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here an image of the function:

  • Yes, booleans are cumbersome to work with in Construct. I suggest using number variables instead - 0 for false, 1 for true.

  • Yes, booleans are cumbersome to work with in Construct. I suggest using number variables instead - 0 for false, 1 for true.

    Thank you dop2000 :-)

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