Ask coding questions

← Back to all posts
Any Ideas?
SreyasSabbani (13)

Questions and Comments for you to answer:

Hey Guys, I am a beginner to Java and I think I've already had a full week of experience with it. Is there anything I need to worry about before starting this game, like game storyline or something. This is the Java Edition of Inferno Arena, which was created by my friend in Python. I want this version to be as or maybe even better than the Python Version. Is there a better way I can simulate the horror of the Inferno Arena. Also, the last request is what Java Syntax would work best for this game. I am currently using If, Else, Else If, Switch, and Scanner statements. If you are wondering why I am I using these commands or syntax, you know why if you go to this link - https://replit.com/@TheCodeMaster70/Inferno-Arena

As you can see clearly, converting Python to Java is not any easy task. Additionally, I've also planned to add more features on the Java Edition of Inferno Arena since some Python to Java conversions might not work on Replit or it might be too hard.

Comments
hotnewtop
InvisibleOne (2683)

You should add some different weapons, armor, or potions to make the fighting more interesting.

SreyasSabbani (13)

I'm working on it, but I failed a lot: How do you delete the previous text; imagine that you had a scanner, whenever a person types something in, the previous text gets deleted and gets replaced by another piece of text. How do you do that???

2plus2is4hoi (92)

@SreyasSabbani Runtime.getRuntime().exec("cls");
Also to create the horror, print out stuff in java slowly. At the end of the print, (idk if this works) but tell it to not go to a new line (in python it would be print('Test', end='')) and then make a sleep delay and continue on

EpicGamer007 (1607)

@2plus2is4hoi cls is for windows. and clearing previous text is not possible unless you mean clearing the console which you can do by doing System.out.print("\033[H\033[2J");

SreyasSabbani (13)

@2plus2is4hoi Thank you a lot I got a lot of ideas to make the horror but when I try the Runtime.getRuntime().exec("cls"); it shows me a error. Your ideas are more than enough, again, thanks a lot!

SreyasSabbani (13)

@EpicGamer007 Yes, when I said clearing previous text, I meant clearing the console. Also, the System.out.println("\033[H\033[2J"); worked!

SreyasSabbani (13)

@2plus2is4hoi Also, how do I print out the stuff slowly?

EpicGamer007 (1607)

@SreyasSabbani using slowprint.

public static void slowPrint(String toPrint, int delay) {
  try {
    for(char c: toPrint.toCharArray()) {
      System.out.print(c);
      Thread.sleep(delay);
    }
  } catch(InterruptedException e) {
    e.printStackTrace();
  }

}
SreyasSabbani (13)

@EpicGamer007, this time, there is one letter per line printed when using the slowPrint command. This is how it is like:

W
e
l
c
o
m
e

t
o

I
n
f
e
r
n
o

A
r
e
n
a

The delay works tho.

EpicGamer007 (1607)

@SreyasSabbani you are doing System.out.println, change it System.out.print