Jump to content

Search the Community

Showing results for tags 'velocity'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





  1. Hi, How can i play right with the acceleration of the velocity? In this tutorial http://www.photonstorm.com/phaser/tutorial-making-your-first-phaser-game (really well done), but it only change the velocity. How can i accelerate it the way a race game works? I want to accelerate it from 0 to a maximum number, or it's current value to a maximum number. How can i do this? What's the best way to handle it and create a maximum speed? Thank you very much guys
  2. Hello there! I'm working with this example (asteroids movement): LINK There is a strange behaviour that blows my brain out. It can be better seen on the attached video. All I've done was a small rotation and then just pressed UP cursor key. As you can see with the help of turned on debugger velocity vector rotates during fly until it reaches bottom-right corner of the bounding box. Also it force ship to fly wrong, it can be noticed even without debugger. Expected that velocity vector to be applied directly to where ship's nose is (or more correctly, ship have to move to the oppos
  3. Hello, I have an issue which keeps me stuck and I could not yet figure it out after being stuck for quite some time. I have a simple game in which obstacles ( spirtes of other cars) drop down from the top of the screen and I am trying to avoid those with my own car not to crash into them. The issue is that on some mobile devices the cars drop WAY faster than on my own device, I tested this from several different phones, the velocity differs depending on the phone, on some the obstacles drop faster on some they drop really slow. What oculd cause such an issue? I can prov
  4. Hey, So I am working on a car game and I have 1 issue with the speed at which car drops. My friend who owns a IPhone s6 complains that on his device the cars drop too fast, while on my Samsung s7 edge the car seems to drop slow enough. I dont know what might cause it. My obstacle velocity is set to 1200; // OBSTACLES vars var obstacleSpeed = 1200; var obstacleDelay = 400; var platforms; var score; And this is my Loop + update function // OBSTACLES OF THE CAR game.time.events.loop(obstacleDelay, function(){ var obstacleSpeed = 1200; var
  5. Hello, I am making a kind of flappy bird. I want the pipes to move only horizontally. They have physics, so i can use the setVelocityX method. But they are falling down because of the gravity. I can change the position changing the x value of the pipe in the update method, but i would like to use the setVelocityX, it is more clear. var columna = this.physics.add.group(); ... columna.setVelocityX(-200); Thanks!
  6. How can I set the direction at which an object should be moving at in MatterJS physics? In Arcade physics I'd do `this.scene.physics.velocityFromRotation(angle, this.speed, this.velocity);`, but MatterJS doesn't seem to have a `velocityFromRotation` method.
  7. I'm trying to make my mesh smaller during its linear velocity movement. But unfortunately, as soon as I set the scaling, it stops the movement. How can I scale down my mesh in size without interrupting the movement? Is there an elegant way without having to calculate positions myself? See my example, where the movement stops after 1sec when trying to scale: http://www.babylonjs-playground.com/#5WEAFN
  8. I just upgraded to Phaser 2.9.3, since then I get a strange behavior. 1. I press Left / Right to change the Sprite's velocity (x). // See update method 2. Sprite has enabled Physics, World.gravity is 2000 // See in create method 3. But the Sprite instead of moving left (negative velocity.x) moves upwards // See attached gif What I figured out till yet: - velocity.y turn to NaN by colliding with a collisionGroup . - velocity.y stays NaN, even if the character moves into the air. (whyever it moves into air..) There is nothing else going on. I tested this as a test-case, not
  9. Hello, I have a sprite which has velocity.x=100 moving from {x:0; y: 200}. I need to set velocity.x=0 (e.g. stop sprite) once sprite reaches the coordinates {x:300; y:200}. How can it be done? I can't call collide function since there is nothing on that coordinates. I guess I need use the signal? Or any other solution? Thank you in advance. Any help will be appreciated.
  10. Hey everyone, I am really new to Phaser so If i ask something really stupid, I am sorry in advance, lol. I created an item named Redea that will boost the player speed for 15 seconds and change his sprites for 15 seconds, after that everything goes back to normal (this item will be activated when the player collides) I created the collision and everything but the speed is not changing and I can't seem to change the sprite, can anyone help me here?? That's what I got P.S The variable playerVelocity is because I was told that it can mess up
  11. Please forgive the 'newbie' question... But... Can I always calculate a normalized value between -1 and 1 from the the current mesh moving velocity ??? The reason I ask.. I am creating blend tree support for animations (GOING GREAT SO FAR)... but the premise of all th docs for update the PosX and PosY comes from pumping the "User Input" horizontal and vertical input which will be -1 to 1... Which is Kool for when you are directly controlling the character, but lets say I am moving a character around thru AI and not using user input... I would like to just take the velocity at wh
  12. I see the docs of the Body class http://phaser.io/docs/2.6.2/Phaser.Physics.Arcade.Body.html But i am not sure which would be the right property to change. I have two balloons falling down and they might both at the same time or one after the other, hit my rectangle. The problem is, both objects stop moving after they hit the rectangle. i am sure this has to do something with physics. As if the vertical(y coordinate) velocity gets set to 0 when they hit the rectangle. Here is a sample code: graphics = si.gameObject.add.sprite(boxX, boxY, si.ImageAssetKeys.BALLOON_ANIM_ATLAS, 0);
  13. I'm new to Phasor and using it to make a little game for my son with a firetruck driving around and spraying water to put out fires. When the space bar is pressed, the game creates individual water drop sprites coming from the truck with gravity turned on. I give the water drop velocity a slightly random component to make it spread out and not all follow a single parabola. There is a timed event to destroy each water drop. Here is a code snippet creating a water drop that is shooting to the right. drop = waterdrops.create(truck.body.position.x + TRUCK_SIZE1_X/2,
  14. I made a pretty good Frogger clone using PhaserJS, but when refactoring the code, I ran into a very, very strange problem. My vehicles currently have a velocity of 200. When Frogger collides with one of them, that vehicle's velocity drops in half. Frogger also gains the velocity of that object. In update this.game.physics.arcade.collide(frogger, vehicles, this.loseLife); Here's my vehicles code objects.forEach(o => this.game.physics.arcade.enable(o)); [normalCar1, normalCar2, normalCar3, specialVehicle1, specialVehicle2, specialVehicle3, emergencyVehicle1, emergen
  15. crffty

    velocity to 0

    hello. I'm trying to stop my endless runner upon collision between the player and an 'obstacle' to do this i would like to stop the sprits form moving. velocity = 0. I can't work out how to do this though. thoughts? help? advice? beer? vaultage.game = function() {}; vaultage.game.prototype = { create : function() { // physics engine this.game.physics.startSystem(Phaser.Physics.ARCADE); this.game.physics.arcade.gravity.y = 1000; // background this.background = this.game.add.tileSprite(0, 0, this.game.width, 360, 'background'); this.background.autoScroll(-1
  16. Greetings, I was looking the forum for an answer, but wasn't able to find even the issue. Maybe it's just my wrong usage of Phaser mechanics. Anyway, I'll be gratefull for any information. The matter: I got two separate files ("game.js" and "player.js"). While game.js used as a "state", player.js is just an attached library with some functions. There is hotkey binding in player.js, which is called in game.js within "update" property. You know, to make an object move around. But when the hotkey is pressed, there are from 60 to 150 identical assignments happens. It is about
  17. Hi friends, I'm very new to Phaser (but I have a long programming background) and right now I'm trying to work on a new game concept of mine. Basically, it is a regular Pong but with few twists. I have attached an image below of the main game for further clarifications. gifs upload 1) As you can see, the shape of the paddles is a polygon. As such, I have to use P2 physics for them as the simple arcade won't suffice because of their peculiar shape. 2) Now since the paddles are using P2, I'm forced to use P2 for the ball as well because they both need to collide and I can't c
  18. for(i=0;i<arr.length;i++) { a=index of i in arr; if(a=="moveRight") { image.body.velocity.x=150; } if(a=="moveDown") { image.body.velocity.y=150; } } when arr[0]=='moveRight' and arr[1]=='moveLeft' it looks like the image moves diagonally but I want only one to work at once. What should I do here now?
  19. So I have a game, where movement and collision are big aspects. Currently I have a system where when a client say presses "W", body.velocity of their sprite is set to +150 in the x plane. Previously, my system for the multiplayer side of the game in terms of movement was when the player moves on the client side, send his new x & y position to the server. This was a great system, until I started turning the server into an authoritative one to prevent against hackers who could speed hack and set their own positions. My new system is whenever a player hits "W" send to the server that thi
  20. I am working on a boss movement method. The idea is that every 8 seconds the method will be called from the create method, this may be part of the problem... The idea is that every 8 seconds the method will be called. The boss will appear from one side of the screen and exit to the other. The bosses y coord will be based on where players y coord. The issue I am running into is that when the level starts the boss starts moving before 8 seconds goes across the screen to exit and is never seen again. I am not moving the player during the test so the bird isn't going beyond the y screen parameter
  21. I am building a basketball game. I cannot get the ball to stop sticking to the rim colliders. When I was running p2 physics, the ball would simply bounce off the rim colliders as expected, but now, everytime the ball touches the rim colliders, it slows down movement rapidly and doesn't bounce or fall as expected. I think I might be missing a property setting somewhere. I set the rim colliders (leftMarker + rightMarker) to be immovable in create() but I'm not sure what else I need. I don't understand why the colliders stick to each other! Any help is appreciated! Basketball.Game = func
  22. Hi Guys, I've come across a problem with p2 body. I have 2 sprite, sprite1 is physics enabled, and sprite2 is create a Phaser.Physics.P2.Body They will be moving using velocity after 2 seconds, but sprite2 not working... I made a JsFiddle to explain my question. https://jsfiddle.net/pbq93enn/ Does anyone have an idea what I'm doing wrong? Thanks in advance!
  23. Hello! I just want to make sure there is nothing I am missing before reporting this as a bug. I've created a small test case where a ball go through a wall although it shouldn't because there is the `collide` between the two body materials. I've tried playing with the contactMaterial options without any success. Everything is fine but as a certain velocity where it go through. For instance, if you change the x velocity value to 650, the ball will not go through. Here is the JSFiddle example: https://jsfiddle.net/ygk5dcw4/ I've put a debugger on the "console.log('it overlaps
  24. I have a p2 Object with the following properties this.game.physics.p2.enable(this.player, true); this.player.body.clearShapes(); this.player.body.loadPolygon('playerPolygon','player'); this.player.body.allowRotation = false; this.player.body.fixedRotation = true; this.player.body.immovable = true; this.player.body.setCollisionGroup(playerCollision); this.player.body.collides(ballCollision); this.player.body.kinematic = true; this.player.body.data.shapes[0].sensor = false; this.player.body.collideWorldBounds = true; The above object can only move along its X ax
  25. Please excuse what I'm sure is a very novice question, but I've been all over Google and I can't find what I'm looking for. I'm attempting to detect when a sprite is no longer being moved by the player - e.g. when the player releases the key. I'd like to do this by seeing how the sprite is moving, rather than relying on detecting the keypress or other input, as the sprite has some drag associated with it and I'd like to play a 'slowdown' animation as the drag slows the sprite. I'm also attempting to keep as much encapsulated in my prefab as possible and thus I don't want to put anything
  • Create New...