create objects with specific variables

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hey there,

    I have started working with Construct 3 a few days ago. I already have experience with Unity but wanted to try Construct.

    I am attempting to recreate a small local multiplayer game that I made in Unity. However, I am running into issues with creating player objects.

    Specifically, I want the (2-4) players to be able to choose a character and then want to instantiate those characters in the next layout, then I want to be able to identify which player is playing which character (for control purposes). However, I just can't find a proper way to do this.

    For context, in Unity, I did this by creating a static array of player objects and filling it with objects created from prefabs during runtime. That allowed me to just do Array.get(0).simulateControl("left") for example (this is pseudocode just to illustrate my intention).

    One option I thought about was to store the UID of the created character object in an array and then later find the object with that specific UID and execute a simulateControl on that object. However, then I still run into the issue of not being able to set the default values of that object, since the first instance is created at runtime.

    I am just wondering what the proper way to do this in Construct 3 is and if there is functionality that is similar to prefabs.

    Thanks in advance.

  • If you want to create an object with specific variables, just add 'Set variable' actions after the 'Create object' action.

  • Thank you for the quick reply.

    I assumed this would work, but it seems like a very roundabout way of doing things.

    I found some other commentary on this in older forum posts, and I am just wondering why it isn't yet possible to create a template object, as it seems like quite basic functionality.

    Is there any particular reason for not allowing devs to change the Initial Variables?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The current design of Construct is that it uses an arbitrary instance placed in the project as the default. Some people add an unused layout for that. The assumption is either they are all the same, in which case it doesn't matter which it picks, or you set the properties you care about after creating it.

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