Actually, forget what I said. scene2d is awesome! I've played around with it a bit now, and with very little effort, you can create your own UI elements, and if you need to create dynamic boxes and such, it is easily extendible.

I only need to get a better understanding of the action-system. I'm having trouble triggering things, but it's probably just something I've missed.

Actions are described here:https://code.google.com/p/libgdx/wiki/scene2d#ActionsLet me know which of that is confusing and maybe we can reword things. In a nutshell, there is a simple action class then a few convenience base classes for different action types (eg TemporalAction for stuff that happens over time, etc), then built on top those are a number of common action classes. You can create instances of those yourself, but to make using those more convenient, there is the "Actions" class which has static methods to get configured, pooled action instances.

It is most common and convenient to use the "Actions" class to get instances for sequence, parallel, delay, fade, etc but also keep in mind you can create your own actions. Eg, it is common to extend TemporalAction and implement the begin, update, and/or end methods to do whatever you want. Note to avoid GC you probably want to use Actions.action(Class) to easily get a pooled instance of your action. It will be put back in the pool automatically when it is no longer needed. Lastly, here is an easy way to run some code after some actions:

Thanks a lot for that!What I was pondering was how hard it would be to do something like this:- I click a button on my stage (like "Start Game")- Then I activate some actions that makes the entire stage fade out- Then only when the fade-out is complete, does it start the game

How do you intend one does that with your system? If you would be so kind as to maybe just explain in short pseudo-steps, sort of like:- Make a boolean in your stage- Use a listener and @Override touchUp to change the boolean- (somehow) apply an action that fades out the entire stage- Change to game-screen

EDIT: Oh, wait...I see. You already said that. run() EDIT 2: Dude, this is AWESOME! I'm so sorry I compared this to Swing. I mean...it's...I'M SO SORRY!

I tried copying your code exactly, and I got the same "problem" I got before. It doesn't want to accept the run(new Runnable(){summat};"run" gives an error saying: "The method run(new Runnable(){}) is undefined for the type new ChangeListener(){}"

I'm guessing this is because I've cocked something up while setting up my stages or something. It works fine if I just put Actions.run(){summat};Does this matter?

Once again, you were very right. After climbing that first hump, it's like "Aaaah, where has this been all my life!?"

Yeah the thing to remember in stage2d is that actions are run in parallel unless you explicitly sequence them otherwise -- every action means "start doing this NOW". There is a convenience action now for scheduling actions "after everything else is done" though this can get interesting if you have two of them scheduled (I never did chance to try that scenario)

It's definitely something quite different than what is normally meant by an Actor system, that's for sure. But damn is it a lot of fun to play with.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org