music start
This commit is contained in:
39
app.js
39
app.js
@@ -65,7 +65,7 @@ let game = {
|
||||
|
||||
stats.clock.start()
|
||||
stats.clock.elapsedTime = stats.elapsedTime
|
||||
scene.music.play()
|
||||
if (settings.musicVolume) scene.music.play()
|
||||
|
||||
if (playfield.piece) scheduler.setInterval(game.fall, stats.fallPeriod)
|
||||
else this.generate()
|
||||
@@ -253,22 +253,6 @@ function onkeyup(event) {
|
||||
|
||||
/* Scene */
|
||||
|
||||
const loadingManager = new THREE.LoadingManager()
|
||||
loadingManager.onStart = function (url, itemsLoaded, itemsTotal) {
|
||||
loadingPercent.innerText = "0%"
|
||||
}
|
||||
loadingManager.onProgress = function (url, itemsLoaded, itemsTotal) {
|
||||
loadingPercent.innerText = Math.floor(100 * itemsLoaded / itemsTotal) + '%'
|
||||
}
|
||||
loadingManager.onLoad = function () {
|
||||
loaddingCircle.remove()
|
||||
renderer.setAnimationLoop(animate)
|
||||
gui.startButton.show()
|
||||
}
|
||||
loadingManager.onError = function (url) {
|
||||
loadingPercent.innerText = "Erreur"
|
||||
}
|
||||
|
||||
|
||||
const renderer = new THREE.WebGLRenderer({
|
||||
powerPreference: "high-performance",
|
||||
@@ -284,12 +268,10 @@ document.body.appendChild(renderer.domElement)
|
||||
const stats = new Stats()
|
||||
const settings = new Settings()
|
||||
|
||||
const scene = new TetraScene(loadingManager, settings)
|
||||
const scene = new TetraScene(settings)
|
||||
|
||||
const gui = new TetraGUI(game, settings, stats, scene)
|
||||
|
||||
const clock = new THREE.Clock()
|
||||
|
||||
scene.add(Mino.mesh)
|
||||
|
||||
const holdQueue = new HoldQueue()
|
||||
@@ -305,6 +287,23 @@ messagesSpan.onanimationend = function (event) {
|
||||
event.target.remove()
|
||||
}
|
||||
|
||||
scene.loadingManager.onStart = function (url, itemsLoaded, itemsTotal) {
|
||||
loadingPercent.innerText = "0%"
|
||||
}
|
||||
scene.loadingManager.onProgress = function (url, itemsLoaded, itemsTotal) {
|
||||
loadingPercent.innerText = Math.floor(100 * itemsLoaded / itemsTotal) + '%'
|
||||
}
|
||||
scene.loadingManager.onLoad = function () {
|
||||
loaddingCircle.remove()
|
||||
gui.startButton.show()
|
||||
renderer.setAnimationLoop(animate)
|
||||
}
|
||||
scene.loadingManager.onError = function (url) {
|
||||
loadingPercent.innerText = "Erreur"
|
||||
}
|
||||
|
||||
|
||||
const clock = new THREE.Clock()
|
||||
|
||||
function animate() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user