assets from v7

This commit is contained in:
2022-10-29 01:12:37 +03:00
parent e95a189e1d
commit ef497cbc5e
2 changed files with 35 additions and 18 deletions

View File

@@ -1,26 +1,43 @@
const DEBUG = true;
let app;
/** PIXI and PIXI.Assets init */
window.onload = function() { window.onload = function() {
let app = new PIXI.Application({ 'use strict';
app = new PIXI.Application({
width: 640, width: 640,
height: 360, height: 360,
backgroundColor: 0x2a2a3a, backgroundColor: 0x2a2a3a,
}); });
document.body.appendChild(app.view); document.body.appendChild(app.view);
let elapsed = 0.0;
let spriteSkull = PIXI.Sprite.from('/assets/skull.png'); // PIXI.Assets.add('texture_name', '/assets/texture.png');
let spriteSpiderWeb = PIXI.Sprite.from('/assets/spider-web.png');
spriteSpiderWeb.y = (360 / 2) - (spriteSpiderWeb.height / 2)
app.stage.addChild(spriteSkull); // let promise = PIXI.Assets.load(
app.stage.addChild(spriteSpiderWeb); // ['texture_name'],
// (progress) => {
// if (DEBUG)
// console.log(`Assets loading progress: ${progress * 100}%`);
// });
app.ticker.add((delta) => { // promise.then((value) => {
elapsed += delta; // backgroundTextures = value;
spriteSkull.x = 100.0 + Math.cos(elapsed/50.0) * 100.0; // initLevel();
}); // });
}
app.ticker.add((delta) => {
elapsed += delta; /** Level init */
spriteSpiderWeb.x = 100.0 + Math.cos(elapsed / 50.0) * 100.0; function initLevel() {
}); 'use strict';
app.ticker.add(gameLoop);
}
/** Game loop */
function gameLoop(delta) {
'use strict';
//
} }

View File

@@ -3,8 +3,8 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>pixi - template</title> <title>pixi.js - template</title>
<script type="text/javascript" src="/pixi.js"></script> <script type="text/javascript" src="pixi.js"></script>
</head> </head>
<body> <body>
<div class="container"> <div class="container">