How do I fix the On create Object works without WaitXs

0 favourites
  • 14 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Is all explained in the code but the problem is that i want that the textbox updates with the last sprite name created.

    First an event that says -> On click-Create X object

    Second > On X object created > Set TextBox as Sprite.name

    The unique way to get this working is adding a "wait X seconds" firts, but this will give me problems on the future, so how i can fix it without the WaitXseconds ?

    Here the .capx

    https://dl.dropboxusercontent.com/u/659 ... oblem.capx

  • try:

    Wait 0 Seconds

  • Works, but still prefer a solution without WaitXseconds. And thanks for the link i'm going to read now, looks interesting!

  • Pick all Sprite

    Set TextBox as Sprite(-1).name

    ?

  • Pick all Sprite

    Set TextBox as Sprite(-1).name

    ?

    99Instances2Go Works but the textbox can't be edited. If i put "On create" the first click on create not show nothing in the textbox, and for the next appears the name of the previous object name. Adding the "Wait0s" your solutions works "on created" <img src="{SMILIES_PATH}/icon_razz.gif" alt=":P" title="Razz"> .

    Here is the .capx edited with your solution added in the bottom(Event 8), maybe i misunderstood something:

    https://dl.dropboxusercontent.com/u/659 ... oblem.capx

  • You can use a function with Pick with UID.

    http://www.blackhornettechnologies.com/ ... m_BHT.capx

  • Not intended to use with 'on create'. Just as a standalone event. This will always write the last created one in the textbox. (sorry was evident for me)

    If you need to use the 'on create', then use what blackhornet suggested, works because the pick by UID always works, no need to wait till the object is actual added to the IID list (pickable).

  • Not intended to use with 'on create'. Just as a standalone event. This will always write the last created one in the textbox. (sorry was evident for me)

    If you need to use the 'on create', then use what blackhornet suggested, works because the pick by UID always works, no need to wait till the object is actual added to the IID list (pickable).

    99Instances2Go Don't worry! i understood you correctly, without OnCreated, but in the code i put a solution that works like yours but the "textbox" is not editable, and i need it to use for rename the sprite.

    blackhornet THANKS!, Yes, works without WaitXseconds.There will be any way to do the same without put a function/event in the On Button clicked ?. As i said in the code "And the box_sprite_name event have to be out of the button "on Clicked" like now." i guess i explained bad i mean none event for that inside this ones.

    Why?, now for each sprite type i want to create i have to add this function. While "On created Sprite" I can add all the functions and events i want to do, only one time instead of repeat the same actions/events in all the buttons. Is there anyway? Sorry for not be totally clear.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can't use "On created" as that is called during the Create action - you don't set the name until the next action, so there is no way to get the data until after you've set it.

  • You can't use "On created" as that is called during the Create action - you don't set the name until the next action, so there is no way to get the data until after you've set it.

    blackhornet Ahh i see obviously! i thought the "on created" works after the event button cliked is finished! :S,

    Not have to be specifically "on created", an action that occurs one time that can detect a new sprite has added wil works.

    I have now:

    On created(Tha is the one only works at the moment with Wait0s)

    OR

    Drag&Drop Start

    OR

    On touch

    Then -> Select, set name, set Zorder, set opacity to slider,etc...

    Mmm, maybe there is some action that detects when the "On button Clicked" event is finished i guess will works too.

    If not well, if only is one repetitive event inside the sprite types creation not is the desired but if there no other options and well i guedd i can use to do other future things that needs to detect the end of the button event i guess.

  • Why not just create the object and call the function to set all the other values. Two lines of code, per button.

  • blackhornet And each function called by the button will have all the properties plus all events and their repetitive events for all buttons.

    I want separate the unique properties for each button and one function with all the events that have in common all the buttons will be pressed for creating sprites.

    I don't know if i explained well, or i not understand you well XD.

    ----------

    On button Circle:

    Set Unique Properties for the circle

    On button Square

    Set Unique Properties for the square

    Lots of events shared by the same actions:

    Actions : On created, On Drag Start, On Touch,etc....

    Evens that runs after this conditions: Select, set textboxes, set sliders,etc...

    So if i want to add a new sprite type i create a button with the unique properties. And if i want to improve the things you can do for the sprites i add an event on "Lots of events shared by the same actions:".

    This is my actual design, what is the way you saying?

  • I think we are saying the same thing.

    http://www.blackhornettechnologies.com/ ... _BHT2.capx

  • I think we are saying the same thing.

    http://www.blackhornettechnologies.com/ ... _BHT2.capx

    blackhornet Yes is the same way. Adding the name or Zorder is only necessary when the object is created, and can be different in multiple ways i still don't know so is integrated in the button object of each type instead in the big events thing at the moment.

    So yes, this is all, thanks for your help and the time to reply, very appreciated! <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">

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