No sprite oncreate and ondestroy condition?

For questions about using Classic.

Post » Sun May 22, 2011 1:53 pm

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 .
B
1
G
1
Posts: 3
Reputation: 431

Post » Sun May 22, 2011 2:01 pm

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!
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Sun May 22, 2011 2:07 pm

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
B
1
G
1
Posts: 3
Reputation: 431

Post » Sun May 22, 2011 2:10 pm

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.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,842
Reputation: 48,285

Post » Sun May 22, 2011 2:13 pm

Thanks ,I'll try some tutorials to understand Construct.
B
1
G
1
Posts: 3
Reputation: 431

Post » Sun May 22, 2011 2:21 pm

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:
viewtopic.php?f=3&t=2272

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
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Sat Jun 11, 2011 7:55 am

Lucid thanks for the links
B
1
G
1
Posts: 6
Reputation: 437


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest