forked from asalga/Horadrix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ScreenStory.pde
83 lines (63 loc) · 1.8 KB
/
ScreenStory.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
*/
public class ScreenStory extends IScreen{
private int storyPointer = 0;
private RetroFont solarWindsFont;
private RetroLabel storyLabel;
private RetroLabel continueInstruction;
private float textPos = 0;
private float easing = 0.08;
private boolean clicked = false;
private boolean extro = false;
private float target;
//private Background background;
public ScreenStory(){
solarWindsFont = new RetroFont("data/fonts/solarwinds.png", 14, 16, 2);
storyLabel = new RetroLabel(solarWindsFont);
//storyLabel.setText(story[storyPointer]);
storyLabel.setDebug(false);
//continueInstruction = new RetroLabel(solarWindsFont);
//continueInstruction.setText("Click to continue");
}
public void draw(){
background(0);
storyLabel.draw();
//continueInstruction.draw();
}
public void update(){
screens.transitionTo("gameplay");
if(extro == false){
textPos += (target - textPos) * easing;
}
else{
textPos += textPos * easing;
}
storyLabel.pixelsFromCenter(0, (int)textPos);
if(storyLabel.getY() > height + 30){
screens.transitionTo("gameplay");
}
// Prevent player from making the text skip to the middle.
if(clicked && textPos >= -1 && extro == false){
target = 300;
textPos = 0.9;
extro = true;
}
}
public void OnTransitionTo(){
textPos = -(height/2) + 20;// bit of fudge
target = 0;// bit of fudge
clicked = false;
extro = false;
}
// Mouse methods
public void mouseReleased(){
clicked = true;
}
public String getName(){
return "story";
}
public void nextLevel(){
storyLabel.setText("MATCH " + gemsRequired[storyPointer] + " SPECIAL GEMS IN " + (int)timePermitted[storyPointer] + " MINUTES");
storyPointer++;
}
}