• Content count

  • Joined

  • Last visited

Everything posted by Xesenix

  1. Xesenix

    Weapon with particles...lag, why?

    Am I wrong or are you creating particle emitter on every frame? this.particlex = game.add.emitter(this.x+35,this.y) you should probably create one emitter for all your effects and only call emit on that one emitter. Also, read about object pooling phaser has some build in particle emitters but you can make your own pools for other sprites.
  2. Xesenix

    Resizing Issue with setGameSize

    Ad1) I think you search problems where there is none when exactly do you expect your players to resize game while playing?
  3. Xesenix

    Touching but not coliding

    Basic idea create areas for nonNewtonian fluid material and in update use ordinary arcade physique overlap instead of collision to check what is overlapping and modify unit s body velocity or acceleration game.physics.arcade.overlap(nonNewtonianAreaGroup, unitsGroup, onCollision) onCollision = function(unit, area) { // modify unit.body.acceleration.y so when unit.body.velocity is large it gets accelerated upwards // or think of something more elaborated for working in any direction }
  4. Xesenix

    Touching but not coliding

    What kind of physique are you using, this is platformer are you using tilemap? When i read this i have two contradiction ideas about what you want: 1. you want your terrain on top of which units are moving to influence their properties 2. you want some area to behave like Newtonian fluid, and im not sure if you know what it means in real life (like if object isnt moving it sinks into that material and when its moving it can push itself from it)
  5. Xesenix

    Load polygon - Phaser

    From what you showed here i can only deduce 'grassBody' isnt present in json file or is misspelled. Attach assets/img/assets-pack.json content for more help.
  6. Xesenix

    The Phaser 3 Wishlist Thread :)

    I dont know if it was asked before but if you try to make large tile map its RAM consumption can get pretty high (like each of tiles keeps own bitmap data or something) maybe you can look into optimizing that?
  7. Xesenix

    Blood. Blood everywhere. How best to do it?

    You can turn of physique on objects that don't need to be moved anymore.
  8. Xesenix

    Update Score

    var score = null// move score outside of create function create() { ... score = game.add.text(...) } function firstResponse() { ... // on good answer count += 1; score.text = "Score:" + count; } function secondResponse() { ... // on bad answer count -= 1; score.text = "Score:" + count; } You need some global accessible label so you can update its content after clicking anwser
  9. Xesenix


    I start my music samples like this: // that bit is important for RAM consumption you usualy dont need WebAudio if you dont do fancy things window.PhaserGlobal = { disableWebAudio: true }; var game = new Phaser.Game(480, 320, Phaser.AUTO, null, { preload: function() { game.load.audio('Good-Riddance', 'Good-Riddance.mp3'); }, create: function() { var soundtrack = game.sound.play( 'Good-Riddance',//cache key 1,//volume true//loop ); soundtrack.mute = false;// if you want to mute it } }) If something doesnt work check browser console for errors F12 maybe your file is in different place? Or you running script from file path instead of server can be problem sometimes but should be in this case but if it is you can use for example brackets editor that starts small development server for serving your files.
  10. Xesenix

    Help With localstorage api

    You probably stored something not numeric in localStorage and now get bad results like NaN? If that is the case try this: init(score) { score = isNaN(score) ? 0 : score; this.highestScore = Number(localStorage.getItem("score")); this.highestScore = isNaN(this.highestScore) ? score : Math.max(score, Number(this.highestScore)); localStorage.setItem('score', this.highestScore); return this.highestScore; }
  11. If you have sprite atlas for this sprite sheet you can check this: https://phaser.io/examples/v2/animation/sprite-sheet sprite.animation.add(name, frames, frameRate, loop, useNumericIndex) You can check this: https://github.com/photonstorm/phaser/blob/v2.6.2/src/animation/AnimationManager.js line 170 for more details how it works.
  12. Xesenix

    Handle huge maps

    What is huge map for you? I am currently working on maps up to 400x400 tiles something like this:
  13. Xesenix

    Centering text in v2.6.2

    I am centering my text like this: var label = this.game.add.text( positionOfTextCenterX, positionOfTextTopY, 'Some text to display\nMay be multiline', { font: '64px ' + fontNameUsedInGame, fill: '#ffffff', align: 'center' } ); label.fixedToCamera = true; // so it will move with camera label.anchor.setTo(0.5, 0); //titleLabel.anchor.setTo(x, y); // x: // 0.0 = left // 0.5 = center // 1.0 = right // y: // 0.0 = top // 0.5 = center // 1.0 = bottom
  14. Xesenix

    Character Selection menu

    you can pass initialization values for state via state.init so you can have state for choosing character and when character is chosen you can run: // choosing character state game.state.start('playState', clearWorldBoolean, clearCacheBoolean, paramsYouWantToPass) // playState init: function(paramsYouWantToPass) { //do whatever you need to do with chosencharacter passed via paramsYouWantToPass }
  15. Xesenix

    FPS drop

    Some performance optimization i have found for my game are: do not use webgl - this one can make a large difference in fps do not use webaudio if you dont need it - this one helps on ram consumption you may turn it of before starting phaser with this: window.PhaserGlobal = { disableWebAudio: true } if you use large map toggle sprite visibility of when they are out of camera view sprite.visible = false if you have full background you can set clearBeforeRender = false - didnt see much difference but may help in some cases game.clearBeforeRender = false if you don`t need running in background disableVisibilityChange = false (by default but you may have changed it) game.stage.disableVisibilityChange = false if you are using pixelart set antialias = false game.antialias = false Probably there will be more to come but at this time it enough for me to keep 30fps even on slowest device i have.
  16. It didn`t I checked source code it has condition if HEADLESS and cant instantiate canvas throw error it doesn't have any checks condition for webgl so I have used it instead and it worked for testing so i left it that way.
  17. I am writing games in Phaser using webpack for building deployment versions and running hot reload server for development and i am using karma for testing. I am new to most of those technologies so i am open to critique but if someone looks for starting point for connecting Phaser with those technologies i have made git repo that maybe is good starting point to start building your own projects: https://github.com/Xesenix/game-webpack-react-phaser-scaffold If you are more advanced at using such an environment for developing phaser games I would appreciate advices what i can fix with it
  18. Xesenix

    Phaser Games made for Ludum Dare 37

    Look out for sever cancerness of my project: http://gamejolt.com/games/ld37-elephant-in-the-room/217013 I have tested spine2d in this project so if you are interested how to implement that you can check source code: https://github.com/Xesenix/ludumdare-37
  19. Xesenix

    How to pass vectors and colors to filters uniforms

    Thank you i wonder what i have made wrong before i thought i have tested this combination.
  20. var Colorize = function (game) { Phaser.Filter.call(this, game); this.uniforms.uColor= { type: '3f', value: { r: 0.5, g: 0.5, b: 0.5} }; this.fragmentSrc = [ "precision mediump float;", "uniform float uColor;", "void main(void) {", "gl_FragColor.r = uColor.r;", "gl_FragColor.g = uColor.g;", "gl_FragColor.b = uColor.b;", "gl_FragColor.a = 1.0;", "}" ]; }; It works if i pass each color channel as separate value but i can find combination of type and data structure that would do the same in single object
  21. Xesenix

    The Phaser 3 Wishlist Thread :)

    Biggest problem i have with phaser move around scalling it seams like it design flaw for example why world coordinates of sprite change when i scale camera and then arcade physique stops working debug layer shows everything all right but sprites start fall thru tiles.
  22. Hi everyone, this is my first entry on this forum. Im getting a lot of help from threads around here so i thought i will share effects of my adventure with html5. I have created "Ancient Maze of Epla" as part od ludumdare 36 comp it took me 36h. I have used phaser connected with nodejs and grunt browserify. You can check source code here if you find that im doing something horrible wrong i would appreciate feedback. Im working on cleaning up that code so i can use it as base for games prototypes. Ancient Maze of Epla is short puzzle game with sokoban like mechanic with difference that everything moves when you give one of commands (up/down/left/right). You can check it either on Kongregate or Gamejolt. And if also took part in ludumdare and wish to comment here is link to ludumdare 36 entry. Also i have upgraded Kongregate version with their api implementation and added lead boards for number of steps required to finish each level to give it some replay ability. I would appreciate any feedback as this is only my second webgl game in phaser (earlier was only ludumdare warmup) and i want to make more projects with that game engine.