0 Favourites

No sprite oncreate and ondestroy condition?

This forum is currently in read-only mode.
  • Hi ,I'm a Game maker user and new to Construct. I want to spawn objects,and exec action to the new object.but I can't find oncreate and onfinish conditions in the sprite condition list .Is there something I'm missing ? Thanks.

    I'm using Construct Classic r1.2 .

  • when you spawn a new object it is automatically picked so if you want to do something to newly created objects, just put the actions after their creation, ie:

    System.CreateObject(sprite)

    sprite.x = 50

    will move only the new sprite.x to 50

    ondestroy has no logical context for construct objects that I can think of in events. other than an idiosyncratic bug that allows you to access object information after it's destruction for the remainder of the tick, you can't really do anything to a destroyed object, so anything you want to do after destroying an object, just put the action after the destroyobject action

    edit : and welcome to scirra!

  • Thank you.and I have another question .

    How to distinguish the instance and the object type in action ? I mean I can't distinguish if an action perform to all the instances of the object type or one instance of the object type.In Game Maker there is object type id and object id. I don't know how construct deal with the concept.Thank you

  • Welcome Yuki001.

    Have you tried any of the tutorials yet? Many of your questions/problems may be quickly alleviated that way. Remember: GameMaker != Construct, so you will need to understand the way Construct does things.

  • Thanks ,I'll try some tutorials to understand Construct.

  • the short answer to your question is that there is a 'picking' system

    you choose the objects that are relevant in your conditions, and then the actions only act upon those specific objects

    like

    MySprite 'is overlapping' ThatOtherSprite

    ---------MySprite.Angle=45

    ---------ThatOtherSprite.Destroy

    now only the MySprite's that are overlapping ThatOtherSprites will have their angle changed, and only the overlapped ThatOtherSprites will be destroyed. If there are other instances of those two object types that are not overlapping eachother they will be unaffected by the actions following the 'is overlapping' condition.

    All conditions work this way. it streamlines everything greatly

    the longer answer can be found here:

    http://sourceforge.net/apps/mediawiki/c ... Conditions

    under the heading 'picking'

    xenox is right though, look at this thread:

    the ghost shooter tutorial is the quickest way to get a general feel for construct. I'll bet you'll be amazed at how wonderful everything works.

    the tutorials in the tutorials section of the forum are more specific, so I would suggest picking and choosing through the 'are you new here' thread and wiki first

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Lucid thanks for the links

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