-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScene.pde
More file actions
41 lines (34 loc) · 1.01 KB
/
Scene.pde
File metadata and controls
41 lines (34 loc) · 1.01 KB
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
class Scene extends State
{
ArrayList<RiddleItem> container = new ArrayList<RiddleItem>();
PImage background;
String filename;
Scene( String backgroundFilename ) {
filename = backgroundFilename;
}
void enterState( State oldState )
{
if ( background == null ) {
background = loadImage( filename );
}
}
public void handleMousePressed() {
for ( int i = container.size() - 1; i >= 0; i-- ) {
RiddleItem item = container.get(i);
item.handleMousePressed();
}
inventory.nrOfRiddleItems = 0;
for( int c = 0; c < inventory.items.size(); c++ ) {
RiddleItem checkItem = inventory.items.get(c);
if( ! checkItem.filename.substring( 0, min( 9, checkItem.filename.length() ) ).equals( "telescope" ) ) inventory.nrOfRiddleItems++;
}
}
public void doStepWhileInState()
{
image( background, 0, 0, width, height );
for ( int i = 0; i < container.size(); i++ ) {
RiddleItem item = container.get(i);
item.display();
}
}
}