Search the Community

Showing results for tags 'if'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

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

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 9 results

  1. babbleon

    if metadata

    Hello, If i want to check if a mesh has some metadata, I have to check first if it has metadata, then thing specific metadata... eg: if (evt.pickInfo.pickedMesh.metadata) { if (evt.pickInfo.pickedMesh.metadata.pointType === 'source') { console.log('mesh as metadata: source'); } } Can this be condensed into just one if line? Thank you,
  2. sbacuse15

    Sprite Animations

    I'm trying to add some new animations by adding a new "if" section in my "update:function" code. All of my "walking" and "sprinting" animations following the first "if" section play as they should. However, when I attempt to animate my crutch attacks under the second "if" section, only the first frame of those animations is played. I'm using the same attack button because it's the same attack being animated in all directions. I combo'd with my arrow keys so that I could use the same attack key. When I change them to all to "else if" statements under my first "if" section they don't play because it is my understanding that once a key is used in an "if" statement all other attempts to use that key under that section will be ignored. My code is listed below. Solution? if(cursors.left.isDown) { player.body.velocity.x = -200; player.scale.setTo(.7, .7); player.play('walking'); } else if(cursors.right.isDown) { player.body.velocity.x = 200; player.scale.setTo(-.7, .7); player.play('walking'); } else if(cursors.down.isDown) { player.body.velocity.y = 200; player.scale.setTo(.7, .7); player.play('forward'); } else if(cursors.up.isDown) { player.body.velocity.y = -200; player.scale.setTo(.7, .7); player.play('backward'); } else if(sprintl.isDown) { player.body.velocity.x = -400; player.scale.setTo(.7, .7); player.play('sprinting'); } else if(sprintr.isDown) { player.body.velocity.x = 400; player.scale.setTo(-.7, .7); player.play('sprinting'); } else if(sprintu.isDown) { player.body.velocity.y = -400; player.scale.setTo(.7, .7); player.play('backsprint'); } else if(sprintd.isDown) { player.body.velocity.y = 400; player.scale.setTo(.7, .7); player.play('forwardsprint'); } else{ player.animations.stop(); player.frame = 29 player.body.velocity.y = 0; } if(cursors.left.isDown && fireButton.isDown) { player.body.velocity.x = -50; player.play('sidecrutch'); } else if(cursors.right.isDown && fireButton.isDown) { player.body.velocity.x = 50; player.play('sidecrutch'); } else if(cursors.down.isDown && fireButton.isDown) { player.body.velocity.y = 50; player.play('frontcrutch'); } else if(cursors.up.isDown && fireButton.isDown) { player.body.velocity.y = -50; player.play('backcrutch'); }
  3. Hi, I'm programming a simple platformer game, and I'm programming and setting the movement of the player. Here's my update function: update: function () { game.physics.arcade.collide(this.player, this.platform); game.camera.follow(this.player); if(this.cursor.right.isDown){ this.player.body.velocity.x= 200; this.player.animations.play('correr', 5, true); this.player.scale.x=1; } else if(this.cursor.left.isDown){ this.player.body.velocity.x= -200; this.player.animations.play('correr', 5, true); this.player.scale.x=-1; } else if(this.jump.isDown && this.player.body.wasTouching.down) { this.player.body.velocity.y= -400 } else if((this.cursor.right.isDown || this.cursor.left.isDown) && this.jump.isDown){ this.player.body.velocity.x= 200; this.player.body.velocity.y=-200; } else{ this.player.body.velocity.x = 0; this.player.animations.stop(); this.player.frame = 4; } } Everything works fine, but in my last else if is suppose that the player should jump and walk, but it doesn't work! My intention is the player could jump while walking pressing the jump key + left or right key, for now I just can jump first and then walk. I don't know why this las if else it isn't being executed, because I tried to move it in the first if clause and it worked perfectly, but I can't realise about the error. Thanks for helping.
  4. Hello all, Last december I released my first IF game, called Beached! (part 1). It did well on the IF forums and received a lot of feedback. Beached! is the first in a series of games and it was a tryout to see if I could actually program an IF game from scratch. Since my native language is Dutch and my English is not sufficient enough to write a proper IF game for all to enjoy, I need help! Beached! (part 2) is in development. The scenario has been written but I need someone to check the story line for grammar and spelling errors and turn it into proper spoken language. Even though it's IF, the amount of text is not overwhelming and anyone is welcome to help me on this. I'm not looking for a co-writer, but sharing new ideas on the scenario or puzzles is always appreciated. If you're interested, play beached! (part 1) as a reference to the amount of text and the grammar problems. Please help make Beached! (Part 2) a full-grown game! Regards, Ewald Screenshot Beached! (Part 1)...
  5. Hi everybody, my question ist propably easy-pupeasy for all of you, but I'm a writer, not a coder and so for me it's like rocket science. Anyway: I'm making a branch-narrative game at the moment and I want to put in a simple textfield where players have to insert a codeword (e.g. Hamster). If they put it in correctly then I want a sentence to appear afterwards. (e.g. Hamster indeed! Good job) If got this far (pretty awesome - I know): <form> Codeword:<br> <input type="text" name="Codeword"><br> </form> Thank you very much for your help G
  6. Hey, First of all I would like to thank you all for the great support in learning about this great framework I have another question: Is it possible to check for an overlap in an if statement? Currently I have this in my update function: game.physics.arcade.overlap(player, enemyGroup, this.collisionHandler, null, this);and this in my collisionHandler: if(game.physics.arcade.overlap(player, enemyGroup.children[0])) { this.vow1();}But as expected, it's not working... Is it even possible? And if yes, how? Thanks in advance!
  7. Hey, First of all I would like to thank you for the great support, learning a lot here from a great framework I have another question: Is it possible to check for an overlap between two sprites (in this case a sprite and a child from a group) in an if statement? This is in my update function: game.physics.arcade.overlap(player, enemyGroup, this.collisionHandler, null, this);And this in my collisionHandler: if(game.physics.arcade.overlap(player, enemyGroup.children[0])) {this.vow1();}
  8. instantia

    Check for change sprite Phaser

    As in Phaser to check whether the changed state of the sprite (body)? Is there any standard is a function? Or most velocity / speed / forse / rotation check?
  9. http://www.projectaon.org/staff/christian/gamebook.js/