Jump to content

Search the Community

Showing results for tags 'life'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 3 results

  1. hi everyone there, does anybody have an a idea to create a life bar in phaser? i've thinking to use tweens and crop. but how i can restart it or reverse it when the player for example touches a heartlife? i know pretty well how to decrease its life but how can i add life to the bar? any advice would be awesome
  2. Hello guys, I just recently started to play with Phaser and so far I'm loving it.. However as I'm not used to it, I run into wall.. I'm creating a breakout game where I want different bricks to respond to ball hitting them differently.. Mostly I want to add bricks a health so to speak, so depending on the color of the brick, it will take 1,2,3.. etc ball hits to kill it.. I'm so far doing this in this fashion: // Red bricks bricks_1 = game.add.group(); bricks_1.enableBody = true; bricks_1.physicsBodyType = Phaser.Physics.ARCADE; // Yellow bricks bricks_2 = game.add.group(); bricks_2.enableBody = true; bricks_2.physicsBodyType = Phaser.Physics.ARCADE; // Gray bricks bricks_3 = game.add.group(); bricks_3.enableBody = true; bricks_3.physicsBodyType = Phaser.Physics.ARCADE; // Green bricks bricks_4 = game.add.group(); bricks_4.enableBody = true; bricks_4.physicsBodyType = Phaser.Physics.ARCADE;So, I'm creating a group for each of the type of the possible bricks.. Then as I randomly create a level, I do this: function randomLevel(){ var brick; for (var i = 0; i < 8; i++) { for (var j = 0; j < 6; j++) { var rand = game.rnd.integerInRange(1, 4); switch(rand) { case 1: brick = bricks_1.create(75 + (i*80), 55 + (j*40), 'brick_1'); brick.body.bounce.set(1); brick.body.immovable = true; break; case 2: brick = bricks_2.create(75 + (i*80), 55 + (j*40), 'brick_2'); brick.body.bounce.set(1); brick.body.immovable = true; break; case 3: brick = bricks_3.create(75 + (i*80), 55 + (j*40), 'brick_3'); brick.body.bounce.set(1); brick.body.immovable = true; break; case 4: brick = bricks_4.create(75 + (i*80), 55 + (j*40), 'brick_4'); brick.body.bounce.set(1); brick.body.immovable = true; break; } } }}And then I have 4 onHit functions (which I don't really like, would prefer a single one with some switch statement in there) where depending on what type of brick has been hit, it can play ie different sound for example.. game.physics.arcade.collide(ball, bricks_1, ballHitBrick_1, null, this); game.physics.arcade.collide(ball, bricks_2, ballHitBrick_2, null, this); game.physics.arcade.collide(ball, bricks_3, ballHitBrick_3, null, this); game.physics.arcade.collide(ball, bricks_4, ballHitBrick_4, null, this);This is example of one of the onHit functions (I basically used example of breakout a lot): function ballHitBrick_1(_ball, _brick) { _brick.kill(); hit_fx.play(); score += 10; scoreText.text = 'Score: ' + score; // Are they any bricks left? if (bricks_1.countLiving() == 0 && bricks_2.countLiving() == 0 && bricks_4.countLiving() == 0) { // New level starts scoreText.text = 'Score: ' + score; introText.text = '- Next Level -'; // Let's move the ball back to the paddle ballOnPaddle = true; ball.body.velocity.set(0); ball.x = paddle.x + 16; ball.y = paddle.y - 16; ball.animations.stop(); // And bring the bricks back from the dead randomLevel(); }}And this all works well, ie I can play different sounds based on what brick has been hit.. However what do I need to do to add health to these bricks? So for example, bricks_1 bricks die only after 1 shot, while bricks_3 don't die ever (think of like concrete/metal/blocking bricks).. Thanks a ton!
  3. Hello gentlemen, let's whisk dust off our tired inquiring minds by the end of the week, and reflect on implementation of the "life line" of our characters. We are talking about the possibility of killing the player / enemy no with just one feed, but with several accurate hits. I think it would be great possibility to realize more interesting scenario. How do you make such things, and if you have examples, show it please. I found something similiar, so I will attach it bellow
×
×
  • Create New...