Jump to content


  • Content Count

  • Joined

  • Last visited

About ekstrakt

  • Rank
  • Birthday 02/29/1984

Contact Methods

  • Website URL
  • Twitter

Profile Information

  • Gender
  • Location
    Skopje, Macedonia
  1. From debugging, they both call the same collision method (Phaser.Physics.Arcade#separateTile), and it has nothing to do with the collision. So, it comes to my original assumption about the origin of the issue: the order of calling of State.update(), Sprite.preUpdate() and Sprite.update() methods. This order interferes with how and when the Sprites velocity is calculated, meaning the calculation lags behind the rendering. To explain: Because State.update() gets executed first, it calculates the new velocity values. Then Sprite.preUpdate() gets executed and it sets the Sprites newVelocity
  2. The code I wrote in the original post is pseudo code, for easier explanation of the methods used. I'm calling the physics methods using the game object itself. This is the actual code: Enemy.prototype.update = function(){ this.game.physics.arcade.collideSpriteVsTilemapLayer(this, this.game.globals.layer); ....VS StateMainGame.prototype.update = function(){ this.game.physics.arcade.collide(this.game.enemies, this.game.globals.layer); ....}(I'm hijacking the game object (adding my globals object to it), to pass variables around))
  3. It has nothing to do with how the gravity or velocity is added. The enemies are affected by the world gravity, and when a bomb explodes, their vertical velocity is changed (enemy.body.velocity.y += calculatedNumber). The only difference is the place where I check for collision (State or Sprite). As for the call order, I can't change it, since it's internal part of Phaser.
  4. Hi all, I have a bit of weird behaviour in my code, while trying to optimize it. Setup: A level with a tilemap layer, with enemies and bombs. The enemies extend the Phaser.Sprite class. Arcade physics. Gravity is on. When a bomb explodes, it applies force to the enemies, pushing them away (both horizontally and vertically). The issue: When I use States update() function to check for collision, it works fine, the enemies are launched in the air (depending on proximity): //pseudo codeGameState.prototype.update = function(){ Phaser.Physics.Arcade.collide(enemiesGroup, layer);}Having a
  5. Thanks. As you can read in my post I considered this option (only getting the math on paper, without testing in game, which is my bad), but I wasn't aware that the velocity will degrade by time (and I still don't know why it degrades or how to control the rate, so if you have time to explain, please do, or link to the source code). With this, the effect is pretty close to what I'm after. Next I need to see how will the sprites behave when they have AI (movement).
  6. Hi all, I'm struggling a bit to find a way to make a realistic explosion effect (physics, not visual). The situation is this: The game is a horizontal side-scrolling platformer. I have a player that's throwing grenades. On impact with a tile, the grenade explodes. I want all enemies (sprites) within the blast to be affected by a realistic circular blast wave, pushing the enemies away in relation to how close they were to the impact point. I have the impact vector (distance and angle from impact point), and I can calculate the impact force (closest - max force, further - less force) in re
  7. I forgot to mention that I read this, and also find it inefficient, as it loops through all the walls and creates 4 lines for checking, on every frame. As I said in my post, I'm looking for more efficient way (is there a sprite at a point, without looping throught all).
  8. Hi all, Having started with Phaser a few days ago, I can't find any example or documentation about raycasting. So, to explain what I'm after: For a simple platformer, I have a character that's shooting at enemies. But, I don't want the bullets to be objects (sprites), because of the fast speed (the collision check might fail). So I thought about using raycasting, and have the first enemy in the line of sight take damage. Or, in some case, every enemy in the line of sight (until a specific tile is hit, the end of the world is reached, or a specific distance). The ray is always horizonta
  • Create New...