Multi-Resolution Game Development With GameBuilder Studio Check it out!
NEW Version 0.9.7 has arrived! New Blazing Fast Particle Engine & More Game Actions. Check it out
How do I add Starling objects using the custom code base layer?
  • What is the best way to add starling objects without using the push button engine? Can I access a starling sprite layer in GameScreen.as ?
  • 16 Comments sorted by
  • @kikubu wow ok, looks like its +1 on the logo re-design. :)
  • @Jelle are you asking how to add objects via code without using the GBs editor?
  • Yes, I would like to add starling sprites etc through code besides using the GB editor.
  • I added this to gamescreen.as and that works for me:
    var gameScreen:BasicG2DGameScreen = levelScreenMap[currentLevel] as BasicG2DGameScreen;
    var testQuad:Quad = new Quad(130, 250, Color.GREEN);
    gameScreen.uiLayer.addChild(testQuad);
  • @Jelle sorry I forgot to get back to you on this. To add objects manually yes you can access the uilayer like you did there which is the top most layer of a Basic gpu scene in GBs. Accessing the current levels screen is done just like you did via the levelScreenMap.

    You can also access any object created in GBs and there is a scene property on all renderers that you can add objects to as well if you want to integrate objects into the game scene. lookup any object created using the:

    var character : IEntity = PBE.lookup( "Character" ) as IEntity;

    then you can access components created on that object by looking up the component on the entity object.

    Make sure to add this code on the top layer classes like the GameScreen.as class because base classes get overridden.

    There is also a screen manager that you can use with Starling to pop additional screens on top of the main game screen like a loading screen or something like that. You can access it via the ScreenManager singleton class: ScreenManager.instance.moveto("loading"); The base class for a Starling screen is the BaseScreenG2D class. If you create a custom screen it should extend that class and be registered with the ScreenManager. 

    GBs compiles all these custom code changes you make to the custom code base layer which is great for being able to use our visual tool and code when you want to. You get the best of both worlds.









  • Yes I agree to all of the above, I've done 5 month programming before I discovered gamebuilder and I want to include that in my gamebuilder game. I already setup spine before using gamebuilder. I used a newer version of spine than gamebuilder supports, so I'm afraid I have to recreate my spineanimations in an older version :( or are you going to update spine any time soon?

    Also an important question for me: how can I catch the events I create from my spine animations? I used to be able to: spineDisplay.addEventListener(CharacterViewEvent.FINISHANIMATION, onFinishAnimation); . I know about the action "Spine event Listener" but how should I catch these events through code with spine animations generated from gamebuilder?
  • @Jelle yes the latest Spine runtime has been integrated its coming in the next build. We are preparing the v0.9.8 stable release. 

    To access an event notification just access the Spine renderer component on the entity object and access the animation state and attach a listener like this:

    var 
    spineRenderer  : SpineRendererG2D = spineRenderer.spineAnimationState.onEvent.add(onEventReceived);

    onEventReceived is a function callback with the following signature:

    onEventReceived(trackIndex : int, event : Event):
    void }
  • Thanks, this is great news. Made my day :)
  • @Jelle the new build (614) is available now with the latest Spine runtime support.
  • Hi Lavon,

    thanks, I downloaded it and I got everything to work thanks to your help. I did waste some time because I forgot to set trim mode to None. I don't think this is included in your documentation and It can mess up spine animations without it being clear of what is going on (trim mode default setting is trim) so my humble advice is include it in the documentation :)

    Jelle
  • Offtopic: it would be fun to create a contest (a real prize is not needed) for the community to design a new logo. I think gb deserves a more appealing logo and you have a creative community.
  • @Jelle I take it your not a fan of our logo? :) Is it to plain?

    Regarding the Trim mode what are you referring to? The trim setting in Texture Packer?
  • Hi Lavon,
    I love the program, not a fan of the logo! Just a couple of my personal remarks:
    1. Indeed too plain because of the grey background and the basic boring shapes
    2. To messy. (to many shapes and to many colors)
    3. Its trying hard to explain functionality which is not clear to 99% of the people I assume. If you want it to send a message it should be a message that is easy to understand like "its easy and fun to create a game" not a message like "our product allows multi resolution game development"
    4. Its not sexy/appealing.
    5. It sends out a message that the product is not finished while you can already make complete working games with it and publish it on web, mobile and facebook.

    Yes the trim setting in texture packer. I did not turn it off and because I didn't trim my original png's I used for my spine animation everything looked well out of order because it starts scaling all your assets.

  • @Jelle I'm not sure what the trim setting has to do with your spine assets. You can export a sprite sheet from Texture packer with or without the trim setting turned on. It shouldn't break anything.

    You have an interesting perspective of our logo. It was designed by a professional graphics artists I thought it was pretty clean and straight forward. However I respect your opinion. That may be something we can consider doing. Re-branding is costly and time consuming and there are so many other pressing things that are atop of the priority list at the moment.
  • @Lavon trust me it doesn't brake but it looks out of order.

    So 1st: In spine you start with a png with a transparant boundingbox (which is useless data, actually the png should have been trimmed there but this user didnt do that.)

    2nd this user exports the skel file with the transparant boundingbox data.

    3rd Textpacker trims the png's. So now you have a json and png where the png's are trimmed and the old skel file where the data assumes the png's are not trimmed. Resulting in that all the images are scaled to fit the data in the .skel file.

    Just trying to help others in both cases. I can make my way with spine and the logo :)
  • Indeed, I think the logo is weak and unapealing too, just an opinion. 

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion