Jump to content

Search the Community

Showing results for tags 'group collide'.

  • 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. Hi all, I started to learn group in Phaser. And here is my code: function onCreate() { var arr = []; game.stage.backgroundColor = 0xffffff; boxes = game.add.group(); blue = boxes.create(0, 0, "blue"); yellow = boxes.create(blue.width, 0, "yellow"); red = boxes.create(0, blue.height, "red"); green = boxes.create(blue.width, blue.height, "green"); arr.push(blue); arr.push(yellow); arr.push(red); arr.push(green); for (var i = 0; i < arr.length; i++) { game.physics.arcade.enable(arr[i]); arr[i].body.immovable = true; } boxes.enableBody = true; boxes.physicsBodyType = Phaser.Physics.Arcade; boxes.x = game.width / 2; boxes.y = game.height / 2 + 100; boxes.pivot.x = blue.width; boxes.pivot.y = blue.height; boxes.scale.setTo(3); circle = game.add.graphics(0, 0); circle.beginFill(0xffffff); circle.drawCircle(boxes.x, boxes.y, 60); mask = game.add.graphics(0, 0); mask.beginFill(0xffffff); mask.drawCircle(boxes.x, boxes.y, 100); boxes.mask = mask; drop = createDrop(game.width / 2 - 8, -30); cursor = game.input.keyboard.createCursorKeys();}function onUpdate() { timer++; if (timer == 150) { //createDrop .... } // check game input to rotate boxes group .... game.physics.arcade.overlap(drop, boxes, onCollide, null, this);}function onCollide() { // nerver hit console.log("collide");}function createDrop(x, y) { // create random drop color .... if (drop != null) { var number = 100 * (rand * 0.5 + Math.random()); drop.anchor.setTo(0.5, 0.5); drop.scale.setTo(0.5, 0.5); game.physics.arcade.enable(drop); drop.body.gravity.y = number < 100 ? 100 : number; console.log(drop.body.gravity.y); } return drop;The problem here is the function onCollide() is not hit. Can you give me a hint to solve this? Thank you
×
×
  • Create New...