Jump to content


  • Content Count

  • Joined

  • Last visited

  1. Wondering what the best way to play a sound effect in Phaser 2 is. So far I've been doing something like this: sfx = new Audio('sound1.mp3'); sfx.volume = .5; sfx.play() The same variable "sfx" gets used for each sound, it's just reassigned on the spot as 'sound2.mp3', 'sound3.mp3', etc. I'm sure this is the wrong way, but it does get it all done in a single line per sound effect. Nevertheless this method causes a small delay which causes the game to freeze for 1/10 of a second the first time it is played, which then causes objects to fall through floors occasionally. I looked at some o
  2. Available now at: https://nekozuki.itch.io/lotus-crusade or https://gamejolt.com/games/lotuscrusade/630209
  3. thanks again @Horizonicblue, i've run into this tutorial before and it's still a bit convoluted for my tastes. i'll stare at it again though and see what i can extrapolate out of it. in the meantime i've coded things in a manner that avoids states entirely (except for the main game state).
  4. seriously? no one on this whole wide site knows how states in phaser 2 work? i solved the prob without using states, but i still wouldn't mind hearing a salient explanation on how to use them.
  5. this seems a rudimentary task, but i'm actually having trouble implementing a title screen into a game. i've saved this task for last thinking it simple, but i can't seem to find a way to do it cleanly. i believe the creation of "states" is involved, but i can't figure these out, and the one example on the phaser website is hopelessly confusing. everything in this project thus far is located in a single "game.js" file. i tried making a separate "title.js" and going from there, but perhaps this is the wrong approach. i simply want something that occurs before the game.js, shows a static im
  6. well, i found a quasi-solution that doesn't involve addChild at all. instead it involves forEachAlive and detecting whether or not the player is in FRONT of a spear guy. if so, the player's attacks don't work against them; only from behind. i'd provide an example, but this seems a pretty insular issue.
  7. this is very hard to explain, but i essentially have a bunch of sprites holding spears, and seek to have their range beyond what the player can hit from the front. i want the hit box of the "spearman" to be smaller than its weapon (ie: sprite.scale.set(.5, 1)), and believe the best way to do this is to add a second child sprite which is smaller than the original sprite as the hittable body. trouble is, the children inherit the parent's properties, which is not wanted. another way is to make the ORIGINAL body smaller and add a larger child sprite as the spear, but this creates problems with hor
  8. tres bien!~ it did help, thanks @Horizonicblue. bats.forEachAlive(function(bat){}) was the missing link. i'm often confused when using the () to grab specific sprites in a group, but this pointed me in the right direction.
  9. thanks so much for the reply. could i trouble you for an example? i checked for one on the phaser website but couldn't find one for the desired effect.
  10. anyone? the basic question i guess is how do you assign unique functions to individual sprites in a group of 6 without having to assign variables to all 6. for instance, if you made the sprites like this: for (i = 0; i < 6; i++) {bat.create(Math.random() * 600 + 300, Math.random() * 600 + 300, 'bat') bat.callAll('animations.add', 'animations', '1', [0, 1], 6, true); bat.callAll('play', null, '1')} the top line creates 6 randomly placed "bats" in a perimeter while the bottom one adds and plays animations for all. i'm looking for an effect like the bottom line, except one that detects
  11. suppose you have two different lines: game.physics.arcade.overlap(pl, bat, function(sp, sp2) {sp2.kill()}) and if (game.physics.arcade.distanceBetween(pl, bat) < 222) {bat.kill()} the top detects when the player touches a randomly placed bat in a group and kills it, the second detects when the player is in RANGE of a randomly placed bat in a group and kills it. the problem is the second one doesn't work. i'm essentially looking for a way to merge these two so that the bat in line 2 dies the way the one in line 1 does. this doesn't seem to work either: if (game.physics
  • Create New...