tanskuu

Members
  • Content Count

    6
  • Joined

  • Last visited

  1. tanskuu

    How can i create a tween for a group?

    One more question how can i make a timeline tween for my enemies group?
  2. tanskuu

    How can i create a tween for a group?

    Thanks for the help!
  3. tanskuu

    How can i create a tween for a group?

    enemies2 = this.physics.add.group({ key: 'purple', repeat: 10, velocityY: CPUVelocity, bounceX: 1, collideWorldBounds: true, setXY: { x: enemyStartX / 2, y: 100, stepX: enemyStartX }, }); enemies2.setVelocityX(25, 10); I would like to make my enemies 2 group do yoyo movement instead of a just moving sideways and bouncing of each other. If that makes sense. I couldnt find a tutorial to how to make a tween for a this kinda group
  4. How can i create a tween for a group? enemies2 = this.physics.add.group({ key: 'purple', repeat: 10, velocityY: CPUVelocity, bounceX: 1, collideWorldBounds: true, setXY: { x: enemyStartX / 2, y: 100, stepX: enemyStartX }, });
  5. tanskuu

    My menu doesnt work

    Thanks for the tips. It seems to work now! 😁
  6. tanskuu

    My menu doesnt work

    var config = { type: Phaser.AUTO, width: 800, height: 600, physics: { default: 'arcade', arcade: { gravity: { y: 0 } } }, scene: { preload: preload, create: create, update: update, scene: [Scene1] }, }; var game = new Phaser.Game(config); var canFire = true; var weaponTimer; var fireRate; function preload() { this.load.image('player', 'assets/player.jpg'); this.load.image('green', 'assets/VihuColor.png'); this.load.image('purple', 'assets/purplegoo.jpg'); this.load.image('projectile', 'assets/projectile.png') } function create() { //luodaan pelaaja player = this.physics.add.image(400, 500, 'player'); player.setCollideWorldBounds(true); player.body.setGravityY(0); //painovoima pelimaailmaan //luodaan vihut enemies = this.physics.add.group({ key: 'green', repeat: 10, velocityY: 15, collideWorldBounds: true, setXY: { x: 50, y: 50, stepX: 100 }, }); enemies2 = this.physics.add.group({ key: 'purple', repeat: 20, velocityY: 15, collideWorldBounds: true, setXY: { x: 25, y: 100, stepX: 50 } }); //liikkuminen cursors = this.input.keyboard.createCursorKeys(); } function update() { var time = Date.now(); if (cursors.left.isDown) { player.setVelocityX(-300); } else if (cursors.right.isDown) { player.setVelocityX(300); } else if (canFire && cursors.up.isDown) { projectile = this.physics.add.group({ key: 'projectile', repeat: 0, velocityY: -100, setXY: { x: player.x, y: player.y - 20 } }); this.physics.add.collider(projectile, enemies); this.physics.add.collider(projectile, enemies2); canFire = false; weaponTimer = this.time.delayedCall(500, enableFire, [], this); } else { player.setVelocityX(0); } } function enableFire() { canFire = true; } -------- class Scene1 extends Phaser.Scene { constructor() { super({key:"Scene1"}); } preload() { this.load.image('menu', 'assets/menu.png'); } create() { this.image = this.add.image(400, 300, 'menu'); this.input.once('pointerdown', function () { this.scene.start('game'); }, this); } } Hi pretty new to phaser and also to javascript. Cant seem to get my menu scene to work. It only shows the game not the menu before it.