• Content count

  • Joined

  • Last visited

About Xesenix

  • Rank
  • Birthday 12/01/1985

Contact Methods

  • Website URL
  • Twitter

Profile Information

  • Gender
  • Location
  • Interests
    I like programming, drawing and creating pixel art graphics and lately I spend a lot of time on composing music for my games.

Recent Profile Visitors

354 profile views
  1. 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?
  2. You can turn of physique on objects that don't need to be moved anymore.
  3. 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
  4. 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.
  5. localstorage

    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; }
  6. 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.
  7. What is huge map for you? I am currently working on maps up to 400x400 tiles something like this:
  8. 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
  9. 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 }
  10. 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.
  11. 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.
  12. 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
  13. 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
  14. Thank you i wonder what i have made wrong before i thought i have tested this combination.
  15. 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