Slick Forums

Discuss the Slick 2D Library
It is currently Tue Oct 15, 2019 1:44 am

All times are UTC

Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sat Jan 18, 2014 9:54 am 

Joined: Fri Nov 08, 2013 8:58 am
Posts: 2

I'm having trouble implementing an enum state machine within the gamestate class of my game here.

Before anyone goes ripping my head off, the reason why I'm nesting a state machine into the gamestate is so that I can handle turns (phases) within my game loop without having to create new state classes in slick.

I'm trying to implement the enums in such a way that they act as switches - only allowing certain code to run depending on the state of the machine - so far I think the only way to do this is to have a turnstate enum and a turn handler class and then implement the "switches" as objects within the update section of the game. However this is really not working out for me.

In my frustration I actually deleted my code so I have nothing to post - has anyone managed this and if so, could you post me an example to work from?


PostPosted: Thu Jan 23, 2014 2:34 am 

Joined: Mon Dec 16, 2013 3:00 am
Posts: 22
This might be a silly question, but have you considered using the 'switch' statement in java; it allows you to use enums to switch on.
If you don't know:

I hope this helps some!

PostPosted: Mon Feb 13, 2017 10:33 am 

Joined: Mon Feb 13, 2017 10:32 am
Posts: 1
Check this one to know more about...Java Enum


Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC

Who is online

Users browsing this forum: MSN [Bot] and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group