-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMouseClicked.pde
More file actions
104 lines (96 loc) · 3.1 KB
/
MouseClicked.pde
File metadata and controls
104 lines (96 loc) · 3.1 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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
void mouseClicked() {
if (x_fp==0) {
if (mouseX>132 && mouseY>522 && mouseX<370 && mouseY<609 ) {
fullimg = loadImage("images/FullMap1.jpg");
LoadPuzzel01();
startTime=initiatedTime;
InitialState();
} else if (mouseX>433 && mouseY>522 && mouseX<679 && mouseY<609 ) {
fullimg = loadImage("images/FullMap2.jpg");
LoadPuzzel02();
startTime=initiatedTime;
InitialState();
} else if (mouseX>132 && mouseY>658 && mouseX<370 && mouseY<750 ) {
fullimg = loadImage("images/FullMap3.jpg");
LoadPuzzel03();
startTime=initiatedTime;
InitialState();
} else if (mouseX>433 && mouseY>658 && mouseX<679 && mouseY<750 ) {
fullimg = loadImage("images/FullMap4.jpg");
LoadPuzzel04();
startTime=initiatedTime;
InitialState();
}
} else {
//********************************************** To move the tiles ********************************************************************************
selectedTile=0;
for (int i = 1; i <= 16; i = i+1) {
if (mouseX >x[i] && mouseX<(x[i]+TileSize) && mouseY>y[i] && mouseY<(y[i]+TileSize)) {
selectedTile=i;
}
}
// Move the selected tile down
if (y[16]==y[selectedTile]+TileSize && x[16]==x[selectedTile]) {
temp=y[selectedTile];
y[selectedTile]=y[16];
y[16]=temp;
}
// Move the selected tile right
else if (x[16]==x[selectedTile]+TileSize && y[16]==y[selectedTile]) {
temp=x[selectedTile];
x[selectedTile]=x[16];
x[16]=temp;
}
// Move the selected tile up
else if (y[16]==y[selectedTile]-TileSize && x[16]==x[selectedTile]) {
temp=y[selectedTile];
y[selectedTile]=y[16];
y[16]=temp;
}
// Move the selected tile left
else if (x[16]==x[selectedTile]-TileSize && y[16]==y[selectedTile]) {
temp=x[selectedTile];
x[selectedTile]=x[16];
x[16]=temp;
}
//========= Selection Buttons
if (mouseX >0 && mouseX<150 && mouseY>800 && mouseY<850) { //Button 01
MoveTilesOutSide();
x_fp=0;
y_fp=0;
x_fullimg=900;
x_b01=900;
y_b01=900;
x_b02=900;
y_b02=900;
x_b03=900;
y_b03=900;
x_time=900;
// y_time=900;
}
if (mouseX >160 && mouseX<310 && mouseY>800 && mouseY<850) { //Button 02
if (fullimg_toggle==0) {
fullimg_toggle=1;
x_fullimg=0;
y_fullimg=0;
//Saving the x coordinates in the array - x_temp
for (int i = 1; i <= 16; ++i) {
x_temp[i]=x[i];
}
MoveTilesOutSide();
} else {
fullimg_toggle=0;
//Restoring the x coordinates from the array - x_temp
for (int i = 1; i <= 16; i = i+1) {
x[i]=x_temp[i];
}
x_fullimg=900;
y_fullimg=900;
} // fullimg_toggle
} // Button 02
if (mouseX >320 && mouseX<470 && mouseY>800 && mouseY<850) { //Button 03
startTime=initiatedTime;
InitialState();
}
}
} //mouseClicked