[SOLVED] Identifier other than "Last created" and "Last collided"?

oscarkim

  • Posts: 28
I am working on a game in which a platform is created after another platform. To do this I am using "Last created actor" block. However, using the "Last created" block or the "last collided" block limits the amount of actors you can use in a scene e.g - when another actor  ( In my case :) )  other than a platform is created it becomes the last created actor.

Is there any other way to identify a certain actor more specifically like ." Last created platform" or "Last created actor type"  instead of using  last created actor / last collided block .

« Last Edit: April 14, 2015, 12:37:32 pm by oscarkim »

PhilIrby

  • Posts: 545
If you know you will need to refer to an actor beyond  the time  when last created actor works, then set an attribute of type actor to last created actor immediately after creation. 

oscarkim

  • Posts: 28
I have tried that but  without any success.
I've attached my code so far.

PhilIrby

  • Posts: 545
No , what I mean is ;
when you
[ create  (Platform) at ( x; y; ) at front ]
set LastPlatform to last created actor

oscarkim

  • Posts: 28
That's what I did originally.  I had created a platform then set it as last created actor - the problem with this is that when an actor that isn't a platform is created it becomes the last created actor. What I am looking for is a way to set the created platform as the last created platform so that when a different actor is created it identifies it as not a platform :) .

PhilIrby

  • Posts: 545
I'm not sure we are on the same page here.  Are you saying that the attribute LastPlatform gets set to another actor type ???  Can you show your code where you create the platform actor.

oscarkim

  • Posts: 28
After creating a platform character at scene - events( using create actor block) - it becomes the last created actor.
After which I have a create button with the attached block below.

PhilIrby

  • Posts: 545
Put the [set LastPlatform to last created actor] block between the create plat# block and Stop block in each  of the if blocks. The LastPlatform  attribute will be set to the last platform that was created.

oscarkim

  • Posts: 28
Thanks :)  did that and added a boolean attribute to determine whether if last created actor is not from platform group whereby if not - use LastPlatform instead. Works flawlessly.