Jump to content

Search the Community

Showing results for tags 'two of four'.

  • 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 1 result

  1. Hello, I have a problem with collisions, because I added four times collisions, but by two of that it won't work (names "steen" and "steen1"). I don't know why it doesn't work, because I did the same things as the other two. The only difference is that by "steen" and "steen1" I won't refer to a function, which I do by the other two because of kill(). The function of the "steen" and "steen1" is that the car won't drive over the grass. I placed an opacity wall over the background, so that you can't drive from the road. Does anybody knows a solution/ Code: var road; var turtle; var steen; var steen1; var cursors; var controls = {}; var auto; var melon; var playState = { preload: function(){ game.load.image('turtle', 'assets/turtles.png'); game.load.image('road', 'assets/road.jpg'); game.load.image('steen', 'assets/steen.jpg'); game.load.image('steen1', 'assets/steen.jpg'); game.load.image('auto', 'assets/car.png'); game.load.image('melon', 'assets/watermelon.png'); }, create:function(){ game.physics.startSystem(Phaser.Physics.ARCADE); //Background road = game.add.tileSprite(0,0,1250,700,'road'); game.physics.arcade.enable(road); //MuurLinks steen = game.add.sprite(97,0,'steen'); game.physics.arcade.enable(steen); steen.body.immovable = true; steen.width = 92; steen.height = 700; steen.alpha = 1; //MuurRechts steen1 = game.add.sprite(1078,0,'steen1'); game.physics.arcade.enable(steen1); steen1.body.immovable = true; steen1.width = 92; steen1.height = 700; steen1.alpha = 1; //SchildpadKarakter turtle = game.add.sprite(546,250,'turtle'); game.physics.arcade.enable(turtle); turtle.width = 162; turtle.height = 226; turtle.body.immovable = true; //VerzamelobjectMeloen melon = game.add.sprite(830,100,'melon'); game.physics.arcade.enable(melon); melon.body.immovable = true; melon.anchor.setTo(0.5); melon.scale.setTo(0.3); //VijandAuto auto = game.add.sprite(440,0,'auto'); game.physics.arcade.enable(auto); auto.anchor.setTo(0.5); auto.scale.setTo(0.3); auto.body.immovable = true; //Besturing cursors = game.input.keyboard.createCursorKeys(); controls = { right: this.input.keyboard.addKey(Phaser.Keyboard.D), left: this.input.keyboard.addKey(Phaser.Keyboard.A), }; }, update:function(){ //Achtergrond verandering road.tilePosition.y += 3; //Besturing turtle turtle.body.collideWorldBounds = true; turtle.body.velocity.x = 0; if (controls.left.isDown){ turtle.body.velocity.x = -200; } if (controls.right.isDown){ turtle.body.velocity.x = 200; } //Collision auto auto.body.velocity.y = 200; game.physics.arcade.collide(turtle,auto,this.gameover,null,this); //Collision melon melon.body.velocity.y = 100; game.physics.arcade.collide(turtle,melon,this.collectMelon,null,this); //Collision steen game.physics.arcade.collide(turtle,steen); game.physics.arcade.collide(turtle,steen1); }, collectMelon:function(){ melon.kill(); }, gameover:function(){ game.state.start('over'); }, Finish:function(){ game.state.start('win'); } };
×
×
  • Create New...