Jump to content

Search the Community

Showing results for tags 'problema'.

  • 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 friends, I am new to the forum, I would like you to help me solve a slightly urgent problem, I am putting together a game with Phaser, I try to collide one image with another, until there is easy, the problem arises because one of the bodies has an animation with a tween, and when making a collision with another body, don't do it, keep going down, has someone happened to you ?, I show you the code var config = { type: Phaser.AUTO, width: 1200, height: 675, parent: 'Fondo', transparent: true, pixelArt: true, physics: { default: 'arcade', arcade: { gravity: { y: 1000 }, debug: false } }, scene: { preload: preload, create: create, update: update } }; var player; var cursors; var cofreup; var stars; var fondo; var platforms; var plataforma2; var colup; var suelo; var move = 0; var game = new Phaser.Game(config); function preload() { this.load.image('star', '../juego4/img/star.png'); this.load.image('fondo1', '../juego4/img/bg.png'); this.load.image('colision', '../juego4/img/plataformas/colision.png'); this.load.image('colision2', '../juego4/img/plataformas/colision.png'); this.load.image('plataforma1', '../juego4/img/plataformas/img-07.png'); this.load.image('plataforma2', '../juego4/img/plataformas/img-08.png'); this.load.image('cofre1', '../juego4//img/plataformas/img-15.png'); this.load.image('baul', '../juego4/img/plataformas/img-16.png'); this.load.image('ground', '../juego4/img/platform.png'); this.load.spritesheet('dude', '../juego4/img/dude.png', { frameWidth: 64, frameHeight: 98 }); } function create() { suelo = this.physics.add.staticGroup(); suelo.create(1, 690, 'ground').setScale(100, 1).refreshBody(); //colisiones// col = this.physics.add.staticGroup(); //*baul col.create(500, 570, 'colision').setScale(12, 2).refreshBody(); //*plataformas col.create(80, 170, 'colision').setScale(15, 2).refreshBody(); col.create(610, 370, 'colision').setScale(25, 2).refreshBody(); col.create(650, 150, 'colision').setScale(25, 2).refreshBody(); col.create(80, 476, 'colision').setScale(12, 2).refreshBody(); col.create(350, 280, 'colision').setScale(12, 2).refreshBody(); col.create(1100, 180, 'colision').setScale(12, 2).refreshBody(); col.create(980, 475, 'colision').setScale(12, 2).refreshBody(); //*cofres btn = this.physics.add.staticGroup(); btn.create(800, 570, 'colision').setScale(12, 2).refreshBody(); //*plataformas //Colisiones movieminto// //baul cofre = this.physics.add.staticGroup(); cofre.create(500, 610, 'baul'); //Plataformas grandes platforms = this.physics.add.staticGroup(); platforms.create(600, 400, 'plataforma1'); platforms.create(50, 200, 'plataforma1'); platforms.create(650, 180, 'plataforma1'); //Plataformas pequeñas platforms2 = this.physics.add.staticGroup(); platforms2.create(80, 500, 'plataforma2'); platforms2.create(350, 300, 'plataforma2'); platforms2.create(1100, 200, 'plataforma2'); platforms2.create(980, 500, 'plataforma2'); //Imagen cofres // cofreup = this.add.image(250, 500, 'cofre1'); this.tweens.add({ targets: cofreup, y: 100, paused: false, physics: true, collider: true, duration: 5000, ease: 'Sine.easeInOut', yoyo: true }); //Muñecos player = this.physics.add.sprite(100, 10, 'dude'); player.setBounce(0.1); player.setCollideWorldBounds(true); //Animacion personaje this.anims.create({ key: 'left', frames: this.anims.generateFrameNumbers('dude', { start: 0, end: 3 }), frameRate: 10, repeat: -1 }); this.anims.create({ key: 'turn', frames: [{ key: 'dude', frame: 4 }], frameRate: 12 }); this.anims.create({ key: 'right', frames: this.anims.generateFrameNumbers('dude', { start: 6, end: 8 }), frameRate: 10, repeat: -1 }); cursors = this.input.keyboard.createCursorKeys(); stars = this.physics.add.group({ key: 'star', repeat: 11, setXY: { x: 12, y: 0, stepX: 70 } }); stars.children.iterate(function (child) { child.setBounceY(Phaser.Math.FloatBetween(0.4, 0.8)); }); this.physics.add.collider(player, col); this.physics.add.collider(player, suelo); this.physics.add.collider(suelo, cofreup); this.physics.add.collider(stars, suelo); this.physics.add.collider(player, cofreup); this.physics.add.collider(stars, platforms); this.physics.add.overlap(player, stars, collectStar, null, this); this.physics.add.overlap(player, btn, call, null, this); } function update() { if (cursors.left.isDown) { player.setVelocityX(-160); player.anims.play('left', true); } else if (cursors.right.isDown) { player.setVelocityX(160); player.anims.play('right', true); } else { player.setVelocityX(0); player.anims.play('turn'); } if (cursors.up.isDown && player.body.touching.down) { player.setVelocityY(-500); player.anims.play('up', true); } //Animacion Cofre // cofreup.x = 220 + Math.cos(move) * 1; // cofreup.y = 460 + Math.sin(move) * 100; // move += 0.03; } function collectStar(player, star) { star.disableBody(true, true); } function call (player, btn) { Tween.stop(); }
×
×
  • Create New...