• Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by codevinsky

  1. I updated the generator to default to 2.0.2 and to use Browserify for dependency injection.
  2. codevinsky

    Mobile Audio

    Did any of these suggestions help?
  3. I switch things over to mouse aiming. Is that better or worse than keyboard aiming?
  4. You're the third person to mention that today. I've added it to my notes, along with power up/enemy ideas.
  5. I created a game many years ago in flixel called Chromatoids. It was more of a "can I do this?" project as opposed to "let's really make this thing happen." I've been trying to bust out a full game in Phaser recently, and I decided to revisit my original idea. I've pretty much got the original game implemented again, but I need some help making my game more.... game-y. WASD to move. Cursors to fire. Color kills color. My questions: What kind of enemies should I add? Should I add power-ups? (And if so, what would be good?) Should I add boss battles? (And if so, how often? and what should they do?) Should I add achievements? And how do I go about tracking them properly? General feedback is welcome.
  6. Using the demo I was writing earlier today: The sound properly slows down, but the low pass filter only takes effect when the game loses focus. To reproduce: Load the link, wait for the music to start, make sure the game window is in focus, press the space bar, wait for it to drop to the slow speed, and then click somewhere outside of the game or create a new tab. You'll hear the filter immediately kick in at that point, when the game regains focus, the filter is completely lost. Rich, or anybody who knows: Can you tell me what happens when the game loses focus that would cause this strange behavior?
  7. Very nice. Gonna take a look at this tomorrow.
  8. Part 2 of Phaser 2.0 and Flappy Bird: Physics and Prefabs:
  9. I'm trying to manipulate audio playback speed programmatically via the web audio api and phaser's Sound class. You can watch me do it live here:
  10. Hey LessMilk: My self-hosted blog crashed the other day, so I've moved everything to Can you please update the Polygon Collision tutorial link appropriately? Also: Not to step on anyone's toes, but I've also started a Flappy Bird tutorial series for Phaser 2.0... Here's the first post:
  11. That's what I get for not unlinking my local npm module. It's fixed. You'll need to run: $ npm update -g generator-phaser-officialThat's my bad.
  12. I spent the day creating a generator for phaser projects. Install the generator: $ npm install -g yo generator-phaser-officialCreate a project directory $ mkdir phaser-bird && cd $_Run the generator $ yo phaser-officialAnswer the questions at the prompts. The generator will create the scaffolding and install the dependencies. It also has a very simple "hello, world!" game included so that you can see how this workflow operates. Run the server $ grunt This will build and compile the required index and bootstrapper files, start a server, watch files for changes, and reload your browser when you've modified and saved a file. Write your code All game code will reside in the game directory. You shouldn't need to modify the main.js file, and in fact, you shouldn't. On each build, the main.js file gets overridden with references to your game states. Extras: Generate a new game state $ yo phaser-official:state "stateName" This will create a new stateName.js file in the game/states directory as well as add it to the included scripts and bootstrapper. Generate a new prefab $ yo phaser-official:prefab "prefabName" This will create a new prefabName.js file in the game/prefabs directory as well as ad it to the included scripts. Hope you guys will enjoy it.
  13. First, thank you for the answer. It was much more thorough than I was expecting. Secondly: You know how there's the things you know, and then things you know you don't know? There's also an entirely third area: The Things You Don't Know you Don't Know. Almost all of game dev falls under the third category for me. So take that into account when you read one of my questions and you go: "Wow. That's a stupid question." Your response to a blog post I made recently concerning polygon collisions (and fishrock's explanation there of) is a good example there of. That being said, I've got a follow up question: What use is the physics engine other than to tell us what has collided against what? My assumption is that the physics engine only exists to run the simulation on each step and provide the game with data. To the extent of my knowledge, (which, as I've just said, isn't much) the physics engine's sole purpose is to tell use what collided with what and where things are. If that's the case, wouldn't a simple adapter class be all we'd need? function PhysicsAdapter() { this.collisions = []}PhysicsAdapter.prototype.setCollisionData(collisions) { this.collisions = collisions;}PhysicsAdapter.prototype.getCollisionsData() { return this.collisions;}PhysicsAdapter.prototype.update() {}function P2Interface() {}P2Interface.prototype = new PhysicsAdapter()P2Interface.prototype.update = function() { PhysicsAdapter.prototype.update.apply(this, arguments); world.step(1/60);}That's obviously a severe oversimplification. Upon thinking through it, you'd need to move sprites based on physics data as well. I suppose I answered my own question and the answer is: Smarter people than I have done this a lot longer than I have and have decided on the best roadmap for this library. However, I'm still going to feel free to complain about things I don't understand until I understand them. I hope we're all copacetic with that.
  14. Why aren't the physics engines stand-alone/plugin projects? Would it not be possible to have an adapter layer that must implement some interface for passing back collision data so that we could use which ever physics engine we wished and without having the bloat of trying to wrap other physics engines into Phaser? I'm asking this both from an academic and practical point of view. Is it slower to do it that way? Is it something you considered/attempted and decided it wasn't gonna work? Was it completely unfeasible? Just curious.
  15. I've written a short blog post on how to do it. Phaser and Physics: Polygon Collision Primer Or, if you want to jump straight to the code/demo:
  16. Here's one I just wrote: Would you mind adding it to the list?
  17. I'm trying to add a second shape to a body that is a sensor only. The first shape in the body is triggering collisions correctly, but the the sensor shape is not. Here's the code: var cop = policeGroup.getFirstExists(false); if(!cop) { cop = game.add.sprite(game.width,500,'police'); game.physics.p2.enable(cop,true); cop.body.clearShapes(); cop.body.loadPolygon('physicsData', 'police-car'); cop.body.fixedRotation = true; = p2.Body.KINEMATIC; cop.body.bounce = 0; = 'enemy'; var circle = cop.body.addCircle(40,0,120); circle.sensor = true; cop.body.setCollisionGroup(enemyCollisionGroup); cop.body.collides(playerCollisionGroup); cop.outOfBoundKill = true; cop.checkWorldBounds = true; debugger; } cop.reset(game.width, 500); cop.revive(); cop.body.moveLeft(300); copTimer = + 2000;The polygon is colliding correctly, however, the circle isn't. What am I doing wrong?
  18. This is the correct code: create: function() { game.physics.startSystem(Phaser.Physics.P2JS); game.physics.p2.gravity.y = 500; playerCollisionGroup = game.physics.p2.createCollisionGroup(); groundCollisionGroup = game.physics.p2.createCollisionGroup(); enemyCollisionGroup = game.physics.p2.createCollisionGroup(); console.debug('pcg:', playerCollisionGroup); background = this.add.tileSprite(0,0,1024,600,'background'); background.autoScroll(-25,0); ground = this.add.tileSprite(0,504,1024,96,'ground'); game.physics.p2.enable(ground,true); console.debug(ground.body,true); ground.body.fixedRotation = true; = p2.Body.STATIC; ground.autoScroll(-300,0); = 'ground'; ground.body.clearShapes(); ground.body.setRectangle(1024,96,ground.width/2, ground.height/2); ground.body.setCollisionGroup(groundCollisionGroup); ground.body.collides(playerCollisionGroup); player = game.add.sprite(300,400,'horse'); player.animations.add('run',[0,1,2,3]); player.animations.add('jump',[3]);'run',12,true); game.physics.p2.enable(player,true); = 'player'; player.body.setCollisionGroup(playerCollisionGroup); player.body.collides([groundCollisionGroup, enemyCollisionGroup]); },Thanks to @Fishrock123 for helping out.
  19. I've got a ground TileSprite. I've got a player Sprite. The ground TileSprite should not move, ever. But it should collide with player, and enemy sprites. My code currently looks like this: create: function() { game.physics.startSystem(Phaser.Physics.P2JS); game.physics.p2.setImpactEvents(true); game.physics.p2.gravity.y = 500; game.physics.p2.updateBoundsCollisionGroup(); playerCollisionGroup = game.physics.p2.createCollisionGroup(); groundCollisionGroup = game.physics.p2.createCollisionGroup(); background = this.add.tileSprite(0,0,1024,600,'background'); background.autoScroll(-25,0); ground = this.add.tileSprite(0,504,1024,96,'ground'); game.physics.p2.enableBody(ground); ground.body.fixedRotation = true; = p2.Body.STATIC; ground.autoScroll(-300,0); ground.body.setCollisionGroup(groundCollisionGroup); = 'ground'; ground.body.collides(playerCollisionGroup, function(a, { console.log('ground collided',a,; }); player = game.add.sprite(300,400,'horse'); player.animations.add('run',[0,1,2,3]); player.animations.add('jump',[3]);'run',12,true); game.physics.p2.enableBody(player); = 'player'; player.body.setCollisionGroup(playerCollisionGroup); player.body.collides(groundCollisionGroup, function(a, { console.log('player collided',a,; });I get logs of both the ground and the player colliding with the correct bodies, but the player sprite falls through the ground sprite any how. What am I doing wrong?
  20. I put this together today just to test out some of the new features as well as get a handle on exactly what raytracing is, how it works, and why it might be important. Phaser: Light and Magic: Source: Please note, the code isn't cleaned up. There's some left over stuff from other demo projects in there, all you need to worry about is what's in play.js
  21. -----------------------------^ me
  22. I think you should do away with the reference manual all together. The documentation for Phaser is actually pretty fantastic and explains how to use the classes perfectly already. I think a single "Learn By Example" or "Cookbook" tome would be the best bet. In doing this, it's likely that you'll cover most of the basic and some of the advanced usages of all the classes already, you won't duplicate effort, and you'll minimize redundancies.
  23. I've got the player, and my tilemap. I'd like to keep my player in side of the boundaries created by the tilemap, and also recognize when the player has collided with, say, one of the doors that is on my tilemap. How do I go about doing that in 1.2?
  24. I'm getting the same thing.