Objects as function parameter?

0 favourites
  • 4 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • Hi everyone,

    Is there a way to give a function an object as parameter in order for the function to execute a couple of actions on said Object?

    Along the lines of:

    call function "spawnEnemy" (heavyGunner)

    Action 1: Spawn param(0)

    Action 2: Rotate param(0)

    Etc...

  • For starters, if an object is created, it is already automatically picked for actions immediately following the creation of the object.

    Otherwise, if you need to pick an already created object, you can do it by IID or UID, which are values that can be passed as parameters.

  • Sure, the picking is clear.

    UID and IID both relate to instances of already created objects afaik. But I want to feed my spawn command object types.

    Can I have a single function that spawns various types of objects without using some bloated switch statement?

    Or put differently: can i have a spawn command that is fed by the parameter of a function?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • no.. construct can't do that.

    but you could put your objects into a family, and then create the object, then pick the family by uid of the object created, and then perform the general actions on the picked family object. By putting them all in a family, you'll be able to set actions for one without having to create a bunch of duplicate actions.

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