• Content count

  • Joined

  • Last visited

About Pixelguy

  • Rank
    Advanced Member

Profile Information

  • Gender
  • Location
  1. Thanks, thats what I ended up doing. Thank you for the examples samid737 For future reference here is the code I ended up with: updateEnemy: function() { if ( game.math.difference(this.enemy.y, this.ball.y) > game.globals.enemyMovementDeadzone ) { if ( this.ball.y < this.enemy.y ) { this.enemy.body.velocity.y = -game.globals.maxEnemySpeed; } else { this.enemy.body.velocity.y = game.globals.maxEnemySpeed; } } else { this.enemy.body.velocity.y = this.ball.body.velocity.y; this.enemy.body.maxVelocity.y = game.globals.maxEnemySpeed; } },
  2. Hey there, I'm trying to get an AI to follow another sprite along the Y axis but as soon the exact Y location is almost reached the AI sprite gets jittery due to constant overshooting. What would be the correct way to implement such a behavior while using a fixed velocity? I've included a simple example below where the sprite should move to game.height/2 : The usage of the offset variable seems hacky and wrong. (Set 'offset = 10' to stop the jitter). And thanks in advance, it's been a few years since I last touched phaser
  3. Platformer: Arcade or Arcarde + P2?

    But then I need to use p2 for each object I want the player to collide with right? Which is basically everything I spawn :/
  4. Platformer: Arcade or Arcarde + P2?

    Good idea but that leads to some unexpected behaviour while standing on edges and looks somewhat strange overall.
  5. Platformer: Arcade or Arcarde + P2?

    Hey guys! It's been a while but I finally have some free time on my hand and decided to give Phaser another go. So with all the new fancy an new possibilities regarding physics I have a question for you guys. I am currently building a simple platformer. Current stage is mostly drawing assets designing levels etc. but I even did some prototyping today and ended up with my Top1 awkward platformer problem: As you might suspect I am using the arcarde physics and my player model (black thingie) is a simple sprite that gets stuck at the edge of the platform while moving up. So here is the Question: Should I stick with arcade all the way and slice my player into 2 smaller boxes (top and bottom part) that move along together (in case that's not a big no-no already) or should I use the new p2 physics for my player collision? All I want is to get rid of the awkward hitbox that comes with the sprite. The player will otherwise only collide with other enemy/item sprites where Arcade physic are more appropriate. :/ I did some research, checked the p2 examples and found this thread among others but couldn't find any examples that allowed me to get a arcade/p2 hybrid platformer running where the player collides with sprites handled by the arcade physics. I tried some approaches but it ended up not working. http://www.html5gamedevs.com/topic/4518-explaining-phaser-2s-multiple-physics-systems/ Do you have a hint or even a snipped for me on how to approach this problem? Greetings and thanks!
  6. The first official Phaser book

    Why are there no more updates on the forums. Shouldn't the book get on sale today?
  7. Game list of phaser games

    Same for germany
  8. Character Dash

    Okay my code was kinda rubbish if you look at the bigger picture Made a quick example: var game = new Phaser.Game(1024, 672, Phaser.AUTO, 'holder', { preload: preload, create: create, update: update });function preload() { game.load.image('space', 'assets/space.png'); game.load.image('ground', 'assets/platform.png'); game.load.image('player', 'assets/single-dude.png');}var platforms;var player;var globalGravity = 9;var dashingRight = false;var dashingLeft = false;var oldPos;function create() { // place stuff game.add.sprite(0, 0, 'space'); // The platforms group contains the ground platforms = game.add.group(); /// Dont look at this.. totally bad var ground = platforms.create(0, game.world.height - 64, 'ground'); ground.scale.setTo(4, 2); ground.body.immovable = true; var leftWall = platforms.create(0, 0, 'ground'); leftWall.scale.setTo(0.1, 50); leftWall.body.immovable = true; var rightWall = platforms.create(game.world.width - 20, 0, 'ground'); rightWall.scale.setTo(0.1, 50); rightWall.body.immovable = true; // The player and its settings player = game.add.sprite(game.world.width/2 , game.world.height -120, 'player'); // player physics properties. Give the little guy a slight bounce. player.body.gravity.y = globalGravity; player.body.collideWorldBounds = true; // Our controls. cursors = game.input.keyboard.createCursorKeys(); spaceBar = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); dashE = game.input.keyboard.addKey(Phaser.Keyboard.E); dashQ = game.input.keyboard.addKey(Phaser.Keyboard.Q); dashQ.onDown.add(dashLeft, this); dashE.onDown.add(dashRight, this);} // create endfunction update() { player.body.velocity.x = 0; //Collision game.physics.collide(player, platforms); if (player.body.touching.left || player.body.touching.right) { dashingRight = false ; dashingLeft = false ; } // check for key inputs inputHandler(); if ( dashingLeft && (oldPos - player.x < 100) ) { // 100 would be the length of your dash move player.body.velocity.x = -500; // or something some other dashing speed } else { dashingLeft = false; } if ( dashingRight && ( oldPos - player.x > -100) ) { // 100 would be the length of your dash move player.body.velocity.x = 500; // or something some other dashing speed } else { dashingRight = false; } } // update endfunction inputHandler() { // Arrow right if (cursors.right.isDown) { moveRight(); } // Arrow left if (cursors.left.isDown) { moveLeft(); } // Arrpw up if ( cursors.up.isDown ) { jump(); }}function jump () { if (player.body.touching.down) { player.body.velocity.y = -300; }}function moveRight() { player.body.velocity.x = 100;} function moveLeft() { player.body.velocity.x = -100;}function dashRight () { oldPos = player.x; dashingRight = true; dashingLeft = false;}function dashLeft () { oldPos = player.x; dashingLeft = true; dashingRight = false;}Live test: https://dl.dropboxusercontent.com/u/7910081/html5examples/dash/dash.html
  9. Using Sprite velocity makes things "choppy"

    You should use: sprite.body.velocity.x = -100
  10. Character Dash

    I've edited the code above a little bit. Still untested but If I look at it given the fact I wrote it on my phone.. it somehow makes sense Good luck
  11. Character Dash

    1000 is rather fast. Maybe try something slower. But I don't know what "dasOut()" does.. that part seems a bit odd. I suggest you store the players X position in a variable eg. "oldPos" on calling dashRight() and set some bool eg. "dashingRight = true". Then all you have to do in your update() is something like: if ( (dashingRight ) && (oldPos - player.x < 500) ) { // 500 would be the length of your dash move player.body.velocity.x = -1000; // or something some other speed justDashed = true; } else { dashingRight = false ; if (justDashed) { player.body.velocity.x = 0; // stop the player after dashing justDashed = false; } }And don't allow the dashRight() function to be called if dashingRight is already true. Of course you also have to set dashingRight to false if the player collides with any obstacles. Something like that would be my approach
  12. Make Particles collide with floor in a Topdown-Game

    Uh my bad, I wasn't aware of the term "topdown game". I thought it was a vertical platformer . I would emit an empty shell though the emitter and give it the players x & y velocity + some exrta y velocity to make the shell "drop". Set the shellEmitter.gravity = 0; to prevent the shell from falling out of the world. Maybe add a "bouncing/sping" animation and collide it with every wall/obstace you have on the map. I hope it helps but it's always easier if you post some code to work with or a screenshot of your map. I could provide a simple example when I'm home if you need one.
  13. Make Particles collide with floor in a Topdown-Game

    I don't understand what you intend to say here? Why don't you write: game.physics.collide(gunShellGroup, floorGroup);
  14. [Phaser] I'm making one new html5 game per week

    Really nice! Looking forward to your code being open sourced to learn from it
  15. Most practical way of viewing docs?

    Hey! unfortunately there is no native search. But you can use this workaround to search the documentation.