Jump to content

[Solved] How to load images to JSFiddle for Phaser


Recommended Posts

I found the answer here: https://jsfiddle.net/8Observer8/98xrv9x5/7/

This code is from this tutorial: https://developer.mozilla.org/en-US/docs/Games/Tutorials/2D_breakout_game_Phaser

function preload()

    // ...

    game.load.image('ball', 'img/ball.png');

// This function (needed only on JSFiddle) take care of loading the images from the remote server
function handleRemoteImagesOnJSFiddle()
    game.load.baseURL = 'https://end3r.github.io/Gamedev-Phaser-Content-Kit/demos/';
    game.load.crossOrigin = 'anonymous';


Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...