seiyria Posted September 11, 2014 Share Posted September 11, 2014 Is there a way to pass a callback to this, for when all of the Tiled attributes I set have been loaded onto the object? For example, suppose I set: auto: truedistance: 10 on an object, and I want to make use of these in my objects custom constructor that I pass in? Here is my call: @map.createFromObjects 'PlatformLayer', @gids.PLATFORM_HORIZONTAL, 'platforms', 1, true, false, undefined, HorizontalPlatformI'd like it to be: @map.createFromObjects 'PlatformLayer', @gids.PLATFORM_HORIZONTAL, 'platforms', 1, true, false, undefined, HorizontalPlatform, 'isReady'And then, on HorizontalPlatform, I would have an isReady function that could be called when all of the Tiled parameters have been loaded so I don't have to do any weird stuff like setTimeout while waiting for it to finish loading. Link to comment Share on other sites More sharing options...
seiyria Posted September 11, 2014 Author Share Posted September 11, 2014 jdowell pointed out to me that it is possible to handle this in such a fashion:objectGroup = @game.add.group()map.createFromObjects "PlatformLayer", gids.PLATFORM_HORIZONTAL, "platforms", 1, true, false, objectGroup, HorizontalPlatformobjectGroup.callAll "isReady()"Not ideal for every use-case, but it should suffice for most. Link to comment Share on other sites More sharing options...
Recommended Posts