by

Scene Preload an Image

command format: Example:this.load.image("key", "path");
Description:Use this in the scene.preload function. .png are the default images. You can also set the "base URL"
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/4243816/Scene-Preload-an-Image?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
// ============ // Example 3.4: Additional Phaser Properties begins // ============ // remote URL to game assets // Cross-origin resource sharing (CORS) this.load.setCORS = 'anonymous'; // Setting base URL path this.load.setBaseURL('http://makingbrowsergames.com/p3devcourse/_p3demos/imgages/'); // Preload a gfx asset this.load.image("face", "face.png");
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus