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

Found 2,441 results

  1. Hi, I'm new on Phaser and my english isn't perfect, so i'll try to be careful. I made a 2D mini game like that : (see screenshot). What I need is to move my character on right click. - I handeled my right click (so it's ok). - I have in an array the path I need the character to use (ex : [[0.0],[0.1],[0.2],[0.3],[0.4],[0.5]]). My character have got a speed (equals to 1) and I need my character to move from the first point to the last of my array by passing by the others ... like a unit in Warcraft 3, League of legend, etc. Do you know how i can do that please ? Thanks for your time. Antoine Duval.
  2. Hi everyone, Kupiter is a studying tool that models the old Asteroids video game. Players shoot asteroids with letters on them to answer questions, and questions can be created and shared with others. The purpose of this project is to offer a unique way to study/learn by playing a game that is engaging and effective. Our website: Demo questions: The game features: Power-ups, weapons, bots, and explosions. Real-time leaderboards. Question importing from Quizlet Mobile device compatibility Kupiter was created using Phaser for the game itself, and nodeJS for the server back-end. All of the question sets are stored in a MongoDB database. Try it out and let me know what you think! Thanks, Kevin
  3. spacegame

    My latest game. Built with phaser from a tutorial. I then built on the tutorial by adding access to the localstorage api. Here is the link Positive criticism is much appreciated as well as tips for improvements Thanks Pheaset
  4. phaser

    i want to draw a line between two given co-ordinates & drawing animation should be visible like a progress bar but it could be in any direction. How to achieve this?
  5. Mr. Miner "Mr. Miner is a gold miner game in which you have to collect gold and other valuables. Invest your money in upgrades for your drill. Drill down to new levels with more gold and other treasures!" GAME LINK: Mr. Miner was made with Phaser and has been one of our bigger projects. Feedback welcome. Always interested what other people and developers think.
  6. Hey everyone, Over the past few months I've been working on a project in Phaser and I've come across a really frustrating problem. I don't think it's caused by Phaser or the code I've written, but has to do with the audio files themselves. Yet, I can't figure out what to do in order to make this work. I studied the example here to determine how to preload audio assets, create a variable linked to that asset, and then call it on demand. I should note that this example on the Phaser site works as intended. I can hear the example music play on both Firefox and Chrome. I also studied other discussions about using audio in Phaser. I saw people warn against the use of MP3 as it's a licensed format, and recommended using OGG for Firefox with M4A as the fallback for Chrome. So; that's what I tried doing. It's not gone well. Only some of the M4A files play in Chrome. I can't figure out why, and I can't discern a pattern behind it. Some of the sounds I'd edited in Adobe Audition, others I'd left as-is. Regardless, they'd all been converted to M4A via iTunes. Some of the sounds I've edited will play, others won't; some of the sounds that were converted as-is will play, others won't. Chrome's dev console doesn't give any answers at all. I've tried inspecting the properties of the M4A sounds with VLC Player to see if I can determine a certain setting is causing the issue, but as far as I can tell all the M4A files have the exact same properties. I encounter the same issue on Firefox. when it comes to using MP3s. The same sounds that play on Chrome will play in Firefox; the same is true of the sounds that won't play. In this case, the error I receive is "The buffer passed to decodeAudioData contains invalid content which cannot be decoded successfully." OGGs won't play at all. When I try to use those instead of MP3s, Firefox's console reports "error loading asset from URL assets." This is true even of sounds which work when using the MP3 or M4A format. I'm pretty certain the issue lies with something about the audio files but I have no clue what's causing this. Does anyone have advice on how to fix this issue?
  7. Forewarning: semi-newbie Basically, if the user has the left cursor down and a "token" collides with the lftRect, I want to kill the token. For some reason my kill callback function for the collision is not working (below is relevant code): gumballGoGo.Preloader = function(game){ this.player = null; this.ground = null; //this.tokens = null; this.ready = false; }; var cursors, lftInit, rghtInit, ground, testDrp, sprite, tokens, rect, lftRect, ctrRect, rghtRect, lftToken; var total = 0; function lftHit(lftRect, lftToken) { if ( lftInit == true ){ lftToken.kill() } }; gumballGoGo.Preloader.prototype = { preload: function(){ }, create: function() { // LFT BOX lftRect = this.add.sprite(0, - 150, null); this.physics.enable(lftRect, Phaser.Physics.ARCADE); lftRect.body.setSize(100, 100, 0, 0); // CNTR BOX ctrRect = this.add.sprite(100, - 150, null); this.physics.enable(ctrRect, Phaser.Physics.ARCADE); ctrRect.body.setSize(100, 100, 0, 0); // RGHT BOX rghtRect = this.add.sprite(200, - 150, null); this.physics.enable(rghtRect, Phaser.Physics.ARCADE); rghtRect.body.setSize(100, 100, 0, 0); // INIT TOKEN GROUP tokens =; tokens.enableBody = true; this.physics.arcade.enable(tokens); testDrp = tokens.create(125, -50, 'token'); testDrp.body.gravity.y = 300; // CONTROLS this.cursors = this.input.keyboard.createCursorKeys(); }, update: function() { this.ready = true; if (this.cursors.left.isDown) { lftInit = true; } else if (this.cursors.right.isDown) { rghtInit = true; } else { lftInit, rghtInit = false; } if (total < 20) { tokenSpawn(); } this.physics.arcade.collide(lftRect, lftToken, lftHit, null, this); } }; function tokenSpawn() { lftToken = tokens.create(25, -(Math.random() * 800), 'token'); lftToken.body.gravity.y = 300; total++; } PLEASE HELP! The ultimate goal is to recreate this type of gameplay. One additional note: as of now I am dropping "tokens" using a random spawn loop. I'd rather use a timed patter for the token drop. If you have any advice on that please share as well. Thanks :]
  8. Hey guys, here's my first post. I made this game around a year ago in 2 days as a demo for someone. The game is the classic old connect 4 game you'd play with siblings in long car rides. It features score keeping, two player mode and an AI that you can play against. Any feedback is greatly appreciated P.S There is also a link to the github repo on the page above.
  9. I can't seem to follow the example code for Creature animations. I'm getting this error: c.Creature is not a constructor Are there any other things I need to setup?
  10. I am trying to implement a zoom/drag functionality with some menus over the map. Think of Age o Empires 3, you basically have a map on which you can do zoom and drag, but you also have som menus that are always over the screen. Check this for clarity. So far. I have implemented the zoom/drag by modyfing the x, y and scale attributes of game.scale. But this work pretty good when the scale is big enough to cover the whole screen. But what I need is some kind of viewport that is smaller than the screen (like in Age of Empires) where all the zoom/drag works. The remaining parts of the screen that are not part of the viewport are filled by the UI menus. So far I have put the menus outside the world like I posted here. I attached an image with what I mean by viewport and menus in case is not clear Thanks :)!
  11. Following this example: I've been trying to extend MonsterBunny. I've added this: // here is an extension of a custom game object SuperMonsterBunny = function (game, x, y, rotateSpeed, vertSpeed) {, game, x, y, rotateSpeed); this.vertSpeed = vertSpeed; this.ydir = 1; }; SuperMonsterBunny.prototype = Object.create(MonsterBunny.prototype); SuperMonsterBunny.prototype.constructor = SuperMonsterBunny; SuperMonsterBunny.prototype.update = function() { /* this.y += this.vertSpeed * this.ydir; if (this.y < 0 || this.y > h) { this.ydir *= -1; } */ }; This works fine, and the commented out code works as expected. (when it's uncommented!) The extended class's update overrides the parent class, which is expected, but, I can't find a way of calling super.update() or equivalent. Can anyone enlighten me?
  12. Hi there, here our approach to the game of chess. Theoretically it should do fine and connect with kids. There aren't many html5 chess games around and this should help with its distribution. It's not finished yet, has no audio, it contains bugs and parts of the instructions/tutorial still need to be done. However you can have a good idea of the final product. It's available for licensing. Play it here
  13. I'm trying to develop a HUD for my game but im having an unexpected behavior when setting one of my sprites like this: this.mysprite.fixedToCamera = true; the sprite desapears completely, but commenting the line makes the sprite visible just fine. I havent come up with the reason just yet. any ideas?
  14. I've just about completed my first game that I want to release to the general public. Part of that process is getting it on and using cocoonjs to package it up to make it native for mobile. The problem is that in certain circumstances the audio will not play. serving it up on my local machine (Ubuntu with a node server) it works on desktop and Android on (They put it in an iframe) it works on desktop, and iPhone but on android no audio. Tried to package it up with cocoon and tested it on Android again no audio. I don't have an iPhone handy so I'm limited in what testing I can do there. The problem seems to be just on Android though when the game is played through an iframe or packaged into an apk. The game is built around @lukewilde's awesome boilerplate. That thing has really helped my workflow so I hope it isn't part of the problem. I've looked at the build and everything appears as I would expect it. I have also used some code from the official breakout example. So that will look familiar. In the Preloader state I'm Preloading the audio like so:'beef', [ './audio/beef.ogg', './audio/beef.mp3' ]); Then in my game state I'm adding a variable for the audio. this.beef ='beef'); Lastly also in the game state the audio is played with:; I've really been beating my head against the wall trying to figure out what is going on here. I'm hoping it is something simple that I've overlooked. I also don't know how to debug on Android so maybe I just need help with that and I'd figure this out myself. Here is a link to the game on Here is all the code in Github
  15. Hi there, I want to extend Phaser.Weapon so I can create my own custom weapons. I know that you extend groups by using Weapon.SingleBullet = function (game) {, game,, 'Single Bullet', false, true, Phaser.Physics.ARCADE); return this; }; Weapon.SingleBullet.prototype = Object.create(Phaser.Group.prototype); Weapon.SingleBullet.prototype.constructor = Weapon.SingleBullet; But what about the weapons group? Are there any examples out there for this? EDIT: I used Weapon.SingleBullet.prototype = Object.create(Phaser.Weapon.prototype); and it seems to work. However, when I try to fire my bullet I get the following error Cannot read property 'getFirstExists' of null at (phaser.js:101053)
  16. Hi there, I want to build a shotgun weapon for my game. This shotgun would shoot 3 (or more) bullets in a conical angle. However, from what I see, Phaser.Weapon only fires one bullet at a time. What do I do in order to get the weapon to fire 3 bullets consecutively
  17. So I'm currently following @rich 's Shoot-em-up tutorial from over here Please have a look at the source code if you haven't already. From what I understand he create's a weapon array that holds all the weapon types (each of which are an object inside a Weapon object). Now my question is How do I access the current weapon bullets in game.physics.arcade.collide? I've used game.physics.arcade.collide(this.weapon[this.currentWeapon], this.enemies) and this works fine, the bullets and the enemy collide well. BUT what if I want to kill that bullet? How would I pass the specific bullet that collided with the enemy into a function? This is what I've tried: game.physics.arcade.collide(this.weapon[this.currentWeapon], this.enemies, function(bullet, enemy) { bullet.kill(); }, null, this); However the above code doesn't work. Bullet is undefined. What do I do?
  18. Hello. I want to start multiple tweens at the same time (multiple objects need to change position at the same time). What is the proper way to handle such situation? Is something like this enough or there are some better methods to do this? let tween1= let tween2= tween1.start(); tween2.start(); I thought I can use "chain" for it, but according to the docs it is used to run tweens sequentailly. I would be grateful for your input. Best regards.
  19. Hello, I would like to create one of the most simple game but I encounter an issue : My snake will be composed of several parts, one for the head, one for the tail and one for the body. Then, when my snake will ate an item, his size will growth by the addition a body's part. But I don't know how to create my snake (I have the sprite with the different directions). Should I merge the head's sprite with the body's sprite and with the tail's sprite and redefine the final sprite every time the snake grows or I can use group or another method ? Thanks for you help PS : I apologize for my English mistakes, English is not my native language ^^
  20. localstorage

    hey guys I'm currently after completing a tutorial at . I have been working on my knowledge with phaser. anyways, after finishing the tutorial i decided to polish the game. I am new to the localstorage api and was looking for some help. here is my code for the highscore. it currenly doesnt work with localstorage and im not sure why. Any help is much appreciated init: function(score) { var score = score || 0; localStorage.setItem("score", this.highestScore); this.highestScore = this.highestScore = localStorage.getItem("score"); this.highestScore = Math.max(score, this.highestScore); if(this.highestScore === null) { localStorage.setItem("score", "0") this.highestScore = localStorage.getItem("score"); } }, Here is the full file. Just incase its needed var SpaceHipster = SpaceHipster || {}; //title screen SpaceHipster.MainMenu = function(){}; SpaceHipster.MainMenu.prototype = { init: function(score) { var score = score || 0; localStorage.setItem("score", this.highestScore); this.highestScore = this.highestScore = localStorage.getItem("score"); this.highestScore = Math.max(score, this.highestScore); if(this.highestScore === null) { localStorage.setItem("score", "0") this.highestScore = localStorage.getItem("score"); } }, create: function() { //show the space tile, repeated this.background =, 0,,, 'space'); //give it speed in x this.background.autoScroll(0, 10); //start game text var text = "Tap to begin"; var style = { font: "30px Arial", fill: "#fff", align: "center" }; var t =,, text, style); t.anchor.set(0.5); //highest score text = "Highest score: "+this.highestScore; style = { font: "15px Arial", fill: "#fff", align: "center" }; var h =, + 50, text, style); h.anchor.set(0.5); }, update: function() { if( {'Game'); } } };
  21. Hello boys and girls! Is it possible to access local files, images in particular, upload them, and use in the game as a sprite? For example, player clicks a button, opens up a file dialog, chooses an images and uploads it. Later that image is going to used a background or something like that.
  22. html5 game

    Hi i would like to share with you my last game i made with phaser framework it is cross platform mobile ready game the source code is available on codecanyon codecanyon : play the game : video :
  23. My game is lagging when moving the camera in mobile devices, I don't really know how to fix it without changing in tilemap... my game here: You can see the tilemap in the assets folder and the code of the tilemap is in the js/functions.js Thanks in advanced
  24. Hi guys may I ask a quick question? I'm working with Phaser and I'm using the module pattern, creating a module that has a prototype of Object.create(Phaser.Sprite.prototype) and creating an instance of that in the main module. The problem is the sprite seems to be created in the main module in the create function but the image of the sprite is not loading and i cant find the problem or set the image. Thanks so much!!
  25. I am somewhat new to Phaser and have a goal of making a game with similar gameplay to the first Navyfield. One concept I am having trouble with is how Navyfield managed to do projectiles with 3D positions using 2D sprites. What steps do I have to take to have a cannon fire a projectile up in the air and possibly at an angle towards or away from the "camera"? If possible, could I get some psuedo code or even better an example using Phaser? Here is an example of the projectile system used in Navyfield (might be a bit loud):