簡體   English   中英

如何使用 Pixi.js 構建視差滾動器

[英]How to build a Parallax Scroller with Pixi.js

我在使用 pixi.js“使用 Pixi.js構建視差滾動器:第 1 部分”教程時遇到問題。

<!DOCTYPE html>
 <html>
 <head>
    <meta charset="utf-8">
    <title>Parallax Scrolling Demo</title>
    <style> 
        body { background-color: #000000; }
        canvas { background-color: #222222;}
        </style>
 </head>
 <body onload="init();">
    <div align= "center">
        <canvas id= "game-canvas" width= "512" height="384"></canvas>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pixi.js/4.0.0/pixi.min.js" ></script>
    <script> 
        function init() {
            stage = new PIXI.Container();
            renderer = PIXI.autoDetectRenderer(512,384, {view:document.getElementById("game-canvas")});

            var farTexture = PIXI.Texture.fromImage("resources/bg-far.png");
            far = new PIXI.Sprite(farTexture);
            far.position.x = 0;
            far.position.y = 0;
            stage.addChild(far)S

            renderer.render(stage);
        }
        </script>

 </body>
 </html> 

我無法渲染我的圖像。

在 Microsoft 中構建文件時,重要的是返回到“屬性”-->“安全”並確保您的權限設置匹配(對於每個文件)。 此外,為了避免 CORS 錯誤,使用管理設置也很重要; 特別是在 IIS 或 Internet 信息服務中的設置。 在這里,您需要檢查和調整您的權限設置。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM