Hello.
This code is for a game I'm making.
I'm new to using modulus, and I've been looking all over the place for a tutorial that I can understand. No luck. :\
What I'm trying to do is get the console to print "enemy hits player" as soon as enemyAttacksPlayer() is called.
After one second, "player hits enemy" should be printed, so it alternates between these two lines every second.
The issue is when I call enemyAttacksPlayer(), it takes a few seconds to print any lines, and this delay is kinda annoying.
After messing with the numbers for about 30 minutes, I gave up and came here.
I think I may be using % wrong. Any help?public int time = 0; public void enemyAttacksPlayer() { time++; if (time % 120 == 60) { System.out.println("enemy hits player"); } if (time % 120 == 0) { System.out.println("player hits enemy"); } }