Comments (8)
Thanks for confirming. Can I contribute to this issue?
from text-fighter.
@CLEMENTJOHNSHAJI of course, contributions are welcome and appreciated 😄
from text-fighter.
Running Java 8 1.8.0_181 I could not replicate this issue. I thought it may have something to do with the Scanner Infinite Loop issue, but it just worked for me.
I only tested by cutting out the getValidInt() method from the Ui class and the do-while loop from the Casino class.
The int validator and loop seem to work fine. Maybe it has something to do with when it breaks out of the loop from the return statement? Not sure, I tried to help though haha!
from text-fighter.
It might simply just be the Ui.pause() call after the prompt causing an error extra stop in the program.
I cant test this at the moment though, as im not at my computer
from text-fighter.
Yes, you are right. I fixed the issue by converting pause() function in Action.java
from
public static void pause(){
try{
Scanner pauseScan = new Scanner(System.in);
String temp = pauseScan.nextLine();
Ui.println(temp);
}catch (Exception e){
//Blank for a reason - Not supposed to do anything.
}
}
to
public static void pause(){
try{
Scanner pauseScan = new Scanner(System.in);
return;
}catch (Exception e){
//Blank for a reason - Not supposed to do anything.
}
}
from text-fighter.
Doing that just makes the entire pause function essentially do nothing, making it not work at all (which you'll notice in other places the function is used. For example, when you attack an enemy, it won't pause the screen for the user to read the text before going back to the menu.
The problem is that the Ui.pause call shouldnt be there at all. So, in Casino.java
, change
if (bet > Coins.get()) {
Ui.cls();
bet = 0;
Ui.println("You do not have enough coins. Please enter a smaller amount. (Or enter 0 to go back)");
Ui.pause();
}
to
if (bet > Coins.get()) {
Ui.cls();
bet = 0;
Ui.println("You do not have enough coins. Please enter a smaller amount. (Or enter 0 to go back)");
}
Hopefully that makes sense
from text-fighter.
Yes. On working on this, I realized the use of pause() function in other places and did the same change you have suggested in casino.java.
from text-fighter.
I am a beginner, and I am working on this project as part of my coursework. I have to update my contributions in git for the completion of my course. So it would be of great help if you can merge my request.
from text-fighter.
Related Issues (20)
- Reading the input with scanner results in a "NoSuchElementException" when running with Gradle HOT 1
- Implement a GUI HOT 5
- add contributers list to readme and an ingame-menu (credits menu)? HOT 2
- Adding exit options during Game setup HOT 2
- Total game time played and current session time played HOT 3
- Array access in Cheats.java: weaponstash causes index out of bounds error.
- Separate fight menu
- Update & Test new Guava/Yaml/junit versions due to exploits and bug fixes HOT 1
- Remove splash screen once again
- Property HOT 9
- Potion brewing & more potions
- Better deals in shops if you do quests for the shop owners HOT 2
- Lose a random amount of coins instead of exactly half on death HOT 2
- Organize classes/packages again HOT 2
- Weapons not being saved
- Total Kills stat acting weird HOT 1
- Guns use wayy too much ammo
- Add more achievements HOT 2
- Add support for gradle
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from text-fighter.