How do I create a function that takes parameters

0 favourites
  • 3 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hi.

    I am completely new to construct 2, and I am a "classic" developer that usually writes code, so I have a hard time trying to understand construct 2.

    I need to set the opacity of the mouse cursor, dependent on some condition in the game.

    So I decided to create a function that would change the mousecursor sprite, but adjust the opacity of the sprite before doing so.

    This function needs to take a parameter telling it if it should increase or decrease the opacity.

    But how do you create a function that takes a parameter, and how do you access the parameters within the function?

    The manual mentions that a function can take a parameter, but does not give an example of how you actually create such a function.

    The old dude is a little confused

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can add parameter through [Action: Call Function]. Just click "Add Parameter" to add parameter. In the function, you can take the parameter by index such as Function.param(#index).

    There are some screenshot at tutorial page as far as I remember, it's more intuitive to look at pictures.

  • Ok thanks I figured it out.

    Boy I wish I could just write some simple code.

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