Results 1 to 3 of 3
- 01-27-2016, 05:26 AM #1
Member
- Join Date
- Jan 2016
- Posts
- 1
- Rep Power
- 0
Waiting Until a Method is Finished
Me and a partner are working on a project for a programming course. We're building a text based RPG with a main game mode GUI and Combat GUI. Every time we make an attempt to run the combat GUI the screen just appears blank and it is 100% unresponsive (it won't even close without stopping the program). Below is the called method. I'm not sure if there's anything that's directly in front of us that we can't see.
Java Code:private void battleMode(){ CombatLayout battle = new CombatLayout(); battle.fight(); CCT.combat = true; setVisible(false); while(CCT.combat == true){ if(CCT.combat == false){ setVisible(true); break; } } }
- 01-27-2016, 06:19 AM #2
Senior Member
- Join Date
- Jan 2013
- Location
- Northern Virginia, United States
- Posts
- 6,226
- Rep Power
- 13
Re: Waiting Until a Method is Finished
Not much to go on but you are in a tight loop expecting some value to change and then catch it and exit the loop. You could be
stuck in the event dispatch thread so your while loop will never see the change. But it is hard to tell. How much programming have you
done using threads, events, timers, painting, frames, and networking? That (and probably more) is what you need to know to write the
game you describe.
Regards,
JimThe JavaTM Tutorials | SSCCE | Java Naming Conventions
Poor planning on your part does not constitute an emergency on my part
- 01-27-2016, 02:47 PM #3
Senior Member
- Join Date
- Sep 2014
- Location
- MA, USA
- Posts
- 398
- Rep Power
- 6
Similar Threads
-
Waiting for a method to call before continuing?
By Xyexs in forum New To JavaReplies: 8Last Post: 11-09-2013, 06:18 PM -
wait until method is finished
By 3.14.TR in forum Threads and SynchronizationReplies: 4Last Post: 12-04-2012, 10:28 PM -
Just finished Ch. 2 (need help)
By Kurtis in forum New To JavaReplies: 1Last Post: 10-08-2012, 04:37 AM -
Using Thread waiting() method
By nicoeschpiko in forum New To JavaReplies: 7Last Post: 12-11-2010, 09:24 PM -
Using Thread waiting() method
By nicoeschpiko in forum Advanced JavaReplies: 1Last Post: 12-11-2010, 04:50 PM
Bookmarks