I’m going to make a briefing state that telling story with some words running (like typewritter) in screen. Some kind like this
NOTE: you’ll notice I quote an example from RE3 :
However, it seems that break line \n doesnt work on g.drawString() method. The full length text went out the screen. My current approach is create N number of string in array for every number of line.
public void update(long delta){
d += delta;
if (d > 50 && !finish){
if (!halfFinish){
sb1.append(TEXT[level][0].charAt(textCount));
textCount++;
if (textCount == TEXT[level][0].length()){
textCount = 0;
halfFinish = true;
}
d = 0;
}else{
sb2.append(TEXT[level][1].charAt(textCount));
textCount++;
if (textCount == TEXT[level][1].length())
finish = true;
d = 0;
}
}
}
public void draw(Graphics2D g){
g.setColor(Color.black);
g.drawString(sb1.toString(),50,100);
g.drawString(sb2.toString(),50,200);
}
This is not good and I want to know your better approach for this problem. Thanks 8)