Cardozz 46 Share Posted July 31, 2015 Hi there, So to make a long story short: my state framework is checking what state it's in after it's clicked a tile on the minimap using the getWalking().walk(Tile tile) method. Is this usual or am I doing something wrong? Thanks in advance Link to comment Share on other sites More sharing options...
Dreamlicker 750 Share Posted July 31, 2015 Hi there, So to make a long story short: my state framework is checking what state it's in after it's clicked a tile on the minimap using the getWalking().walk(Tile tile) method. Is this usual or am I doing something wrong? Thanks in advance If you have some method like this: public void doThing() { if (getInventory().contains("stuff") { state = 1; } if (getInventory().contains("other stuff") { log("other stuff"); } } The method will still execute after the assignment to state. So it keeps going past the first if statement. To fix this, add a return; after your state assignment if your method has other things going on after it. PS: Posting a snippet on pastebin/in code tags will help the most for us to help you. Link to comment Share on other sites More sharing options...
Cardozz 46 Author Share Posted July 31, 2015 nahh I don't have that! add me on Skype ill give you a pastebin bro Link to comment Share on other sites More sharing options...
randalthor 6 Share Posted September 4, 2015 You could also add a break after each state: state = getState() switch(state) { case1: //actions break; case2: //actions break; etc. } return Calculations.random(700,900); //on loop return after states block Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.