assets from v7
This commit is contained in:
parent
e95a189e1d
commit
ef497cbc5e
@ -1,26 +1,43 @@
|
||||
const DEBUG = true;
|
||||
|
||||
let app;
|
||||
|
||||
/** PIXI and PIXI.Assets init */
|
||||
window.onload = function() {
|
||||
let app = new PIXI.Application({
|
||||
'use strict';
|
||||
|
||||
app = new PIXI.Application({
|
||||
width: 640,
|
||||
height: 360,
|
||||
backgroundColor: 0x2a2a3a,
|
||||
});
|
||||
document.body.appendChild(app.view);
|
||||
let elapsed = 0.0;
|
||||
|
||||
let spriteSkull = PIXI.Sprite.from('/assets/skull.png');
|
||||
let spriteSpiderWeb = PIXI.Sprite.from('/assets/spider-web.png');
|
||||
spriteSpiderWeb.y = (360 / 2) - (spriteSpiderWeb.height / 2)
|
||||
// PIXI.Assets.add('texture_name', '/assets/texture.png');
|
||||
|
||||
app.stage.addChild(spriteSkull);
|
||||
app.stage.addChild(spriteSpiderWeb);
|
||||
// let promise = PIXI.Assets.load(
|
||||
// ['texture_name'],
|
||||
// (progress) => {
|
||||
// if (DEBUG)
|
||||
// console.log(`Assets loading progress: ${progress * 100}%`);
|
||||
// });
|
||||
|
||||
app.ticker.add((delta) => {
|
||||
elapsed += delta;
|
||||
spriteSkull.x = 100.0 + Math.cos(elapsed/50.0) * 100.0;
|
||||
});
|
||||
|
||||
app.ticker.add((delta) => {
|
||||
elapsed += delta;
|
||||
spriteSpiderWeb.x = 100.0 + Math.cos(elapsed / 50.0) * 100.0;
|
||||
});
|
||||
// promise.then((value) => {
|
||||
// backgroundTextures = value;
|
||||
// initLevel();
|
||||
// });
|
||||
}
|
||||
|
||||
/** Level init */
|
||||
function initLevel() {
|
||||
'use strict';
|
||||
|
||||
app.ticker.add(gameLoop);
|
||||
}
|
||||
|
||||
/** Game loop */
|
||||
function gameLoop(delta) {
|
||||
'use strict';
|
||||
|
||||
//
|
||||
}
|
||||
|
@ -3,8 +3,8 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>pixi - template</title>
|
||||
<script type="text/javascript" src="/pixi.js"></script>
|
||||
<title>pixi.js - template</title>
|
||||
<script type="text/javascript" src="pixi.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
|
Loading…
Reference in New Issue
Block a user