Why does this happen?

0 favourites
  • 9 posts
  • Hello, I do not understand what is happening here, why the X coordinate of sprite is not positioned ?.

    The X coordinate is always 0, never is 50 or 100 or 150 or 200.

    https://dl.dropboxusercontent.com/u/60803633/test2.capx

    Someone could take a look?

  • I dont think that event system works in 'on start of layout'.

    Do it simple. Set X to choose(100,150,200,250) in the creation action.

  • working

    edit:

    or add sub-event

  • But I do not understand, why this is so ?.

  • Well, am not 100% sure, but. I think that a newly created instance actualy gets created in the next tick.

    You can apply actions to a newly created instance, right after a "Create" action, but you can't do picking of that instance before the next event.

    But the 'on start of layout' does not execute in the next tick. This makes the pick events beeing skipped.

    There is a simple trick to know if your 'on start of layout' has a problem with picking. And that happens a lot if you are not carefull. Change the 'on start of layout' to 'on mouse clicked'. If it works now, you need to bring the events out of the 'on start of layout'.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, am not 100% sure, but. I think that a newly created instance actualy gets created in the next tick.

    You can apply actions to a newly created instance, right after a "Create" action, but you can't do picking of that instance before the next event.

    But the 'on start of layout' does not execute in the next tick. This makes the pick events beeing skipped.

    There is a simple trick to know if your 'on start of layout' has a problem with picking. And that happens a lot if you are not carefull. Change the 'on start of layout' to 'on mouse clicked'. If it works now, you need to bring the events out of the 'on start of layout'.

    That makes sense, thanks to everyone !.

  • The newly created objects are not pickable outside of sub-events till the next toplevel event.

    More info here:

  • The newly created objects are not pickable outside of sub-events till the next toplevel event.

    More info here:

    Ok thanks for the info, I think it is quite clear.

  • > The newly created objects are not pickable outside of sub-events till the next toplevel event.

    > More info here:

    >

    >

    Ok thanks for the info, I think it is quite clear.

    in order for the var condition to be working on your sprite i suggest add it on the sprite as a instance variable instead of a global variable. the way you made the events... you created a sprite object and thats it.

    then added 2 conditions that triggers the actions for positioning the sprite that is referring to all the sprite objects existing on the map not to 1 or the new just created.

    you need to identify the sprite you just created in order to move that one only.

    for example i do a "type" instance variable usually then when a sprite is created i add the type number to the count of sprites existing that way i can say if C= sprite.type=5 set - A= sprite.setx to N

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