Search the Community

Showing results for tags 'phaser'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 3,275 results

  1. Gamma

    Font Problems

    I recently launched a game called Robo Dash, and I few people have sent me some comments saying that the game has font issues where when the player loses the match and replay the font gets bolder and bolder. It doesn't seem to register the font I placed in the code. I decided to go with a bold font I found on Google fonts named 'Chango', but when the game starts it's very thin, and then becomes bold once the game restarts. Can someone help me with this issue. Code is down below: HTML Header: <link href='' rel='stylesheet' type='text/css'> Create Function: scoreText =, 210, "SCORE: " + score, { font: "30px Chango", fill: "#ecf0f1" }); highScoreText =, 240, "HIGHSCORE: " + highscore, { font: "30px Chango", fill: "#ecf0f1" }); intensityText =, 270, "INTENSITY: " + counter, { font: "30px Chango", fill: "#ecf0f1" });Robo Dash Game
  2. I've been testing Phaser on Windows Phone 7/8, and I've run into couple of problems. 1) Phaser doesn't recognize Windows Phone as mobile device on game.device Phaser 1.1.5 recognizes Windows Phone as a desktop device at game.device.desktop. I checked the phaser's online docs for game.device, and there doesn't appear to be any user agent checks for windows phone. There is a check for the existence of 'windows' string that subsequently sets the game.device.desktop value true. According to a stack overflow answer, the safest thing would be to check user agent for the 'windows phone' string. In addition to the normal mobile mode, there's also a desktop mode in some windows phone models, that is missing the 'phone' part on user agent. The desktop mode is trying to mask itself as desktop version, it appears to be pretty hard to distinguish it from real windows 8 machine. 2) Game resizes incorrectly on Windows Phone I'm having problems getting my game to scale properly on windows phone 8, when using 480x320 resolution for the game. I have tried using the full screen mobile template under resources folder, with minor changes, but that doesn't seem to work. I'm testing on Nokia Lumia 920 in mobile mode with screen resolution 1280×768. I thought setting game.stage.scalemode to Phaser.StageScaleMode.SHOW_ALL would have resized the app to fit inside the browser, but as it is, it doesn't do that. SHOW_ALL only sets the width of the app to match the width of the screen when in landscape mode. Due to this the height of the game is almost twice the screen's height. EXACT_FIT and NO_SCALE don't work any better. Is this is the intended functionality, or am I just missing something? I have been testing the game on android tablets as well, but windows phone is the only one where I'm running into this problem. My settings: var game = new Phaser.Game(480, 320, Phaser.AUTO, 'game');game.stage.scaleMode = Phaser.StageScaleMode.SHOW_ALL;game.stage.scale.minWidth = 320;game.stage.scale.minHeight = 240;game.stage.scale.maxWidth = 960;game.stage.scale.maxHeight = 640;game.stage.scale.pageAlignVertically = true;game.stage.scale.pageAlignHorizontally = true;game.stage.scale.forceOrientation(true, false);game.stage.scale.enterIncorrectOrientation.add(this.enterIncorrectOrientation, this)game.stage.scale.leaveIncorrectOrientation.add(this.leaveIncorrectOrientation, this)game.stage.scale.setScreenSize(true); 3) Some Windows Phone models don't trigger game.stage.scale.leaveIncorrectOrientation on orientation switch I'm also having problems with Nokia Lumia 620 (another windows phone) when switching from portrait to landscape. As mentioned above I'm using the full screen mobile template, and i haven't touched the code on this part. The game correctly shows the turn your phone to landscape mode image (from the template) in the portrait mode. When the device is turned to landscape mode, the same image is still visible, only zoomed in to the top left corner of the image. Problem seems to be that game.stage.scale.leaveIncorrectOrientation isn't triggering correctly on the device. The device is able to change from landscape to portrait, so it's no a question of a missing sensor. This problem doesn't appear on Lumia 920, although I've managed to have it happen couple of times with chrome on my laptop when switching browser window size while developer tools are open. Any ideas what could be causing this, or how should I handle this? 4) Using console.log on Windows Phone is a bad idea This last one isn't related to Phaser, just something I realized after trying to debug my app on windows phone, and thought of sharing. Apparently, from time to time, even though Windows Phone's browser doesn't have visible console available. the console in it can crash/close. When it does, it sets the console global undefined. So, if you are getting mysterious crashes when trying to run development code on windows phone, it might be due to your console.log statements. In order to get rid of the problem, you need to create a new console object somewhere in your code, if one doesn't already exist. The code below is from if (typeof console == 'undefined') { var console = new Object(); console.log = function(){} console.error = function(){} console.debug = function(){} console.warn = function(){}}
  3. Gamma

    Robo Dash

    Robo dash is a project that I have been working on for a couple of days now. I started a independent software studio back in 2012 named 'Somnibyte', and since 2012 I have been experimenting, but experimenting without any production. And so today I am happy to say that this is my first HTML5 game to be produced. It may still have some features to be implemented. I went with the theme of challenging/addicting, and so Robo Dash was the result. Robo Dash features a small robot toy named, 'Gamma'. The player is suppose to move Gamma across the kitchen table to dodge oranges that fall from the kitchen cabinets above. I hope you all enjoy this game. Feel free to post some feedback, ideas, bug reports, or comments. [ROBO DASH GAME] *Currently not optimized for mobile use, changes will take place soon.
  4. AprendizEnLaRed

    [Phaser] My CV

    Hello, I create a little game for my personal resume. It's in spanish. Fist the instructions. with C and J start to play. the game is to write phrases that appear in screen. For each word a bullet is fired Spanish characters can be replaced by standard character (ñ->n, á->a ...) It can be improved but to be the first one I'm happy Edit link:
  5. I replace a tile with no collision with one that has, but the collision info stays the same. You can reproduce this by using the paint tiles example. Apply collision to a couple of tiles by using setCollisionBetween() and enable debug on the tilemap layer. Paint with tiles that has collision and you'll see the debug lines never update. You can try it yourself at Shift + click the tiles within the green border, click to paint them anywhere. There's also a test for 1.1.3 at I couldn't find any debug drawing for tilemaps in 1.1.3 so I added the race car from another example. Use the arrows to drive around. You'll see the car stop at the tiles that has collision enabled. Painting new tiles and watch the car stop at them too. How come this worked in 1.1.3 and not in 1.1.5? Am I doing something wrong?
  6. Hello. I'm experiencing some issues with collision between sprites and tilemaps, and cannot figure out how to fix it. It used to work in 1.1.3, so I have clearly messed up something. You can see for yourself here: Use WASD to move and click the mouse to shoot a wooden box. I have limited the shooting to only one box, so you have to reload the page to shoot again. It made it easier to track what's happening. I want the collision callback to fire when the sprite hits a wall so that I can kill the box. The callback only triggers when you shoot at the corner of a tile, and never when the box hits a wall perpendicular. I'm using Phaser 1.1.5. View source to see how I did it. Source code pasted here, in case you prefer that. Bullet = function(game) {, game, -100, -100, 'stuff', 0); this.anchor.setTo(0.5, 0.5); this.outOfBoundsKill = true;};Bullet.prototype = Object.create(Phaser.Sprite.prototype);Bullet.prototype.constructor = Bullet;var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'gameContainer', {preload:preload, create:create, update:update, render:render});var map;var layer;var player;var cursors;var bullets;var w, a, s, d;var counter = 0;var fireRate = 100;var nextFire = 0;function preload() { var assets = { spritesheet: { player: ['players.png', 16, 16], bullets: ['bullets.png', 32, 32], stuff: ['jerom_eiyeron.png', 16, 16] }, tilemap: { map01: ['map02.json', null, Phaser.Tilemap.TILED_JSON] }, image: { dungeon: ['DF_Tilemap01.png'] } }; Object.keys(assets).forEach(function(type) { Object.keys(assets[type]).forEach(function(id) { game.load[type].apply(game.load, [id].concat(assets[type][id])); }); });}function create() { map = game.add.tilemap('map01'); map.addTilesetImage('DF_Tilemap01', 'dungeon'); map.setCollisionBetween(0, 15, true, 0); layer = map.createLayer('Walls'); layer.resizeWorld(); layer.debug = true; player = game.add.sprite(48, 48, 'player', 0); cursors = game.input.keyboard.createCursorKeys(); w = game.input.keyboard.addKey(Phaser.Keyboard.W); a = game.input.keyboard.addKey(Phaser.Keyboard.A); s = game.input.keyboard.addKey(Phaser.Keyboard.S); d = game.input.keyboard.addKey(Phaser.Keyboard.D); bullets =; bullets.add(new Bullet(game));}function update() { player.body.velocity.x = 0; player.body.velocity.y = 0; if (w.isDown) { player.body.velocity.y = -200; } else if (s.isDown) { player.body.velocity.y = 200; } if (a.isDown) { player.body.velocity.x = -200; } else if (d.isDown) { player.body.velocity.x = 200; } if (game.input.activePointer.isDown) { var bullet = bullets.getFirstDead(); if (bullet !== null) { fire(bullet); } else { bullet = bullets.getAt(0); bullet.kill(); bullet.revive(1); fire(bullet); } } game.physics.collide(player, layer); game.physics.collide(bullets, layer, bulletHitWalls);}function fire(bullet) { if ( > nextFire && bullets.countDead() > 0) { nextFire = + fireRate; bullet.reset(player.x, player.y); var angle = game.physics.angleToPointer( bullet, game.input.activePointer); bullet.body.velocity.x = Math.cos(angle) * 300; bullet.body.velocity.y = Math.sin(angle) * 300; }}function bulletHitWalls(bullet, wall) { bullet.kill(); console.log('wall tile index',wall.tile.index);}function render() { game.debug.renderText('Active Bullets: ' + bullets.countLiving() + ' / ' +, 32, 32);}
  7. hyspanux


    Hi all, I'm new at phaser and TypeScript. I'm starting to use it following the examples. I try to change the text of a bitmapText object but setText function is not defined. I looked for it in the .d.js but it wasnt there. my code is like .. export class MainMenu extends Phaser.State{ fntDesyrel :Phaser.BitmapText; create() { this.fntDesyrel =, 148, "PHASER", { font: '94px Desyrel', align: 'center' }); } newText(_t : string) { this.fntDesyrel.setText(_t); /* <- Unresolved function or method setText */ }} Can anyone help me?thanks in advance.
  8. aurelien974

    [Phaser] Save Flappy Birds

    Hi all ! Here is the first game i released using Phaser (amazing tool, thanks rich and all contributors) ! I made it in a week for the Flappy Jam. Save Flappy Birds is simple : you have to jump over running flappy birds. Its originality consists of the possibility to swap between 2 characters of different weight. Master this to make a great score ! The game is also playable on a touchscreen and i'll soon try to make it available on the AppStore and Google Play Store (never did it before, if you have any advice let me know). >> The link of my entry on : << (and soon on my website too) >>> EDIT : to rate the game : <<< EDIT : here is the source on GitHub : Have fun and give me your feedback
  9. I am currently using the Phaser project template located on Github. I tried to search online for a way to minify my game files, yet I've ran into pages that talk about using 'GruntJS'. I am currently not familiar with the javascript task runner. Can anyone give me links to tutorials on how to minify phaser games? Or can anyone post a detailed description on how to do so? I would appreciate it greatly.
  10. Hi, I just want to mention my Flappy Bird inspired game Tubeyflaps ( I've made it using Phaser. It's far away from a master piece and mainly a proof of concept and proof of my grunt based phaserBoilerplate ( The whole game is MIT licensed and OpenSource. You can find it here: Cheers! Casarock
  11. Hi, I just changed from 1.1.2 to 1.1.4 and i can't detect to collision side of my sprite. define("Play", ['Game', 'Holoboy'], function(Game, Holoboy) { var Play = function (){ = Game; this.holoboy;; this.layer; }; Play.prototype = { preload: function(){, 0, 'preloaderBackground'); }, create: function(){ this.holoboy = new Holoboy(0,0); ='map');'tiles');, 12); this.layer ='Calque de Tile 1'); }, update: function(){ this.holoboy.move();, this.layer); console.log(this.holoboy.sprite.body.touching); } } return Play; });My console.log(this.holoboy.sprite.body.touching); always alert me Object {none: true, up: false, down: false, left: false, right: false…} My holoboy object : My controllable object : The collision works well by the way. My character can jump on the tiles and he is stopped by them. What's wrong with my code? Thank you
  12. Hey guys.I wanted to make a fuctionality through which If i select a sprite its gets replaced by a highlighted version of that sprite(the ones with selected in their name) and the other objects become rplaced by their unhighlighted version however with the current code whats happening is when testing the program it seems to be making an stran instance of the unhighlighted versions. function create () { mothership = game.add.sprite(90,100,"mothership"); mothership.inputEnabled=true;,this);;//the bots group bot1=bots.create(400,100,'bot1'); bot1.inputEnabled=true;,this); bot2=bots.create(700,100,'bot2'); bot2.inputEnabled=true;,this); } function listener(sprite, pointer) { if(sprite==mothership) { sprite.kill(); MothershipSelect(); Bot1(); Bot2(); } if(sprite==mothershipSelected) { sprite.kill(); Mothership(); } if(sprite==bot1) { sprite.kill(); Bot1Select(); Mothership(); Bot2(); } if(sprite==bot1Selected) { sprite.kill(); Bot1(); } if(sprite==bot2) { sprite.kill(); Bot2Select(); Mothership(); Bot1(); } if(sprite==bot2Selected) { sprite.kill(); Bot2(); } } function MothershipSelect() { mothership.kill(); mothershipSelected = game.add.sprite(80,100,"mothershipSelected"); mothershipSelected.inputEnabled=true;,this); } function Mothership() { mothershipSelected.kill(); mothership = game.add.sprite(90,100,"mothership"); mothership.inputEnabled=true;,this) } function Bot1() { bot1Selected.kill() bot1=bots.create(400,100,'bot1'); bot1.inputEnabled=true;,this); } function Bot1Select() { bot1.kill(); bot1Selected=bots.create(400,100,'bot1Selected'); bot1Selected.inputEnabled=true;,this); } function Bot2() { bot2Selected.kill(); bot2=bots.create(700,100,'bot2'); bot2.inputEnabled=true;,this); } function Bot2Select() { bot2.kill(); bot2Selected=bots.create(700,100,'bot2Selected'); bot2Selected.inputEnabled=true;,this); }
  13. redwoodfavorite

    Trouble animating a texture atlas

    Hello, I'm having some trouble animating a sprite atlas. I apologize if this is something I'm doing wrong in TexturePacker but I can't seem to get it to animate right in Phaser. I loaded the atlas using game.load.atlasJSONHash() and it IS flipping through all the frames. The problem, however, is that the textures seem to re-center on the sprite based on the width of the particular frame. The running animation for my sprite worked perfectly because the width and height of each frame stayed the same, but when my sprite extends his sword out from his body and expands his size, his texture is re-centered. This causes his whole body to appear to shift over slightly. It almost seems as if I need to adjust the anchor point for the sprite at each frame. I hope that explanation makes sense. Here are some pictures of my spritesheets. It is worth noting that the slash animation works as intended if I don't perform the trimming and I leave all the frames the same size. TRIMMED: NOT TRIMMED: Any help would be greatly appreciated. Really enjoying Phaser thus far!
  14. Videlais

    Common Phaser + CocoonJS issues

    Last update of this information was 13 August 2014. Note: As of this writing, CocoonJS (2.0.*) comes in a total of three modes. [system] WebView creates an instance of the default browser for a platform, loads its own API, and then hands off the code execution. In most cases, it is the same as running the code in a mobile platform's default browser. WebView+ is often the same as WebView, but adds in Chromium-based libraries. For Canvas+ mode (previously accelerated, "Canvas 2D/WEBGL") it strips out things like XML and most DOM and CSS support to make running the canvas as fast as possible. Because of this, most common things like getElementById and createElement in JavaScript have reduced functionality. It is designed purely for Canvas-based projects. (For the 2.0 branch, see the changelog from 1.4.7.) Since there is limited DOM support, make sure to use an empty string for the parent element during the creation of a game object when using the accelerated/Canvas+ mode. (This is to make sure the created canvas element is appended to the document.body object, and not some other element the getElementById function cannot find.) var game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.CANVAS, '', {preload: preload, create: create, update: update});Issues with Phaser <= 2.0.7 and CocoonJS <= 2.0.2 (Canvas+) Images Use of multiple images may introduce disappearing or flickering results. Text Single-line text printing works. However, using the newline character will not produce the correct results. Setting anchor.y values do not work correctly.Shadows do not work. XML CocoonJS does not have native support for XML. Its XHR does not return responseXML and it does not have a window.DOMParser object. Scaling Generally, you can use window.innerWidth and window.innerHeight to compute the size of the screen in CocoonJS. However, if you know there might be a device pixel ratio issue, the following code works for that. var width = window.innerWidth * window.devicePixelRatio;var height = window.innerHeight * window.devicePixelRatio;Depending on your needs, Phaser's built-in scaling manager will often be enough. However, the following code suggested by Starnut should be helpful for accounting for odd screen sizes as well. var w = window.innerWidth * window.devicePixelRatio,h = window.innerHeight * window.devicePixelRatio,width = (h > w) ? h : w,height = (h > w) ? w : h;// Hack to avoid iPad Retina and large Android devices. Tell it to scale up.if (window.innerWidth >= 1024 && window.devicePixelRatio >= 2){width = Math.round(width / 2);height = Math.round(height / 2);}// reduce screen size by one 3rd on devices like Nexus 5if (window.devicePixelRatio === 3){width = Math.round(width / 3) * 2;height = Math.round(height / 3) * 2;}var game = new Phaser.Game(width, height, Phaser.CANVAS, '');BitmapFonts Because of the lack of XML support, one solution for BitmapFonts is to convert the XML into JSON and use an alternative loader. This post covers the code needed and what to use to convert the XML into JSON. Audio Most often, audio problems are related to the device itself, not CocoonJS or Phaser. If you are running on an Android device, make sure you have OGG or WAV (16-bit ONLY) files. Apple devices support MP4, OGG, MP3, WAV (16-bit ONLY), or MPEG. (Remember too that MP3 decoding, depending on the device, can often be slow.) On some platforms, a user-activated event (like touch) is needed to enable sound. This specifically affects iOS devices, but is not uncommon on other platforms too. Using something like a "Tap to Continue" button or an initial menu works well to signal to the player to tap to enable both the game and sounds. Filters Filters don't work currently. (As reported here.) Buttons There is currently a problem where image-based buttons can sometimes disappear. It is under investigation. It is HIGHLY recommended to update to newer versions of Phaser ( >=2.0.7) and CocoonJS ( >=2.0.2). Issues between older versions of both libraries are no longer being actively tracked.
  15. Guys I have the following code to make a star sprite and 2 firstaidbox(added through group) sprites.what i want is that when i click the star the firstaid boxes should dim(alpha=0.5) and vice versa.however the mouse event doesnt seem to work when I click the firstaid boxes. function create () { starimage = game.add.sprite(100,100,"star"); starimage.inputEnabled=true;,this);//the firstaid boxes for(var i=2;i<4;i++) { var myvar=bots.create(i*100,100,'firstaid'); myvar.inputEnabled=true;,this); } } function listener(sprite, pointer) { if(sprite==starimage) { sprite.alpha = 0.5; bots.alpha=1; } if(sprite==bots) { alert("clicked"); sprite.alpha = 0.5; starimage.alpha=1; } }
  16. I know the number of FlappyBird clones flooding the internet is getting a bit ridiculous, but I couldn't resist making one myself! I made the game with Phaser and was pleasantly surprised at how intuitive it feels - all round a great framework. As it was a learning excercise for myself, I've liberally documented the source so hopefully other phaser beginners can benefit from it. Play it here Hope you enjoy! p.s. my hiscore is 14, can you beat it?
  17. StefanWeck

    Dynamic Tilemap

    Hey everyone! Recently i have created an Random Dungeon Generator ( ), and i'm porting it to a plugin for Phaser. The only problem i encounter is loading my custom map in the game! I've tryed preloading an "empty" ( just dummy data, 0's etc ) json file, setting that as my tilemap and change it. I've tryed creating an empty tilemap and fill it with my data. Even tried to generate my output the same as the example json tilemap files, but that's a big pile of work. Is there any solution for doing this? Is there an example where someone creates an empty tilemap object and fills it with data? The examples on the Phaser website only load pre-defined maps as .json files. Thanks in advance! Stefan
  18. Hi all, Please find the following link which I have done using construct2 game engine and it took me almost a week to do this. Considering my programming skill of a designer(who also codes sometimes) it would take more time in Phaser. Can you help me out with a code snippet which simulates the action shown in the link The algorithm I have used is ... I am storing the trails as the player is touching the screen and storing the X,Y, direction (relation between previous consecutive trails) in an array which I am looping through and then changing the Y position of the main Sprite when the X of the next trail is less than the main sprite. ..if the current direction is LEFT to RIGHT.similarly changing the Y position of the main sprite if the X of next trail is greater than the main sprite ..if the current direction is RIGHT to LEFT sorry if the explanation for the algo is crude thanks
  19. Hey guys,Ive been working on making a level editor in unity and then storing the resultant transform information like scale,position and rotation in a.json file to be read by phaser.while the position and rotation work perfectly well by changing the pivot of the sprites in unity.the scale doesnt seem to work ie the scaling in unity doesnt show the same result in phaser.if anyone has suggestion on how to calibrate it please let me know.
  20. aihimel

    How to restart a Game.

    Hello Everyone, I am trying to develop a breakout type game. But can't restart the game. Is there any easy way to do that? Thanks in advance.
  21. I would like it so that when a certain event happens, the player completely stops moving (for a few seconds or so), the user does not have the ability to move at all, and I am then able to proceed to call a function (which calls a function to end the game). How would I implement this? Here is a snippet of code located in my Update function: (Please note: I am using the Phaser basic template, so when calling functions and methods, we must use 'this'. if (, certainItem)) { var hit ='hit');; certainItem.kill(); player.body.velocity.x = 0; // Tried to stop, but I am still able to move him'hit'); // Changes to the frame I wanted but then quick //-ly changes back // this.gameOver(); }Thank you in advance.
  22. rumdumdum

    Swipe to Jump

    Hello. I am looking to add a swipe action, so that I can make the player jump. For navigation I have split the screen in two parts, if player clicks and holds on one right side the character will move right and vice versa. if (game.input.pointer1.isDown){ if (Math.floor(game.input.x/(game.width/2)) === LEFT) { // Move to the left player.body.velocity.x = 150;'right'); } if (Math.floor(game.input.x/(game.width/2)) === RIGHT) { // Move to the right player.body.velocity.x = -150;'left'); } }How can I record swiping up? Cheers Richard
  23. Dream Of Sleeping

    Is it possible to crop left side of image?

    Hello. I know altering the width of the crop of a sprite takes away from the right side of the image. I really need to crop the left side. I've tried altering the crop x properties but just get a kind of black shadow added on the end. I can't make sense of what is going on. Here is an example. I've cropped the left side of the robot arm, but now you can see the black line going onto the pipe. I need to get rid of that.
  24. My first game with the phaser framework. It's a browser game where you control a bird & a little guy to help them escape. You can switch between the bird and Finn and need to catch the feathers to stay alive. This is just the first version of the game and we are probably going to expand the game with more powerups and enemy's in the near future... Here is the link to the game if you want to try it out Let me know what you think about it.
  25. miguelfeliciano

    Best Practice for Graphics

    I'm still new to Phaser and have a concern of best practice for loading up images with my main concern being performance. I understand how to load up images and sprites (for characters and such), but I'm building a game much like Scrabble and I created a spritesheet containing all of the images I would need. I was able to load up the board for the game, but now I want to load up the rest of the images in that spritesheet. The only option I can think of is to cut up the spritesheet in PS and have individual images to load up separately; I don't think a tilemap would work in my situation. I was hoping to have one spritesheet (png) to load and just tell Phaser where all of the images are in that spritesheet. I would think this would be something of a best practice instead of loading each image individually. I'm also experimenting with the Tiled app and generating the tilemap data and then loading whatever individual images I need to load; each image would need to be draggable. What other options are available to me?Is there a plug-in that can extend the functionality of the game.load.image function?What's the best practice in this kind of game scenario? Thanks in advance