• Content count

  • Joined

  • Last visited

About fpg246

  • Rank
  • Birthday January 16

Contact Methods

  • Twitter

Profile Information

  • Gender
  • Location
    NJ, USA
  1. Trouble understanding friction and drag

    I no longer have ice cubes for trash. Thank you, samme! The sweet spot is somewhere between 100 and 500 it would seem. Is there a way to get sprites to "roll"? I see that you can do rotation, but I would imagine that if rolling occurs using rotation, it'd be related to a function/some math. Again, thanks. EDIT 7:35 pm EST -- Should I look into angular velocity?
  2. I'm using physics in one of my games, but I'm having trouble getting things to move realistically. I have the player (a bird), and I have objects in a group (trash). The trash I want to be very lightweight, so that it can be knocked around by the bird. Setting mass on both the player and the objects sometimes results in some weird visual stuff, so for now I have taken those lines out. What I really want to solve is the issue of friction. Right now, my code looks like this: this.trash.forEach(function (piece) { piece.anchor.setTo(0.5, 1); piece.body.gravity.y = 5; piece.body.moves = true; piece.body.velocity.setTo(100, 100); piece.body.collideWorldBounds = true; piece.body.bounce.set(0.8); piece.body.friction.x = 1; piece.body.drag.x = 1; }); The trash is gliding around on the floor of the game like wet ice cubes. I thought perhaps introducing another sprite to interact with would help: this.platforms = this.add.physicsGroup(); // Create the ground and set properties. this.platforms.create(0, game.height - 5, 'ground'); this.platforms.setAll('body.allowGravity', false); this.platforms.setAll('body.immovable', true); this.platforms.setAll('body.moves', false); this.platforms.setAll('body.velocity.x', 100); this.platforms.setAll('body.friction.x', 1); this.platforms.setAll('body.drag.x', 1); I'm still watching ice-cube trash. What I'm aiming for is something that can tumble (is there a way to get corresponding rotation on collision to happen?), so I want moving the trash to be more of a shove to move a distance rather than a tap from the player. Thank you for your help!
  3. Particle emitter never turns on?

    Update: problem solved by moving where the code was in relation to... the background. Thank you >_<
  4. Particle emitter never turns on?

    Hi, everyone. I've not been able to find any similar issues to mine, so I'm posting a new topic asking for help. I'm using Phaser 2.6.2 to develop a multiplayer web game. I want a particle emitter to start at the location of the player when a button is pressed, in an explosion. In create(), I have the following code: this.emitter = game.add.emitter(0, 0, 8); this.emitter.makeParticles('seeds'); this.emitter.gravity = 500; I ask the emitter to start later in a custom function called dump(), passing in the player's coordinates. Dump() is called by a function when the variable appleEaten is true and the player is on the right part of the screen. dump: function (x, y) { appleEaten = false; this.emitter.x = x; this.emitter.y = y; console.log(this.emitter.maxParticles); this.emitter.start(true, 1000, null, 8, 8); console.log(this.emitter.x + ", " + this.emitter.y + " is the emitter."); console.log(this.emitter.on); // this is returning false? The program correctly knows how many particles it should spew (8). The emitter is at the correct coordinates based on another console log. However, this.emitter.on console log always returns false. I have the same console log line running in update, and of course it's false every time there, too. Basically, the emitter just doesn't turn on, and I don't know why. I am not getting any errors in the console, either. Has anyone run into this, and/or does anyone have a suggestion on how to approach this? Thank you! EDIT: I load 'seeds' in another state, as with all of my images. When I try to add 'seeds' as an image in create, nothing shows up, and again, no error. I imagine these are separate issues, but I could be wrong.
  5. Game freezing: Map won't load, error is unclear

    This was it!!! Thank you so much!
  6. Game freezing: Map won't load, error is unclear

    Hi Samme, Thank you for your reply. I agree, editing the map by hand probably did spoil it. Tiled wouldn't even reopen the JSON files that I touched. What I don't understand is why these errors don't go away when I leave the file in its default state. I will make sure to double check all of my layer names, etc, as Skeptron has suggested. Will update this thread when I go back and test it again.
  7. Hi all, I'm new to development in general and definitely new to Phaser, and I have run into an issue I haven't seen mentioned elsewhere. I had followed a tutorial from Discover Phaser to create my first game. The tilemap was created using Tiled and exported as a JSON file. In order to get the tutorial game to run, I needed to edit the data in the JSON file. I'm using Brackets to edit my code and have not touched the minified framework file. I am now building my own simple game with a small tilemap (12x12), and have exported a JSON file. However, whether I leave the JSON file as is, or I edit it so that its structure is identical to what worked in Discover Phaser's tutorial, my game still crashes when it tries to load the map. The errors I get look like this: When I try exporting the map as a CSV file, the game no longer freezes, but the map still doesn't load. The only error that shows is this one, from the 25th line of the phaser.min.js file: There are a few things I don't know. What any of these errors mean in terms of trying to load the tilemap Why I'm getting these errors What Phaser is expecting to come out of these files. What is it reading? If anyone could shed some light on this, I'd be eternally grateful.