# datahandler

Members

5

• Rank
Newbie
1. ## bouncing ball maximum height

In case this is of use to anyone, here's how I solved the issue this.hitGround = function() { this.body.velocity.y = -(Math.sqrt(2*this.body.gravity.y*(game.world.height/this.template.preferredHeightRatio))); }
2. ## bouncing ball maximum height

Thank you Shb and samid737 for replying. Sorry if I did not explain myself very well. Basically, I created a javascript game (one level only) that I want to convert and continue to develop using Phaser (Arcade physics). The game is here Each ball spawned initially moves upwards before arcing and falling again. After the first bounce, the ball will continue to bounce at a fixed height determined by its type (large, medium etc). Note. the height after the first bounce may be lower than the balls initial height depending on where it was spawned. Getting a ball to bounce in Phaser is straightforward but I cannot work out how to keep bounce height fixed after the initial bounce. WIth my current attempt, the height the ball bounces is determined by the height from which it was spawned. I hope this makes more sense.
3. ## bouncing ball maximum height

Let's say I have 3 balls in a game: large, medium, small. I want each of these balls to bounce to a maximum height (defined by me) but without bouncing at the top. Simply to arc naturally to the maximum height, then start falling again. Is there a straightforward way to accomplish this?
4. ## Shoot a rope

Hi Tilde thank you for your reply. I have used tilesprite and addChild to create a 'rope' with a spearhead that fires from the player's position to the top of the screen when the spacebar is pressed. However, in order to achieve this, I have to set the tilesprite height to a negative value to get it to draw vertically up the screen (as below) This means that I can't take advantage of outOfBoundsKill or game.physics.arcade.overlap, as the framework does not register the weapon as being in the world! I'm clearly doing something wrong, but I'm not sure how to correct it? function updateWeapon() { if (weapon.alive && weapon.height - weapon.children[0].height - 100 > game.world.height*-1) { weapon.height -= 8; weapon.children[0].y -= 8; } else weapon.kill(); }
5. ## Shoot a rope

Hi, I started recreating an arcade game called Pang and have a javascript version (1st level) here I'd like to use Phaser to continue the development but am stuck on how to animate the weapon (a metal rope with a spearhead). I'd tried using the Phaser.Rope class but am struggling to understand how to do the following: Add a spearhead to the end of the rope Animate the rope from the player's position to the top of the screen Start the animation when the user presses fire (spacebar) if anyone could give me any pointers, I'd be eternally grateful!