Search the Community

Showing results for tags 'phaser'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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,149 results

  1. Sound effects mashed up

    Hi , i'm having a difficulty while trying to play sounds on player input. The character is supposed to move and play a footstep sound while doing so. But the sound is really short and end up restarting the sound every call to update which causes it to sound mashed up. Is there any way i could fix this? The code isn't really that much relevant but still: update: function() { if (this.cursors.left.isDown) { this.player.body.velocity.x = -this.player.speed; this.player.animations.play('walk-left'); this.footstepA.play(); } } Oh and i would also like to reproduce another footstep sound after playing that one. Like so: footstepA, footstepB, footstepA, etc.
  2. In this multiplayer game tutorial series with Node.js server and Phaser client, it goes over room logic, and implementing maximum number of players. http://gojasonyang.com/post/phaserMultiplayerGamePart6.html
  3. init parameters is undefined

    In Phaser 2.7.5 I'm trying to pass an object as a parameter from one state to another but the object is showing as undefined. Below is the code from GameState whereby I'm looking to pass an object containing a score, time and seconds. this.game.state.start( "Congratulations", true, false, { score: this.killedGerms, time: this.timeLabel.text, seconds: this.remainingSeconds }); Below is the CongratulationsState where the parameter, "data", is coming through as "undefined". init: function(data) { console.log('data', data); data = data || { score: 0, time: "00:00", seconds: 0 }; } Any ideas on where I have gone wrong would be greatly appreciated.
  4. I have a global object called "params" that stores a lot of important parameters for my game. I define params in a "main.js" file that initializes the game, defines my states and parameters, and then calls my "bootState". For some reason, when I restart my "gameState" (another state, defined in "gameState.js") it resets my "params" object to the values it was initialized with in "main.js". My goal is to change some parameters via "params" in the console, then restart "gameState" and have it reflect those changed parameters. If needed I can provide some example code.
  5. hello i want to make a online multiplayer online card game using phaser. CAn you please help me in this that from where i would start??
  6. So i bought the Particle Storm Plugin to get more Particle effects and stuff, pretty awesome... but i'm still a newbie in terms of Particle Emitters and how to produce the best result with them. So many variables and options that by slightly changing them can change the result a lot. I'm trying to add a little smoke/dust trail behind my character when i start running. Sounds simple, huh? So i made a plain squared white 20x20 texture to use it as the particle asset. this.manager = this.game.plugins.add(Phaser.ParticleStorm); let dust = { image: 'dust', blendMode: 'NORMAL', lifespan: { min: 100, max: 200 }, scale: { min: 0.3, max: 2 }, vy: { value: { min: 0, max: 0.1 } }, vx: { value: { min: 0, max: 0.1 } }, rotation: { value: 0, delta: { min: -2.0, max: 2.0 } } }; this.manager.addData('dust', dust); this.emitter = this.manager.createEmitter(); this.emitter.addToWorld(); Then inside the update() function, i track my character's position, is not properly done, though... since it's quite offset. But is just to try it out first. this.emitter.emit('dust', this.x, this.y - 10, { total: 1, frequency: 600 }); The problems i'm encountering is that it feels like particles are going way too fast. I couldn't find a way to slower them down, tried using `frequency`, but emits soo many particles per second that is unrealistic for this specific scenario. I would like to emit for instance, 3 to 5 particles at once, make them rotate a little and change their size (scale) ... with ofc short lifespan otherwise trail will be huge. Another good idea (probably) would be if they kinda fadeOut while lifespan is about to finish. Any help is appreciated.
  7. Firefox Slow FPS

    Hello, Since some day, firefox turn phaser game slow. All game i have created and even litle game downgrade fps. (60FPS to 30FPS) I dont know where is the problem. i have try use phaser but no change. You can try with this example : https://phaser.io/examples/v2/time/slow-down-time if you wait some seconds the animation down to 30fps. this problem is only on firefox (i suppose since v57). All others browsers working fine. Have you an idea where is the problem? Thank you
  8. Play Link: Pixel Memory Find all card pairs, level your profile & unlock new cards in this “Memory” classic optimized for mobile! Play Link: Pixel Memory Welcome to the "Memory" classic, expanded with new features & optimized for mobile! Game Features: Play the “Memory” classic in this mobile game. 3 Difficulties: Easy, Medium & Hard. Level up your profile & unlock more cards. Browse your collection to see which cards you’ve already unlocked. 4 card deck skins: Choose the one you like best! View your profile for your game stats & best scores in all difficulties. Gameplay: Find all the matching card pairs on the table. Find them before you run out of guesses. Unlock all the card packages in the game. Controls: The whole game requires only click inputs and is perfectly optimized for mobile! Credits: The game was developed solely by me. All assets in this game were either done by me or from the CC0 assets linked below. These sources are also credited inside the game: Play Button Name: Cartoon Mobile Rounded Icon Buttons Author: Nathan "GDquest" Lovato, https://opengameart.org/users/gdquest, http://gdquest.com/ URL: https://opengameart.org/content/cartoon-mobile-rounded-icon-buttons Explosion Sprite: Name: 2D Explosion Animations #2 | Frame by frame Author: Sinestesia, https://opengameart.org/users/sinestesia, http://www.sinestesiastudio.com/ URL: https://opengameart.org/content/2d-explosion-animations-2-frame-by-frame http://bit.ly/2C6Bi8b Audio: http://www.freesfx.co.uk/sfx/ Play Link: Pixel Memory
  9. Hello for 2 years now I have been developing games mostly using Java`s and libGDX or/and openGL, but now im very interested in Phaser for web-based game development and I think that is a very powerful tool. I have no problems with game logic but when i come up with render logic in Phaser I need to know if there are possibilities for: 1 Pixel to World unit conversion. ex: In libGDX I can work in 8x6 world units game instead of using pixels units (640*360 for exmaple) , that helps me to write a lot better logic 2 Multiple cameras in the same scene 1 camera for game and more than one for the HUD .
  10. Using Phaser together with React

    I am trying to understand how I could use React for rendering all the UI elements and Phaser for rendering a game (using Canvas or WebGL) within the React application. One way would be to use React's componentDidMount, so after I have my HTML ready I can use a div id to render the Phaser content. But in this case React does the game rendering too. Is there any way to achieve the desired result?
  11. Phaser + Spriter - collision boxes

    Hi, Been trying to get Spriter Pro collision boxes to work in Phaser - has anyone had any luck in getting this to work? I'm close...but not quite there... This is using this plugin by the way: https://github.com/SBCGames/Spriter-Player-for-Phaser
  12. Hi, i'm having a problem with the collisions in my game. I'm using tilemap layers the character can jump as long as it's not touching the ground, but the moment it touches the tiles that are set for check for collision, it just seems unable to move upwards. Can move sideways tho. Everything else is loaded and displayed just fine. BasicGame.Game = function (game) {}; BasicGame.Game.prototype = { create: function () { this.game.physics.startSystem(Phaser.Physics.ARCADE); this.setUpInput(); this.setUpMap(); this.setUpPlayer(); }, update: function () { this.processPlayerInput(); this.processCollisions(); }, /*==========================CREATE ASSOCIATED FUNCTIONS==========================*/ setUpInput: function() { // arrow keys this.cursors = this.input.keyboard.createCursorKeys(); }, setUpPlayer: function() { this.player = this.add.sprite(BasicGame.PLAYER_SPAWN_X, BasicGame.PLAYER_SPAWN_Y, 'player'); this.player.anchor.setTo(0.5, 0.5); this.game.physics.arcade.enable(this.player); this.camera.follow(this.player); this.player.speed = BasicGame.PLAYER_SPEED; this.player.jump_speed = BasicGame.PLAYER_JUMP_SPEED; this.player.body.collideWorldBounds = true; this.player.body.gravity.y = 1000; }, setUpMap: function() { this.map = this.game.add.tilemap('testLevel'); this.map.addTilesetImage('lvl_1_tiles', 'level1_tiles'); // collisionable layer this.collisionLayer = this.map.createLayer('collisionable'); this.map.setCollisionBetween(1, 2000, true, this.collisionLayer); this.collisionLayer.resizeWorld(); }, /*==========================UPDATE ASSOCIATED FUNCTIONS==========================*/ processCollisions: function() { this.game.physics.arcade.collide(this.player, this.collisionLayer); }, processPlayerInput: function() { // reset movement this.player.body.velocity.x = 0; ... // jumping <== it should jump but it doesnt!!! if (this.cursors.up.isDown) { this.player.body.velocity.y = -this.player.jump_speed; this.player.frame = 2; } } }; { "height":10, "infinite":false, "layers":[ { "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 18, 0, 0, 9, 0, 14, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 18, 0, 0, 0, 0, 0, 0, 14, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 14, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], "height":10, "name":"collisionable", "opacity":1, "type":"tilelayer", "visible":true, "width":20, "x":0, "y":0 }], "nextobjectid":1, "orientation":"orthogonal", "renderorder":"right-down", "templategroups":[], "tiledversion":"2017.10.31", "tileheight":32, "tilesets":[ { "columns":5, "firstgid":1, "image":"..\/tilesets\/lvl_1_tiles.png", "imageheight":256, "imagewidth":160, "margin":0, "name":"lvl_1_tiles", "spacing":0, "tilecount":40, "tileheight":32, "tilewidth":32 }], "tilewidth":32, "type":"map", "version":1, "width":20 }
  13. Hello! I'm new to Phaser and HTML5 game development (but not to JS), and have been going through a few free tutorials online. I've already done the mobile toddler's game tutorial, and a simple sidescroller game tutorial, great fun so far! Today I tried to follow an infinite scolling game tutorial (not the same author and not as well written as the first two I followed), but I can't get it to work... The dog falls through the ground on collision with the fleas, and stays stuck down there while the game keeps scrolling. The dog also falls through the ground also after the digging animation... I compared my game.js code to the author's Game.js code, line by line, and didn't see anything missing – I even went so far as to reorder everything the same way she did (the other files were quasi-identical). This is what I found: If I only paste the author's code in place of mine: the game still doesn't work as expected. If I only use the phaser.js v2.1.3 file (from the downloadable source files), instead of the phaser.js v2.6.2 file I use: the game still doesn't work as expected. If I use both the author's Game.js file and phaser.js v2.1.3: the game works! I think that the article must be missing something that can be found in the author's code, because I followed the tutorial exactly. But given that swapping her code for mine still doesn't fix the game, does anyone have any idea what might be causing the player to fall through the ground on collision/overlap? Might it have something to do with gravity, or other physics in Phaser 2.1.3 vs 2.6.2? Thanks in advance!
  14. Play Link: Chase the Shadow A casual, lighthearted 1vs1 Arena Game. Play online in your browser against a friend or anyone waiting in the lobby! Play Link: Chase the Shadow Welcome to this unique little multiplayer game! Built with Phaser CE. You control a wizard with the purpose of defeating the enemy wizard (another player). You are both hiding in the shadows and can use powerful spells! Game Features: Play online 1vs1 against a friend or any person waiting in the lobby. Control a wizard & defeat the enemy wizard. You have 3 spells at your disposal: Fireball, Lightning & Blizzard. Gameplay: You can see the enemy's shadow. Predict his movement and hit him with your spells! Select the right spell for the situation. Move into the right position to aim your spells. Trick your enemy with unpredictable movements. Win by defeating the enemy before he kills you! Controls: Click your wizard to move. Click on the spell scrolls to activate a spell. Plan your next move during your enemy's turn & pay attention to his shadow! I know it can be hard to quickly jump into this game if there is nobody online to play - or no friend available to try it out. I still hope some of you can get to play a match and let me know what you think! Side Note: Why did I build this game? (Not sure if this paragraph is interesting for anyone) I've been doing a lot of client work lately and so much work had to be done on Node.JS. Yet, I always wanted to create a browser multiplayer game running on an Apache server with PHP! Thus, the motivation for "Chase the Shadow" was born. I definitely don't regret doing this in PHP but it does require a lot of thought and planning - something I could have done much better. Either way, the game is done now and I'm happy I did it! Will I do another game in PHP? Probably not for a while. I wanna stay away from multiplayer games in general for now. Credits: The game was developed solely by me. All assets in this game were either done by me or from the CCO assets linked below. These sources are also credited inside the game: UI background Author: Jetrel, https://opengameart.org/users/jetrel Download Link: https://opengameart.org/content/castle-platformer Map Tiles: Author: ansimuz, https://twitter.com/ansimuz Download Link: https://opengameart.org/content/rpg-town-pixel-art-assets Buttons: Author: Kenney, https://opengameart.org/users/kenney Download Link: https://opengameart.org/content/ui-pack Spreading the Word! If you would like to support this game, posting the link below on any of your Social Media accounts would be much much much appreciated! (If you would like to tweet it, you can mention me with @thejamespierce on Twitter.) http://browsergameshub.com/chase-the-shadow-released/ Play Link: Chase the Shadow More Screenshots: Play Link: Chase the Shadow
  15. 1024 Math

    1024 Math Remix on classic game 2048. 1024 Math reminds a game of 2048 from Gabriele Cirulli. There are 18 levels in this game. You need to complete all the goals when you get at each level. https://playcoolmath.com/en/math-games/1024-math Play 1024 Math
  16. Hosting multiplayer games?

    Hi. I'm currently developing a single player game in Phaser and occurred to me to make it online multiplayer instead but I would prefer not to run my own server and wondering what solutions are out there for hosting online multiplayer games? I searched the web and did come across 4 solutions. PlayerIO, AppWarp, Photon and using platforms like Heroku and Amazon.... At the moment I'm more likely go with PlayerIO because the pricing is better, the free package allow me to get started with no obligations and the paid packages also seems cheap compared to other hosts but I would like to get some feedback if it any good or not, should I consider using something else? I would be grateful for any opinion on this or even links to articles I could learn something from. Thank you.
  17. The Canvas doesn't show sprites

    Hi community, I'm having a problem with canvas and sprites. I'm new in this matter and I hope that you could help me The problem, as the title says, is that I can't see the sprites on canvas. I've tried to call the functions preload() and create() manually in the browser's console and I get a warning that says: Phaser.Cache.getImage: Key "bg" not found in Cache. The warning appears for every Key that I'm using for. There is my code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Cat Catcher</title> <script src="./js/phaser.min.js"></script> <script> var game = new Phaser.Game(800, 600, Phaser.CANVAS, {preload: preload, create: create, update: update}); var cat, catcher, cursors, txtScore, score; function preload() { // load assets game.load.image('cat', '/img/cat.png'); game.load.image('catcher', '/img/cat.png'); game.load.image('bg', '/img/bg.png') } function create() { //setup game game.add.sprite(0, 0, 'bg'); catcher = game.add.sprite(400, 300, 'catcher'); catcher.anchor.setTo(.5,0); game.physics.enable(catcher, Phaser.Physics.ARCADE); cat = game.add.sprite( Math.random() * game.width, Math.random() * game.height, 'cat' ); game.physics.enable(cat, Phaser.Physics.ARCADE); score = 0; var style = { font: '20px Arial', fill: '#FFF' }; txtScore = game.add.text(10, 10, score.toString(), style); cursors = game.input.keyboard.createCursorKeys(); } function update() { //game loop code if(cursors.left.isDown){ catcher.x -= 5; catcher.scale.x = 1; } if(cursors.right.isDown) { catcher.x += 5; catcher.scale.x = -1; } if(cursors.up.isDown) { catcher.y -= 5; } if(cursors.down.isDown) { catcher.y += 5; } game.physics.arcade.overlap(catcher, cat, catHitHandler); } </script> </head> <body> </body> </html> I'm using Phaser v2.10.0 I wish you could tell me where the problem is, Thanks!
  18. Hi, I'm syed and i'm new for phaser. how to add restitution for one object not for whole world Note: using P2JS physics engine
  19. Hi people, i'm new into Phaser and its community. I made a little test map with an Object Layer in it, the idea is to add some traps sectors or teleports where if the player touches it, it will teletransport it to some random place. Hence, it won't add any texture to it, i just want to have that area to collide with my player. Is this possible? without having to attach a texture to it? I used the square polygon to do so on Tiled Maps. Exported it as JSON. So here's my Object JSON: { "draworder":"topdown", "name":"objects", "objects":[ { "height":10, "id":1, "name":"trap1", "rotation":0, "type":"trap", "visible":true, "width":128, "x":445.41, "y":627.62, "gid": 2 }, { "height":10, "id":3, "name":"trap2", "rotation":0, "type":"trap", "visible":true, "width":64, "x":1023.87, "y":627.54, "gid": 2 }], "opacity":1, "type":"objectgroup", "visible":true, "x":0, "y":0 }], Then i created a group of traps and try to iterate them one by one to avoid them from falling due to gravity: traps = game.add.group(); traps.enableBody = true; // Get all traps map.createFromObjects('objects', 2, null, 0, true, false, traps); traps.forEach(function(trap) { trap.body.immovable = true; trap.body.allowGravity = false; }); I get the trap individual objects properly, but the problem that i found is, i'm not able to get the width/height i set on Tiled or shows up on my JSON. They are both equals to 1. Why did i lose those width & height values? but others don't such as `x` and `y` coordinates. What do you recommend to do to achieve the same effect? I just want certain areas to be "readable" so i can call functions after collision. It works fine when i set the texture, but also sets the default height x width of the texture applied, and i don't have any way to get the real Tiled values so i can resize my texture properly. Right now if I add a texture it works with this: this.physics.arcade.overlap(player.character, traps, this.resetPlayer, null, this); Even if i try to get the objects by doing: var trap = map.objects['objects'][1] The object returned doesn't contain any width/height. This is what it's returning: gid:2 name:"trap2" properties:undefined type:"" visible:true x:1023.87 y:627.54 I don't know if i explained myself correctly. Hope someone helps me Thanks in advance.
  20. Hi. I made a game using an other engine and would like to port the game over to Phaser but it is using individual images for all sprite animations. I was wondering if is there any way to create a sprite animation from individual images inside Phaser? I was searching the web and everyone seems to offer to pack all images on to a single texture then use an atlas in phaser. It could be the best way to do it, but I'm really would like to know if it possible to create sprite animation inside Phaser without using any 3rd party tools? To give an explanation, I would like to attempt to import the game levels from the JSON exported directly from the tool I was using, so this way I need to remake the game logic only and don't need to worry about building all the levels and menus again. I could just write the import code once, then import all my levels directly from the JSON and I don't need to start completely from scratch. Even if I would be using an atlas, I need to work on this importer to get the position, scale, animation frame and other details of everything in the level so getting the images too and make sprite animations from them could be faster to get the levels up and running in Phaser. Thank you.
  21. I am developing a game where my player has to look to see forward when I am pressing right arrow key. But how can I make it look reverse after pressing left arrow? I can create a sprite of reverse look but how can load that while pressing left and at the same time forward player should be destroyed?
  22. Hi everyone, Video (mp4 or webm) doesn't play on firefox android -> "NS_ERROR_NOT_AVAILABLE" I use Phaser CE v2.10.0 and CANVAS , I unlock the videos before. does not work on examples either : https://phaser.io/examples/v2/video/play-video Thank you in advance !
  23. I want to fill the color in specific tile. The method available in phaser is putTile(), But I want to fill any color I want. In canvas there is method called fillrect(). Please suggest me some solution.
  24. How This Will work?

    I think I will use time loop event and some rndX but i confused how to implement it to my code. I want the rock sticky on the platform so i use phaser arcade mode I want to make it but have no idea. Can anyone help me? Any help will be appreciate
  25. It used to work without problems. Now buttons and sprites will only be clicked/touched if I press ~100 pixels bellow them. I didn't change anything and the problem only exists on android. I think not even on all devices. I use cordova and the newest phaser version. I tried updating cordova but the problem persisted. I think it might have something to do with how I scale the game, but I have no idea how or why this really happens now. It would be great if someone knows why it happens and how to fix it. Here is my code for scaling: var width = window.innerWidth; var height = window.innerHeight; var targetW = 150; var scale = width/targetW; var targetH = height/scale; game.scale.setGameSize(targetW, targetH); game.scale.scaleMode = Phaser.ScaleManager.USER_SCALE; game.scale.setUserScale(scale, scale); game.renderer.renderSession.roundPixels = true; Phaser.Canvas.setImageRenderingCrisp(this.game.canvas) ; And here is how I create buttons: game.add.button(0,50,'play',function(){this.save();game.state.start('Games');},this);