Search the Community

Showing results for tags 'function'.

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
    • Pixi.js
    • Babylon.js
    • Panda.js
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Found 33 results

  1. I am trying to make a gate that opens when you click on it, and rotate it 90 degrees. I have accomplished this much, but how do I make it go back to it's original position once I click on it again? For instance: *clicks on gate, gate opens, 90 degrees.* *clicks on gate again, gate closes, -90 degrees from the 90 degrees that it went on previous click* Any help would be appreciated! html: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Simple Canvas Game</title> <style> html { background: black } canvas { margin: auto; } </style> </head> <body> <script src="phaser.js"></script> <script src="game.js"></script> </body> </html> game.js var game = new Phaser.Game(550, 540, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); function preload() { game.load.crossOrigin = 'anonymous'; game.load.image('gateopen', 'fenceleft.png'); } var sprite function clickSprite() { console.log("clickSprite"); sprite.angle += 90; } function clickGame() { console.log("clickGame"); } function create() { sprite = game.add.sprite(100, 100, 'gateopen'); sprite.anchor = {x: 1, y: 1} game.inputEnabled = true; sprite.inputEnabled = true; game.input.onDown.add(clickGame); } function update() { } function render() { game.debug.bodyInfo(sprite, 32, 32); game.debug.body(sprite); }
  2. splitting Game.js into many files

    Hi, sorry for very noobish question I have my phaser game.js file which have reached more than 700 lines of code. I want to divide it into documents containing f.e. only create function, update, variables and other functions. I thought this will work: <div id="game"> <script type="text/javascript" src="game.js"></script> <script type="text/javascript" src="create.js"></script> <script type="text/javascript" src="update.js"></script> <script type="text/javascript" src="functions.js"></script> </div> But error, create function not found. In game.js it look like this: var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); function preload() { (...) } function create() { (...) } function update() { (...) } functions....
  3. Alright. I'll cut to the chase. I'm making a simple game about abducting people, and I want the victims to run from the player or "flying saucer". This is what I have setup in the update function (I'm pretty sure the rest is irrelevant, but tell me if you need more): = game.physics.arcade.angleToXY(, -(this.player.x), -(this.player.y)); = game.physics.arcade.velocityFromAngle(, 145,;, 0, false); Now here is the error after getting to the "play" state (Oh and by the way, the game is based off of the state tutorial for phaser, except with a lot of edits and a lose.js file.): Uncaught TypeError: d.setTo is not a function at c.Physics.Arcade.velocityFromAngle (phaser.min.js:23) at Object.update (play.js:94) at c.StateManager.update (phaser.min.js:10) at c.Game.updateLogic (phaser.min.js:12) at c.Game.update (phaser.min.js:12) at c.RequestAnimationFrame.updateRAF (phaser.min.js:18) at window.requestAnimationFrame.forceSetTimeOut._onLoop (phaser.min.js:18) Please help!
  4. Function is undefined

    Hello, I'm creating, a player object with different states, e.g: onground, inair, etc I'm trying to assign a method to this.currentState. In the update loop, i'm calling this.currentState to run the assigned method (this.groundState), However, i'm receiving the following error 'this.currentState is not a function' SuperSmash.Player = function(game, x, y) {, game, x, y, 'player');; this.speed = 500; this.airSpeed = 300; this.jumpPower = 400; this.inAir = true; this.hitGround = false; this.body.gravity.y = 1350; this.currentState = this.groundState; console.log(this.currentState); // undefined }; SuperSmash.Player.prototype = Object.create(Phaser.Sprite.prototype); SuperSmash.Player.prototype.constructor = SuperSmash.Player; SuperSmash.Player.prototype.update = function() { this.currentState(); }; SuperSmash.Player.prototype.groundState = function() { console.log('ground'); } };
  5. I am having difficulty understanding this and scope in Javascript. I am attempting to create a dialogue box that pops up during various collisions, and perhaps part of the issue is I am not properly organizing my game. I can use this.showPopup("jump"); in the update function, but I cannot figure out how to call the showPopup function elsewhere, in getItem. I keep getting the error, "Uncaught TypeError: this.showPopup is not a function(…)" Any help is greatly appreciated. create: function() { ... popup = game.add.sprite(window.innerWidth/2, 200, 'box'); ... }, update:function (){ game.physics.arcade.overlap(player, cake, this.getItem); }, getItem:function(player,item) { console.log('got ' + item); item.kill(); this.showPopup("test"); }, showPopup: function(t){ popup_timer = game.time.create(false); popup_timer.add(1000, this.hidePopup, this); popup.text = t; tween = game.add.tween(popup.scale).to({x:1,y:1},500, Phaser.Easing.Elastic.Out, true); popup_timer.start(); }, hidePopup: function(){ tween = game.add.tween(popup.scale).to( { x: 0.0, y: 0.0 }, 500, Phaser.Easing.Elastic.In, true); }
  6. How can i control the initilization of the game, i know that the first that phaser do is the preload function but i want to execute some Js code and till that part is finished start the game. Help please
  7. hi, I would make a custom function to have tween more simple. I would have readable params in the function because i have a lot of value. i could do : function transition (obj,xbegin,ybegin,easing,delay,time....) //but it become difficult to read transition(player,100,100,Phaser.Easing.Linear.None,100,2000,...) but it become difficult to read. I put below a short example of what i would do : function transition(xbegin=x_begin) { console.log(x_begin) } transition(xbegin=100)//but that don't work because xbegin is undefined here the jsfiddle : Thanks.
  8. Hi, I'm new to phaser and so this might be a basic question. I did see: but that did not work for me. This code works: create: function() {, this); } backToMenu: function() { //do something } but create:function() {, {test: 0}); } backToMenu: function() { //do something with this.test } does not work at all. If you need more code, I will show you an example project. Thanks!
  9. Hello ! I really want to read the source code of phaser, but I am not that professional. the namespace Phaser is declared inside a function, so I am wondering how we can access it outside it ? (function(){ var Phaser = Phaser || {}; }).call(this); Phaser.something = 5; //Reference error, Phaser is not declared what things I ca learn to read the source code perfectly and have this awesome experience ?
  10. having trouble with a function

    Hi all, I'm having trouble with a in-built method of phaser. I want to check whether the sprite named target has been struck by the bullet or not. For this, I used the containsPoint() method of Phaser.Rectangle. My code looks like this. Am I doing something wrong? or my whole logic is wrong? Thanks in advance
  11. Hi, I'm new to pharser. I created several functions like move() in the Game.js TestGame.Game.prototype = { ... drawPath: function() { ... } Everything is working well. No I would like to access the drawPath function from outside oth the class, e.g. <button onlick="TestGame.Game.drawPath()"> but get "is not a function" Error.
  12. Global Function How?

    Hey there, I'm new to javascript and I'm trying to figure out how to create a global singleton for generic functions. I can create global variables in the Boot state, but I'd like to create an object that holds global vars and functions. I'm instancing a custom GameManager script in the index.html file like so: //initialize framework var game = new Phaser.Game(640, 960, Phaser.AUTO, 'game'); //create global object var gameManager = new GameManager(); My GameManager.js file looks like this: var GameManager = function GameManager() { console.log('game manager created'); this.myName = "adrian"; this.GetName = function() { console.log("my name is "+this.myName); } }; The problem is gameManager object is undefined elsewhere in game. Any suggestions? Thanks
  13. Greetings people smarter than myself. This is my first phaser self-guided exercise. I'm also very new to object oriented programming - and that may be the issue at hand. I have a single gamestate, "playgame", which has a placeTiles() function that I don't want to execute until a user clicks a "Begin" button. However, my code is not working as intended because the placeTiles() function is executing immediately upon loading. I think there is a fundamental concept that I'm missing. As you can see, I'm using preload, create, then some of my own - placetiles, showtile. Is it SOP for all of the functions inside playGame.prototype to run on initialization? If I don't want something running at that time, how do I prevent it or where should I move that block of code? Wouldn't it need to go within playGame somewhere? playGame.prototype = { myMoney: null, theEmpire: [], preload: function(){ game.stage.setBackgroundColor(0xEBEBFF); game.load.spritesheet("gadgets", "gadgets.png", tileSize, tileSize); }, create: function(){ // I've removed some code here where I create my background and color scheme // Create the Begin Button which should place the other tiles. var beginButton = game.add.button( 20,50,"gadgets",this.placeTiles(),this); beginButton.frame = 10; // There's a bunch more code here I've removed for this forum post */ }, placeTiles: function(){ for(var i=0; i < numCols; i++){ var serialButton = game.add.button( 250 * (i+1) , game.height/5 + (i*tileSpacing) , "gadgets" , this.showTile , this); serialButton.frame = i+1; serialButton.value = this.theEmpire[i]; }//i++ }, showTile: function(target){ //More functions, etc... },}; game.state.add("PlayGame", playGame); game.state.start("PlayGame"); };Any explanation or guidance would be most appreciated. Thank you for your time!
  14. Timer Countdown then Change State

    So typically you have a function that switch to another state that call be call via a button or sprites this.btn_gameOver =, 500, 'btn_play', this.start_gameOver, this);this.btn_gameOver.anchor.setTo(0.5,0.5);},start_gameOver: function(){'gameover', true, false, GameScore); } However when I use it within another function (updateTimer), once the countdown reached 0 and triggered, it return an error Uncaught TypeError: Cannot read property 'game' of undefined updateTimer: function(){ GameTimer--; txt_timer.text = GameTimer; if(GameTimer != 0){ console.log('it works!'); }else{ console.log('dingding'); //start_gameOver();'gameover', true, false, GameScore); } },What am I missing?
  15. Hello everyone! apologize in advance for my poor English. The thing is I've been working on a mini game of roulette machines, I have divided my game with gameStates(boot, gameStates, load, stand, play, win and lose). so some mechanics is: to start the state of play should create an image preloaded on my state of load, this will be a zodiac sign, then press the space key image should be removed and display a sprite sheet which is appended an animation. Something like this: var winState = { create: function(){ //Este estado servira de test para presion/accion de boton... var sta1 = game.add.image(300, 150, 'geminis'); sta1.scale.setTo(0.2); game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); if(game.input.keyboard.isDown(Phaser.Keyboard.SPACEBAR)){ rotateAnim(); } }, rotateAnim: function(sta1){ sta1.destroy(); var sta2 = game.add.image(300, 150, 'signos'); sta2.animations.add('rotate');'rotate', 1, true); }};BUT I didn't get the expected result. The only thing I desired result is obtained with the method onInputDown (Mouse): //In Create: Function();var sta1 = game.add.sprite(170, 360, 'leo');sta1.scale.setTo(0.17);sta1.anchor.set(0.5);sta1.inputEnabled = true;, this);stopAnim: function(sta1){ //game.state.start('stand'); sta1.destroy(); var signos = game.add.sprite(170, 360, 'signos'); signos.scale.setTo(0.17); signos.anchor.set(0.5); signos.animations.add('change');'change', 5, true); }could someone tell me I'm doing wrong or that I needed to get the same result when you press a key. Thanks a lot for answers!
  16. Here is my code var game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.CANVAS, 'game_area', { preload: preload, create: create, update: update}); var scaleRatio = window.devicePixelRatio / 5; var player, enemy, floor; var music; var game_state; var gravity_strength; var net_force; var style; var text, text2, text3, text4; var title_played; var level_data; var ready_to_select; function preload() { game.load.image('player', 'SpaceShipLarge.png'); game.load.image("enemy", "red.png"); game.load.image("floor", "green.jpg");"music", "firstbike.mp3"); } function create() { game.stage.backgroundColor = "#000000"; game.physics.startSystem(Phaser.Physics.ARCADE); style = { font: "65px Optima", fill: "white", align: "center"}; this.ROTATION_SPEED = 180; // degrees/second this.ACCELERATION = 200; // pixels/second/second this.MAX_SPEED = 250; // pixels/second this.DRAG = 25; // pixels/second this.GRAVITY = 90; // pixels/second/second player = game.add.sprite(game.width / 2, (game.height / 2) - 150, "player"); player.scale.setTo(scaleRatio, scaleRatio); player.anchor.setTo(0.5, 0.5); player.angle = -90; game.physics.arcade.enable(player); player.body.maxVelocity.setTo(this.MAX_SPEED, this.MAX_SPEED); player.body.drag.setTo(this.DRAG, this.DRAG); player.body.bounce.setTo(0.25, 0.25); player.body = null; player.visible = false; ready_to_select = false; floor = game.add.sprite(0, - 100, "floor"); floor.scale.setTo(scaleRatio, scaleRatio); floor.width =; floor.y = + 500; game.physics.arcade.enable(floor); floor.body.immovable = true; floor.body.allowGravity = false; game.physics.arcade.gravity.y = this.GRAVITY; music ="music"); music.loop = true; //; title_played = false; level_data = 1; game_state = "title_screen"; ready_to_select = true; //game_state = "play_state"; } function handle_input() { if(game_state == "play_state") { if(game.input.activePointer.justPressed()) { net_force = net_force - 20; } } } function generate_enemy() { } function start() { } function leftInputIsActive() { var isActive = false; isActive |= (game.input.activePointer.isDown && game.input.activePointer.x < game.width/4); return isActive; } function rightInputIsActive() { var isActive = false; isActive |= (game.input.activePointer.isDown && game.input.activePointer.x > game.width/2 + game.width/4); return isActive; } function upInputIsActive() { var isActive = false; isActive |= (game.input.activePointer.isDown && game.input.activePointer.x > game.width/4 && game.input.activePointer.x < game.width/2 + game.width/4); return isActive; } function setup_title() { //console.log(game.input.activePointer.y); if(title_played == false) { text = game.add.text(, 150, "Lift Off", style); text.anchor.set(0.5); if(level_data == 1) { text2 = game.add.text(, 380, "Play Game", style); }else { text2 = game.add.text(, 380, "Continue Game", style); } text2.anchor.set(0.5); text2.inputEnabled = true; text3 = game.add.text(, 500, "Select Level", style); text3.anchor.set(0.5); title_played = true; }, this); } function down(item) { if(level_data == 1) { text.kill(); text = game.add.text(, 150, "Level One", style); text.anchor.set(0.5); text2.kill(); text2 = game.add.text(, 380, "Gravity: 10m/s", style); text2.anchor.set(0.5); text3.kill(); } setInterval(function(){ game_state = "play_state"; text.kill();text2.kill();text3.kill(); }, 1000); } function setup_game() { if(level_data == 1 && ready_to_select == true) { game.stage.backgroundColor = "#FFFFFF"; game.physics.arcade.enable(player); player.visible = true; floor.y = - 100; enemy = game.add.sprite(game.width / 2, (game.height / 2), "player"); enemy.scale.setTo(scaleRatio, scaleRatio); enemy.anchor.setTo(0.5, 0.5); game.physics.arcade.enable(enemy); ready_to_select = false; } } function touched_floor() { player.y = 200; } function update() { game.physics.arcade.collide(player, floor); game.physics.arcade.collide(enemy, floor); game.physics.arcade.overlap(player, floor, touched_floor()); /* if (onTheGround) { if (Math.abs(player.body.velocity.y) > 20 || Math.abs(player.body.velocity.x) > 30) { // The ship hit the ground too hard. alert("gg m8"); // Blow it up and start the game over. //this.getExplosion(player.x, player.y); //this.resetShip(); } else { // We've landed! // Stop rotating and moving and aim the ship up. player.body.angularVelocity = 0; player.body.velocity.setTo(0, 0); player.angle = -90; } } */ handle_input(); if(game_state == "title_screen") { setup_title(); } if(game_state == "play_state") { setup_game(); if (player.x > game.width) player.x = 0; if (player.x < 0) player.x = game.width; if (leftInputIsActive()) { // If the LEFT key is down, rotate left player.body.angularVelocity = -this.ROTATION_SPEED; } else if (rightInputIsActive()) { // If the RIGHT key is down, rotate right player.body.angularVelocity = this.ROTATION_SPEED; } else { // Stop rotating player.body.angularVelocity = 0; } if (upInputIsActive()) { // If the UP key is down, thrust // Calculate acceleration vector based on this.angle and this.ACCELERATION player.body.acceleration.x = Math.cos(player.rotation) * this.ACCELERATION; player.body.acceleration.y = Math.sin(player.rotation) * this.ACCELERATION; // Show the frame from the spritesheet with the engine on player.frame = 1; } else { // Otherwise, stop thrusting player.body.acceleration.setTo(0, 0); // Show the frame from the spritesheet with the engine off player.frame = 0; } } } My Issue The overlap function should only be triggered when the player touches the floor. However, it is being called 60 times a second no matter where the player and the floor are in relation to each other.
  17. Function Call TypeError with

    Hey Guys, I have a problem with a function call with Phaser. I am a Javascript Noob and don´t know what I do wrong. Here is the critical Part of my Code, the whole Code is in one Scene. BasicGame.Multiplayer.prototype = {create: function(){ this.socket = io.connect('localhost:3010'); this.socket.on('startGame', function () { console.log('ShouldStartGame'); this.createActualGame(); });...},createActualGame: function(){// Define constants...}}My problem is that the function this.createActualGame is not called with the error: "TypeError: this.createActualGame is not a function". But the console log works fine. Thanks for your help! With kind regards, SirSandmann
  18. Hi, I have made a game that works fine and am trying to put some states in. I have set all the code up and I keep getting the 'Uncaught ReferenceError: MYFUNCTION is not defined'. Here is a bit of the code so you get the idea. It's the main game state. If I take out the function being called it calls the same error on the next function. I don't understand why the functions aren't being defined? var theGame = function(game){}theGame.prototype = { create: function(){ }, update: function(){ MYFUNCTION(); }, MYFUNCTION: function(player, coin) { some stuff; }}Any help would be great! Thanks
  19. Problem with functions

    Hi all, I have a little problem with functions in states, when i want to use a function from a function i get an error of undefined. To clarify here is the code: Game.Combat.prototype = { /* create and update codes ....*/ moveToEnnemy: function() { var tween =;{x:ennemy.x-32, y:ennemy.y}, 1500, Phaser.Easing.Cubic.None, true); }, moveToStart: function() { var tween =;{x:PLAYER_START_X, y:PLAYER_START_Y}, 1500, Phaser.Easing.Cubic.None, true); }, attack: function() { this.moveToEnnemy(); /*This is the probleme, i get an error of undefined function*/ console.log("ATTACKING ..."); this.moveToStart(); //This too. },}I get this error : Uncaught TypeError: undefined is not a function Is there any solution in how to use moveToEnnemy and moveToStart into the attack functions ?
  20. I'm porting a Flash/AIR project to Phaser, and everything is going pretty smoothly so far, but I hit a really odd performance issue which I'm hoping someone can explain to me. When using a forEach loop on a phaser Group (called desksGroup) which only has 9 items in it, I get ~40fps on mobile. But if I get rid of that forEach loop, and instead put the code into the built-in update() function of each of the 9 sprites within the group, FPS drops to ~4. Here is the game loop with a forEach going through a group of sprites (desksGroup): GameState.prototype.update = function() { // kill any pencils that hit a wall game.physics.arcade.overlap(layerMap, pencilsGroup, pencilHitWall); // TODO: subclass "Sprite" so that these update functions call themselves desksGroup.forEach(function(desk) { clientsGroup.forEach(function(theClient) { // get closest client if (!desk.currentTarget || desk.currentTarget && game.physics.arcade.distanceBetween(desk, theClient) < game.physics.arcade.distanceBetween(desk, desk.currentTarget)) desk.currentTarget = theClient; // other ideas for targeting: least health, most health, slowest, fastest }); if (desk.currentTarget && > 0 && game.physics.arcade.distanceBetween(desk, desk.currentTarget) < desk.range) { if ( > desk.nextFire) { desk.nextFire = + desk.fireRate; var pencil = pencilsGroup.getFirstExists(false); pencil.reset(desk.x, desk.y); pencil.lifespan = desk.fireLife; pencil.rotation = game.physics.arcade.moveToObject(pencil, desk.currentTarget, desk.fireSpeed); } } }); game.physics.arcade.overlap(clientsGroup, pencilsGroup, pencilHitClient); if(defaults.showHealth) { clientsGroup.forEach(function(client) { game.debug.geom(new Phaser.Rectangle(client.x, client.y - 16, Math.max(0, tilemap.tileWidth * ( /, 7), '#00ff00', true); }); }}And here is a slightly modified version, with that forEach removed: GameState.prototype.update = function() { // kill any pencils that hit a wall game.physics.arcade.overlap(layerMap, pencilsGroup, pencilHitWall); game.physics.arcade.overlap(clientsGroup, pencilsGroup, pencilHitClient); if(defaults.showHealth) { clientsGroup.forEach(function(client) { game.debug.geom(new Phaser.Rectangle(client.x, client.y - 16, Math.max(0, tilemap.tileWidth * ( /, 7), '#00ff00', true); }); }}With the desk update functions moved to this: var deskUpdate = function() { var desk = this; clientsGroup.forEachAlive(function(theClient) { // get closest client if (!desk.currentTarget || desk.currentTarget && game.physics.arcade.distanceBetween(desk, theClient) < game.physics.arcade.distanceBetween(desk, desk.currentTarget)) desk.currentTarget = theClient; // other ideas for targeting: least health, most health, slowest, fastest }); if (desk.currentTarget && > 0 && game.physics.arcade.distanceBetween(desk, desk.currentTarget) < desk.range) { if ( > desk.nextFire) { desk.nextFire = + desk.fireRate; var pencil = pencilsGroup.getFirstExists(false); pencil.reset(desk.x, desk.y); pencil.lifespan = desk.fireLife; pencil.rotation = game.physics.arcade.moveToObject(pencil, desk.currentTarget, desk.fireSpeed); } }}As you can see, the only difference is that I've removed the desksGroup.forEach() code block, and created an updateDesk function. Elsewhere in the code, where I instantiate the "desk" Sprites, I have the following line: desk.update = deskUpdate;I was thinking that by adding the deskUpdate function to each desk Sprite, it would save some overhead (since the .update() gets called automatically, instead of my explicitly looping through the group via forEach). However, when I use this deskUpdate function, my FPS on mobile drops from ~40fps to ~4fps. I also tried using an regular function declaration (function deskUpdate() {...}), and had the same performance loss.
  21. Hi friends, quick question: What is the path to my function? I'm not sure what to put in this field (image below). My directory looks like this: >index.html >html5contents (folder) >aqh_yepApi.js In aqh_yepiApi.js I have the functions yepiRestart(), yepiSound(), and yepiPause(). Those are the functions I'm trying to reach, but I'm not sure what to put in the field. I know what I have in the image is wrong. I use GameMaker Studio to make my games if that's relevant at all. Thanks!
  22. How to destroy a fucntion?

    I want to destroy a function, what is the best way to do that? example : FavoriteFlavor.bootState = { button: function(btnX, btnY, textX, textY, fn, text) { var button = game.add.button( + btnX, + btnY, 'btnLetGo', fn, this); button.anchor.set(0.5); button.input.useHandCursor = true; var letGo = game.add.text( + textX, + textY, text); letGo.font = 'Arial'; letGo.fill = '#ffffff'; letGo.fontSize = '13px'; letGo.align = 'center'; letGo.fontWeight = 'bold'; letGo.anchor.set(0.5); }};FavoriteFlavor.gameState.prototype = { create: function() { button = FavoriteFlavor.bootState.button(0, 130, 0, 130, this.start, "Start"); }, start: function() { //click start function destory FavoriteFlavor.bootState.button //how to do that? }};
  23. State structure and functions

    (Warning, new Phaser user ahead) I´m making my first tests with States on Phaser, and I am now having a problem creating functions inside states that are not the predefined ones (create, update, etc). All in all, this is the code that is giving me trouble: this.physics.arcade.overlap(player, stars, collectStar, null, this);I define my collectStar function like this, before it is ever called: collectStar: function(){// Removes the star from the screen star.kill(); // Add and update the score score += 10; scoreText.text = 'Score: ' + score;},This is inside a state on a different Javascript file called Lvl1.js. The error I am receiving when running on Chrome is this: Uncaught ReferenceError: collectStar is not defined Lvl1.js:127Line 127 is where collectStar is called.
  24. Hi all I have a little problem, i have set the collision of two spritse: game.physics.arcade.collide(sprite1, sprite2, this.collisionSprite, null, this);collisionSprite: function(){ variable++;}The problem is when the sprite1 collide with sprite2 the variable keep increasing, i want to increase the variable just one time, is there any solution please. And thank's for any help