You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and it shows the following error in my browser's console:
Uncaught TypeError: Cannot read property 'set' of undefined
Can someone tell me what's undefined in my code?
Also, i have the whole code:
<!doctype html>
<title>Hello World</title>
<script src="pixi.min.js"></script>
<script type="text/javascript">
var type = "WebGL"
if(!PIXI.utils.isWebGLSupported()){
type = "canvas"
}
//Create a Pixi stage and renderer and add the
//renderer.view to the DOM
var stage = new Container(),
renderer = autoDetectRenderer(256, 256);
document.body.appendChild(renderer.view);
I copy-pasted the following code into my program:
var message = new Text(
"Hello Pixi!",
{fontFamily: "Arial", fontSize: 32, fill: "white"}
);
message.position.set(54, 96);
stage.addChild(message);
and it shows the following error in my browser's console:
Uncaught TypeError: Cannot read property 'set' of undefined
Can someone tell me what's undefined in my code?
Also, i have the whole code:
<!doctype html>
<title>Hello World</title> <script src="pixi.min.js"></script> <script type="text/javascript"> var type = "WebGL" if(!PIXI.utils.isWebGLSupported()){ type = "canvas" }//Aliases
var Container = PIXI.Container,
autoDetectRenderer = PIXI.autoDetectRenderer,
loader = PIXI.loader,
resources = PIXI.loader.resources,
Sprite = PIXI.Sprite;
TextureCache = PIXI.utils.TextureCache;
//Create a Pixi stage and renderer and add the
//renderer.view to the DOM
var stage = new Container(),
renderer = autoDetectRenderer(256, 256);
document.body.appendChild(renderer.view);
loader
.add("images/myspritesheet.json")
.load(setup);
var sprite;
function setup() {
var texture = TextureCache["heart.png"];
sprite = new Sprite(texture);
sprite.y=30;
stage.addChild(sprite);
var message = new Text(
"Hello Pixi!",
{fontFamily: "Arial", fontSize: 32, fill: "white"}
);
message.position.set(54, 96);
stage.addChild(message);
gameLoop();
}
function gameLoop() {
requestAnimationFrame(gameLoop);
sprite.x += 1;
renderer.render(stage);
}
</script>
The text was updated successfully, but these errors were encountered: