lucasg07

Members
  • Content Count

    6
  • Joined

  • Last visited

About lucasg07

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi, I'm using the arcade physics engine. I'm trying to move a cloud left and right via tweens but the problem is the arcade box isn't moving with it. Does anyone know how to fix this? createTweens() { this.scene.tweens.add({ targets: this, x: this.distanceX, duration: this.speed, yoyo: true, loop: - 1 }); }
  2. Hi, I'm basically making a doodle jump based game, but since I'm really new to Phaser and barely find any examples on how to handle a custom camera, I'm asking for help on this forum. I want the camera to follow the player when it goes up, but stop following the player as it goes down. I've looked at a lot of Phaser 2 examples but these confuse me only more. This is my code for the camera, right now it basically follows the player up and down. (the clouds are removed below the camera view, so the player keeps falling when it misses a cloud) cameraMovement() { this.cameras.main.setBounds(0, - this.player.yChange, 500, 800); this.cameras.main.startFollow(this.player); }
  3. This was indeed correct, but this returned 0 all the time. I then used this.camera.main.scrollY, this did work.
  4. Hi, I'm really new to Phaser, I'm trying to get the y value of an element from a sprite in an array. But I'm getting the error cannot read property 'y' of undefined. What am I doing wrong? Thanks for the help. this.platforms.children.entries.forEach(elem => { //this.platform is a staticgroup with 10 sprites console.log(elem); //returns arcadesprite this.platformYMin = Math.min(this.platformYMin, elem.y); if (elem.y > this.camera.y + this.game.height) { elem.kill(); this.platforms.create( Phaser.Math.Between(50, 450), this.platformYMin - 100, 'tile' ); } });
  5. Edit: not sure why //comments are displayed wrong. It displays right while creating it.
  6. Hi, I'm really really really new to Phaser and for school we need to make a game in only 2 weeks. I'm making a game based on doodle jump. I searched a long time for some examples but I can only find Phaser 2 examples. This makes it really hard for me to actually understand Phaser 3. I'm learning it with very small steps but can't seem to understand why I'm getting this error: //preload class: I tried both spritesheet and image this.load.spritesheet(`tile`, `./assets/tile.png`,{ frameWidth: 32, frameHeight: 48 }); //this is a copied Phaser 2 example that I'm trying to convert platformsCreateOne(x, y, width) { //When a tile leaves the screen - returns a sprite with false property const platform = this.platforms.getFirstDead({ key: 'tile' }); //I added this myself because the sprite didn't have a body, not sure if this is correct platform.body = true; console.log(platform); //returns a sprite console.log(platform.body); //returns true //told me that platform.reset is not a function, agian not sure if this is correct, not even sure why i use .physics.body guess I just tried something I saw online, again i'm really new to phaser platform.physics.body.reset(x, y); //returns error "Cannot read property 'body' of undefined" //also tried this /*platform.physics.body.reset({ x: x, y: y });*/ platform.scale.x = width; platform.scale.y = 16; platform.body.immovable = true; return platform; }