-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsuper_script.js
More file actions
130 lines (98 loc) · 4.07 KB
/
Copy pathsuper_script.js
File metadata and controls
130 lines (98 loc) · 4.07 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// โหลดเว็บไซต์
setTimeout(() => {
const loaderContainer = document.querySelector('.loader-container');
const content = document.querySelector('.content');
// ซ่อนหน้าโหลดและแสดงเนื้อหาหลักหลังจากโหลดเสร็จ
loaderContainer.style.display = 'none';
const audio = document.getElementById('background-audio');
audio.play();
// content.style.display = 'block'; บรรทัดนี้พังนะ
}, 3000); // 3 วินาที
var girl_index = 0;
var shelf_index = 2;
function walk_cycle(frame){
walkingInterval = setInterval(function() {
document.getElementById('character').setAttribute('src', 'img file/supermarket/Chuppy Girl-0'+frame+'.png')
setTimeout(function() {
document.getElementById('character').setAttribute('src', 'img file/supermarket/Chuppy Girl-0'+frame+' (Walk).png')
}, 500);
}, 1000);
}
function next(){
girl_index++;
if(girl_index <= 7){
// ใส่ให้เล่นเสียงตรงนี้
const audio = document.getElementById("food-drop-audio");
audio.play()
walk_cycle(girl_index)
let btn = document.getElementById("btn");
// let btn = document.getElementById("shelf");
btn.className = "disabled";
setTimeout(function() {
// delay ใส่ตรงนี้
// From: https://jsfiddle.net/28Qfx/
let shelf = document.getElementById("shelf");
shelf.className = "moveShelfOut";
let floor = document.getElementById("floor");
floor.className = "moveShelfOut";
let backshelf = document.getElementById("backshelf");
backshelf.className = "moveBackshelfOut";
setTimeout(function() {
// delay ใส่ตรงนี้
if(shelf_index <= 7){
document.getElementById('shelfpic').setAttribute('src', 'img file/supermarket/Super Shelf-'+shelf_index+'.png')
shelf_index++;
let shelf = document.getElementById("shelf");
shelf.className = "moveShelfIn";
let floor = document.getElementById("floor");
floor.className = "moveShelfIn";
let backshelf = document.getElementById("backshelf");
backshelf.className = "moveBackshelfIn";
}
else if(shelf_index == 8){
// ถึง Counter จ่างยเงิน
document.getElementById('shelfpic').setAttribute('src', 'img file/supermarket/Cashier Girl.png')
shelf_index++;
let shelf = document.getElementById("shelf");
shelf.style.width = "90%";
shelf.style.left = "30%";
shelf.className = "moveShelfIn";
let floor = document.getElementById("floor");
floor.className = "moveShelfIn";
let backshelf = document.getElementById("backshelf");
backshelf.className = "moveBackshelfIn";
}
else if(shelf_index > 8){
const audio = document.getElementById('cashier-audio');
audio.play();
setTimeout(function() {
window.location = "bill.html";
}, 2000);
}
setTimeout(function() {
btn.className = "";
clearInterval(walkingInterval);
setTimeout(function() {
document.getElementById('character').setAttribute('src', 'img file/supermarket/Chuppy Girl-0'+girl_index+'.png')
}, 500);
}, 2000);
}, 2000);
}, 1500);
}
else{
const audio = document.getElementById('cashier-audio');
audio.play();
setTimeout(function() {
window.location = "bill.html";
}, 2000);
}
}
// function pongaum() {
// const Store = document.getElementById('pong')
// const audio = document.getElementById('cashier-audio');
// Store.addEventListener('click', () => {
// audio.play();})
// }
// const audio = document.getElementById('cashier-audio');
// audio.play();
// <audio id="cashier-audio" src="Sound Effect/3 Store Scene/Cashier.mp3"></audio>