ggibson1's Recent Forum Activity

  • And if the name of the type you want to create is stored as a string of text in an Instance Variable or read in from JSON?

    What you are talking about only works if you HARD CODE the type into the event... look through the forums and you will see many people asking how to do this exact thing.

  • Good idea you two...

    Tutorial:

    (https://www.scirra.com/tutorials/788/asynchronous-callback-object-creation)

  • If I am doing a For Each across all objects in a family how do I get the Name property you can see in the designer property window for each object type?

    I want to log these to the browser console.

  • Thanks much.

    I think they are packing all events for each sprite together into a single event since they are of the same type and are occurring at the same time.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Why did that work?

    Is it just not possible to have sprites sharing the same timer interval?

  • I have a Sprite object type with a Timer behavior.

    There are three instances of this Sprite on the Layout.

    In the EventSheet on start up I loop through all Sprite objects and for each Sprite I start the timer with the Tag set to an instance variable on each Sprite.

    There is an event listening for the Timer event for each Tag (set with the Instance Variable again) and if you look at the browser console you can see only one of them is fired.

    Here is a capx (http://sdrv.ms/1bsA3LH)

  • After doing research in the forums I see that it is a common question...

    "How do I create an instance of an object dynamically (by text name) and then get a reference to that instance to use it?"

    Normally in computer languages this can be done synchronously (create it and immediately use it).

    However this can also be done asynchronously (start the creation now...and later it will be finished).

    <strike><font color=yellow>

    Construct 2 uses the asynchronous method.

    This however causes complexity that seems out of place in Construct 2.

    </font></strike>

    <font color=green>In the tutorial there is an example of doing the same thing synchronously as well.</font>

    Many people have struggled with how to get a handle on this.

    Plugins have been created to try to help.

    Here is a tutorial that contains a capx (https://www.scirra.com/tutorials/788/asynchronous-callback-object-creation) that shows a method to handle this with what is known in the software development world as "Callbacks".

    It is implemented entirely with Construct 2 Personal / Business features.

    The way it works is described in detailed comments in the capx. Basically you create an object by calling a function called "New" and pass it some parameters via Dictionary objects that includes the text name of the object type, the name of the Callback function you want called after the object has been created, and any parameters you want passed to the Callback function.

    The Callback function gets the UID of the new object (as Function.Param(0)) and all the additional parameters you specified (as Function.Param(1)).

    With this you can do a Family > Pick instance with UID or Pick an instance of the specific type and then just do all the actions you would have normally done.

  • Basically what I am looking for is a way to export / import ALL Construct 2 entities between projects as easily as you can events between projects.

  • This request is to add a new type of Extension to Construct 2.

    The idea is after making a Sprite that has it's Container filled with another Sprite and an Array, as well as Behaviors, Effects, and Instance Variables set on all of them... I can then select this first Sprite and an Event Sheet that contains generic reusable events referring to these objects and Export it as a reusable library... like you can do with DLLs in normal software development.

    This would allow me to build a library of reusable components made out of Construct 2 entities and potentially share them with others.

    Thanks for this very nice application.

ggibson1's avatar

ggibson1

Member since 7 Dec, 2013

None one is following ggibson1 yet!

Trophy Case

  • 10-Year Club
  • Coach One of your tutorials has over 1,000 readers
  • Email Verified

Progress

12/44
How to earn trophies