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

Found 3,062 results

  1. Hi, I am making a snake vs block clone.So obviously the snake and block should collide.When blocks falls on snake collision is working(i mean separation is working).But when i drag snake to a block ,there is no separation when collision happens(only overlapping).Please help me.
  2. StickHero Game

    So I'm making my first Phaser game for school. I want to make a game that is inspired by Stick Hero. The only difference is that the platforms are logs. The problem is the first time the player walks the length of the bridge but the second time the player walks the same distance although the bridge is longer. The functions i used are in the attachement. How's the best way to do this or does anyone have an example i can use? Thanks! GameState.js
  3. Hi If anyone is interested I created a basic enemy path chase system. It may be of use to someone else trying to make one themselves or to create a better version of it. The basics of the sytem are quite simple (mainly 2 functions) - I created a map array and a group of enemies - In the update function I use the chaseMe() function for the enemies to use their "line of sight" to start the chase if the player isclose to the x and y on the stage - If the player escapes, there is a short timer that will move the enemy (moveMonster() function) in a random direction where it may "see" you again and start the chase again It is pretty basic - the demo is below, use cursor keys to move the player You can view the source code in the browser (ctrl + u) or download the full demo in the zip file attached Eric
  4. Hi all, I am new to phaser so excuse me if this is stupid. Actually, I am working on kidda game. I am making a mini-map to hold all of the game world. But, the world inside the canvas moves along the player and shows beyond the actual game boundary. This function is called on create function. function createMiniMap(){ stage = game.make.bitmapData(,; thumbnail = game.add.bitmapData(200, 200); thumbContainer = game.add.sprite(game.width, game.height, thumbnail); thumbContainer.anchor.setTo(0.5, 0.5); game.stage.addChild(thumbContainer); } in update function update(){ if (game.time.time < this.nextUpdate){ return; } { stage.clear(); stage.drawFull(; thumbnail.rect(0, 0, thumbnail.width, thumbnail.width, '#000'); thumbnail.copy(stage, 0, 0, stage.width, stage.height, 2, 2, thumbnail.width, thumbnail.width); thumbnail.update(); this.nextUpdate = game.time.time + this.updateRate; } } Thanks in advance!!!!!!
  5. Helpp Me I want te execute my callback function only 1 time. But it won't
  6. I've follow the example in but my star didn't appear. Does in my codes have mystake? Can you help me find the problem? Thaanks This my Code... main.js
  7. Hello, For a game, I need to make a 8 * 10 grid with buttons as follow : var counter = 0; for (var i = 0; i < 8; i++) { for (var j = 0; j < 10; j++) { this.btnNumbers[counter] = * j, 50 * i, 'check-box-rounded', this.onNumberTicked, this); counter++; } } The "onNumberTicked" event add a sprite over the button to make it feel as "checked" (I don't use buttons frames for that because I need to overlay a bigger image over a text centered on the button). My probleme, is that with about 10 buttons, onNumberTicked is called quickly, but when I add 80 buttons, I notice a big delay, maybe about ~500 ms. Is there a solution to solve this issue ? Thank you for you replies, Vince
  8. Help with Game States

    Hello there, I have 3 files for a phaser game an html, cs and javascript file(excluding phaser.js). I would really appreciate if someone who understands the this.blank format would help me convert to a game where I have a boot state, menu state and play state of the game. I honestly don't know how to do this, this would help me learn more and also help progress me a bit because I haven't been able to successfully transit into this.blank format although I have been given examples which I would say are way more complicated than my game and those examples were missing some parts that would have helped me that I couldn't find. code.js index.html style.css
  9. Mobile screen touch controls

    Hello, I would like to know if it is possible to have screen touch controls on mobile instead of the buttons? In my game i tried having buttons to jump and it functioned correctly... however I am looking for a way to make my character jump wherever we actually touch the screen and not just one specific button. is that possible? Also is it possible to have movement controls such as the attached in Phaser? is this a good example: Thank you!
  10. on receiving signal is null

    Hi, I'm looking for an explanation for the following behaviour: I have a class "Main" extending Phaser.State, a class "Emitter" and a class "Receiver" extending Phaser.Sprite If I dispatch a signal from "Emitter" and listen to it in "Receiver" everything works as expected or to be more precise: "" has the object "App" assigned. If I reload the state and dispatch again the signal two things happen: The listener receives the signal two times. The 1st time "" is null, the 2nd time "" contains again the object "App" (please have a look at the screenshot showing the console output) Does anybody have an explanation for this behaviour? Thanks, Boris The code (TypeScript) export class Game extends Phaser.Game { constructor() { super(480, 640, Phaser.AUTO, 'content', null); this.state.add('Main', Main, true); console.log("Game started"); } } class Main extends Phaser.State { private emitter: Emitter; private receiver: Receiver; preload() { this.load.image('logo', 'assets/logo.png'); } create() { this.emitter = new Emitter(; this.receiver = new Receiver(; const rKey = this.input.keyboard.addKey(Phaser.Keyboard.R); rKey.onDown.add(() => { console.log('reload state Main');'Main',true,false); }, this); } } class Emitter { // -- Signals static onEventFromEmitter: Phaser.Signal = new Phaser.Signal(); constructor(private game: Phaser.Game) { const spaceKey =; spaceKey.onDown.add(() => { Emitter.onEventFromEmitter.dispatch(); }, this); } } class Receiver extends Phaser.Sprite { constructor(game: Phaser.Game) { super(game, 0, 0, 'logo');; this.subscribe(); } /** * Subscribe to events */ private subscribe(): void { Emitter.onEventFromEmitter.add(() => { console.log('Game object in Receiver, listening to onEventFromEmitter',; }, this); } }
  11. Phaser mask is a bully

    Good morning everyone! I've created my mask to let my group "symbols" drawn only if inside the mask. mask =, 0); mask.beginFill(0xffffff); mask.alpha = 0; mask.drawRect(x, y, xx - x, yy - y) mask.endFill(); symbols.mask = mask; The images who can be drawned everywhere are in the "images" group. The images in the behind the mask and the symbols in the mask are correctly rendered. The images that I want OVER the mask are still rendered behind the mask. Any ideas why or how can I fix it?
  12. Resize game for smaller screens

    I am fairly new to Phaser and have found these forums an excellent resource. I am building a game the was originally only for desktop, however now I am trying to get this working on tablets as well. The game is landscape only and is pretty much complete. It is made to run on a canvas of width 1200 x 740. I have added the below to the preload which works fine if the game loads on a resolution larger than the config width and is scaled smaller. (browser resized) However when loading on a device/browser with the screen under 1200 wide, sections of the sprites are chopped off, resizing the browser works the same but sections are still cut off. const docElement = document.documentElement const width = docElement.clientWidth > config.gameWidth ? config.gameWidth : docElement.clientWidth const height = docElement.clientHeight > config.gameHeight ? config.gameHeight : docElement.clientHeight = Phaser.ScaleManager.SHOW_ALL; = height; = width; Any help would be greatly appreciated.
  13. How to check for certain touching.down

    Hi, i'm currently woriking on a litle Phaser side scroller. My problem is, my player can jump on items such as stars, and other things. I tried it with arcade.overlap like this: if (cursors.up.isDown && player1.body.touching.down && !game.physics.arcade.overlap(player1, stars)) { player1.body.velocity.y = -700; } But it didn't work for some reason... I didn't get any errors, but I can still jump on the stars. Does somebody have a solution for this?
  14. loading a text file in phaser with typescript is trival with a simple:"reference", "url") however attempting to write or modify external text files appears to be way more complicated. I'm guessing this is for security reasons, but still don't see why there can't be a "game.write.text()" method or something similar?
  15. (posted in phaser 3 instead of the phaser forum by mistake) Hi I'm hoping someone can hep me, I'm trying to create basic map using an array with 2 different images, one is a wall, the other is a floor. I've created twp groups but when i use, this.blocks, null, this.hitBlock, this); I've used the collide function before on other games with no issues - this is my first time using a 2d array but I can't see where the issue is happening code below : cursor controls to move link example : var GameHipster = GameHipster || {}; GameHipster.GameState = { init : function() { //keyboard controls this.cursors =; this.upKey =; this.downKey =; this.leftKey =; this.rightKey =; this.actionKey =; this.PLAYER_SPEED = 400; this.BULLET_SPEED = 500; this.score = 0; }, // end init preload : function() { },//end preload //executed after everything is loaded create: function() { blockdata = [ [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], [1,0,0,0,0,0,0,0,0,0,0,0,0,0,1], [1,0,0,0,0,0,0,0,1,0,0,0,0,0,1], [1,0,0,0,0,0,0,0,0,0,0,0,0,0,1], [1,0,0,0,0,0,0,0,0,0,0,0,0,0,1], [1,0,0,0,0,0,0,0,0,0,0,0,0,0,1], [1,0,0,0,0,0,0,0,0,0,0,0,0,0,1], [1,0,0,0,0,0,0,0,0,0,0,0,0,0,1], [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], ]; this.blocks =; this.blocks.enableBody = true; this.floors =; this.floors.enableBody = true; var floor, block, i, j, col; var ROWS = blockdata.length; var COLS = blockdata[0].length; //console.log('R : ' + ROWS + ' C : ' + COLS); //console.log(blockdata[2][3]); for (i =0; i < COLS; i++) { for (j =0; j < ROWS; j++){ //col =1; col = (blockdata[j]); if (col ==0){ floor = this.floors.create( 1 + (i*64),1 +(j*64), 'block' + col); floor.anchor.setTo(0.5); } if (col ==1){ block = this.blocks.create( 1 + (i*64),1 +(j*64), 'block' + col); block.anchor.setTo(0.5); block.body.immovable =true; } } }; this.player = this.add.sprite( / 2, / 2, 'player'); this.player.anchor.setTo(0.5); this.player.scale.setTo(0.2);; this.player.body.immovable = true; //ui this.uiBlocked = false; //text var style = {font : '20pt Arial', fill : '#fff'}; this.scoreLabel = this.add.text(10,10, 'SCORE : ', style); this.scoreText = this.add.text(130,10, '0', style); this.refreshStats(); }, //executed multiple times per second update: function() { this.player.body.velocity.x = 0; this.player.body.velocity.y = 0;, this.blocks, null, this.hitBlock, this); this.keyboardControls(); }, // end update keyboardControls : function(){ //init keyboard controls if (this.cursors.left.isDown|| this.leftKey.isDown){ //this.player.angle += 5; this.player.body.velocity.x = -this.PLAYER_SPEED; } else if (this.cursors.right.isDown || this.rightKey.isDown){ //this.player.angle -= 5; this.player.body.velocity.x = this.PLAYER_SPEED; } if (this.cursors.up.isDown || this.upKey.isDown){ //thrust this.player.body.velocity.y = -this.PLAYER_SPEED; } if (this.cursors.down.isDown || this.downKey.isDown){ //thrust this.player.body.velocity.y = this.PLAYER_SPEED; } if (this.actionKey.isDown){ this.fireBullet(); } },// end function hitBlock : function(player, block){ console.log('hit'); }, endGame : function(player, enemy){'GameState'); }, refreshStats : function(){ this.scoreText.text = this.score; } }; Any help is appreciated Eric
  16. Hi, I've been learning Elixir + Phoenix for fun, after using Ruby + Sinatra for a group project. I'd like to set up a web based game, and i'm interested in using Phaser inside an Elixir + Phoenix setup. I was wondering if anyone could give me a quick debrief; I'm assuming it's possible but is it better to use Phoenix simply for launching the app? (so any calculations should be done within Javascript), or is it possible to set up most of the logic inside Elixir and be done server side (which I think would be better for avoiding hacks)?
  17. Arkham Investigator

    Hello! This is my entry for the interactive fiction horror jam Ectocomp 2017 A game made with Phaser and Ink. It ranked 1st at the Spanish Grand Guignol Ectocomp 2017 a few days ago! The game is a version of the tabletop game of the same name created by Hal Eccles in 2011. The mechanics are similar to the Sherlock Holmes Detective Consulting. It is a narrative game where you interpret an investigator who must solve eldritch cases following the clues on the locations of the map. Play the game:
  18. GoldenQuest by CodingPark

    GoldenQuest is an educational game for learning the principles of coding while having fun. Play online: The game canvas is made with Phaser. The code editor is made with and integrated in the game. Here you can see screenshots of one level, the level selector and the level editor. GoldenQuest is a much more advanced version of "the adventures of the pirate robot" that we already showcased here some months ago! Enjoy! Comments and feedback will be appreciated!
  19. Ball genius [android]

    Hello everybody! I'm proud to showcase the first game of my new compagny from france. you need accuracy and reflexion to complete all levels, each chapter brings a new element of gameplay. You can hope for gold medal if you do the less bounces possible. gold medals = new skins. i've made a website with a demo of the game: and you can download the full game for free on the play store: Ball Genius thank's in advance for playing you can mail me at:
  20. Hello, I have 2 sprite animations. Once first one is played, via below function I'm checking frame index (which frame is currently playing). When current frame is my desired frame, I want to play another sprite. animations.currentAnim.onUpdate Below is my full code: firstSprite.visible = true; firstSprite.animations.currentAnim.enableUpdate = true;'firstSprite', 14, false); firstSprite.animations.currentAnim.speed = 80; firstSprite.animations.currentAnim.onUpdate.add(function () { if(firstSprite.animations.currentAnim.frame > 5){ secondSprite.visible = true;'secondSprite', 30, false); secondSprite.animations.currentAnim.speed = 60; } }, this); On desktop in a browser it works perfectly, but on mobile devices it is being stucked and once frame is greater than 5 (if(firstSprite.animations.currentAnim.frame > 5){...}), then it stops at that frame and doesn't continue to play first sprite. Is there something I'm missing. Thanks
  21. update: function() { // game.physics.arcade.collide(turnip, background); if ( > planttime) { sprite=game.add.sprite(game.rnd.integerInRange(1000, 1000)+100, game.rnd.integerInRange(500, 600), 'atlas', "BG" + game.rnd.integerInRange(0, 2)); game.physics.enable(sprite, Phaser.Physics.ARCADE); sprite.body.immovable = true; sprite.body.velocity.x=-500; planttime=planttime+3500; game.physics.arcade.collide(turnip, background,self.collisionHandler,null,this); } }, collisionHandler:function () { console.log("collide"); },
  22. [Phaser] Santa Rush

    Hello again fellow game devs, I'm back with another game, christmas themed single button game. Check it out on the link below: Feel free to discuss the game and what you like/dislike, I'm open to any kind of criticsm. Regards!
  23. Hi, please check our new game Cyber tank. Ready to sell non-exclusive
  24. Hey guys, for all Vim users , check out my tutorial on how to use phaser with vim (includes auto-completion)
  25. [Phaser] Gumdrop Popper

    Hey all! Knocking the rust off old hobbies, including making mobile-friendly mini games, and gradually building up steam while learning new things. Here's one for the holiday seasons. Gumdrop Popper Compete against your best performance as you try to pop all the sliding gumdrops with precision in your fastest time.