Xesenix

Members
  • Content count

    22
  • Joined

  • Last visited

About Xesenix

Contact Methods

  • Website URL
    xesenix.pl
  • Twitter
    xesenix

Profile Information

  • Gender
    Male
  • Location
    Poland
  • 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

433 profile views
  1. 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 }
  2. 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)
  3. 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.
  4. 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?
  5. You can turn of physique on objects that don't need to be moved anymore.
  6. 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
  7. 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.
  8. 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; }
  9. 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.
  10. What is huge map for you? I am currently working on maps up to 400x400 tiles something like this:
  11. 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
  12. 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 }
  13. 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.
  14. 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.
  15. 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