New course! Every coder should learn Generative AI!
Try a free lesson0
I'm trying to design a game with Java, so how can I do to make some of the texts blink?
(e.g. Press any Key, Press Y/N and so on) I'm beginning on this and a little bit of help would come in handy.
2 Answers
+ 2
according to the game engine you are using .
but usually the game runs in a loop,
for blinking text you can do something like this:
boolean blink;
gameLoop(){
if(blink)text.setColor(Color.Black);
else text.setColor(Color.white);
blink=!blink;
}
0
Thanks, man! I'm using Eclipse for it... Anyways, there seems to be an error... For the gameloop() { line, it says "The method gameloop() is undefined for the type MainScreen and for the if and else ones, it says "text cannot be resolved." Any suggestions for these errors?