• Content count

  • Joined

  • Last visited

About Arcanorum

  • Rank
    Advanced Member
  • Birthday

Contact Methods

  • Website URL
  • Twitter

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

582 profile views
  1. Use Tweens. Here's how I would go about something like this. I assume you already have a path calculated to get to a desired point, for example [[0, 0], [0, 4], [2, 4], [5, 3]], where the first and second element of each array corresponds to a column and row in the grid used to generate the path. So [2, 4] would be column 2, row 4. // Create a tween to move this player smoothly to another position. // playerSprite should be the sprite object used for your player. // This first tween needs to exist to chain any other tweens on to, and to start the chain. // A tween should be added for each node in the path to follow. // When one tween ends, the next one in the chain starts, moving the player to the position of the next node. var firstTween = game.add.tween(playerSprite).to({ // path should be the array that has the path data. For example [[0, 0], [0, 4], [2, 4], [5, 3]]. // [0] gets the first element (for the first node in the path), and [0] or [1] gets the column or row to move to, respectively. // Multiply the column/row by how far apart each grid node is in your game. In this case 64 pixels. x: path[0][0] * 64, y: path[0][1] * 64} ); // Keep track of the previous tween so the next tween can be added to it. // Tween 2 is chained onto the end of tween 1, tween 3 onto tween 2, and so on. var previousTween = firstTween; // Create a tween for each node in the path. Start at i=1 as the first node is already done. for(var i=1, len=path.length; i<len; i+=1){ var nextTween = game.add.tween(playerSprite).to({ x: path[i][0] * 64, y: path[i][1] * 64 } ); // Chain the tween for this node onto the previous tween. previousTween.chain(nextTween); // Set the previous tween to this tween, ready for the next tween (if there is one). previousTween = nextTween; } // Start the first tween. When it is done, the second will start, then the first, and so on. firstTween.start();
  2. website

    Anyone? I know I'm not dreaming that there used to be a button there.
  3. If you want the overlap between the two bodies to be checked every game update then yes it should be in the update function. Otherwise you can call it just when you need it, like when some other event happens. If for example you have a player that can move into things, you could just do the overlap/collision checks when the move input is down.
  4. As far as I'm aware there isn't any noteworthy difference. It comes down to style.
  5. I ran into this issue too. What I realised was going on is that the virtual joystick/button sprites are added to the stage, so that it appears above everything else, but as a result it is not removed when the state is changed, or restarted. You need to use this.stick.destroy(); this.buttonA.destroy(); when leaving the state to remove it properly.
  6. In addition to what Milton mentioned, you would benefit from adding the conditional statement to the database script itself, as that will make sure the new, correct value is evaluated, and not the old, 'dirty' one that the gameplay server is evaluating instead. If you are doing the check on the gameplay server, then what it thinks is the value that is in the database is unreliable if you aren't relying on them being perfectly in synch.
  7. Looks like you need p2.Broadphase.aabbCheck(bodyA,bodyB);
  8. If I understand your problem right, it sounds like either your transactions are not atomic, or that you lack a conditional statement before doing the attack command. Before updating the field, check if the CanAttack (or whatever you have called it) property of that player's entity is true, if so, then accept the attack command and set CanAttack to false. When the cooldown/delay timer between attacks is over, set CanAttack back to true, ready for the next attack command. I think the CASE statement is what you need.
  9. The problem is that you are actually running the playerCollided function when you give it as a parameter to overlap. You don't need the () on the end to pass a reference to the function, just the function name. This is how it should look: game.physics.arcade.overlap( this.ship.getShip(), this.group_asteroids, playerCollided, null, this); Also, if getShip is intended to be a getter, then you should avoid that. Getters and setters are not commonly used in JavaScript. Just use the ship object directly.
  10. It sounds like you want to check which car is moving when a collision happens, as if only one car can be moving at once. You will just need to check the velocity of each car when the callback is called. If one of the cars has a velocity in either x or y that is not 0, then that car is the one that is moving, so remove that car, or the other car. Both objects are given to the callback as the first and second parameters. See the use of obj1 and obj2 in this example. Also, check out intersects and overlap if you don't need the cars to actually 'bump' into each other, but to just detect if they are touching. They are a bit faster than collide.
  11. Sprite body pairs are checked against each other. That is just how collision works. If I am colliding with you, then you must also be colliding with me. What exactly do you have in mind when you say you only want a one way check?
  12. Good question. I couldn't find an immediately obvious answer. What I tried looking for was some way to make a button 'capture' input events so that other input events aren't triggered, but there doesn't seem to be anything like that. Hopefully someone else reading this will know of an elegant solution. There is no way that you are the first person with this requirement.
  13. This is intended behaviour. A double tap natually must have a single tap first. See this example. To get the kind of double tap that you want, you will have to do it yourself by starting a timer on the first tap and checking if the next tap is within a time threshold for it to be considered a double tap, which is what I had to do before double tap was a feature at all. Also, the running of button callbacks and input events are independent. The this.input.onTap.add(onTap, this); will run your onTap callback any time there is a tap, on any part of the game, whether it is also over a button or not.
  14. Did you even bother to search for this question beforehand?
  15. Hold on, what dimensions are you using for the game? Judging by where you are placing sprites, your game is HUGE, which would certainly explain 2-3 FPS. Going beyond 800px x 600px is usually a stretch. Check out this for clues to what is going on.