peteblank

Members
  • Content Count

    11
  • Joined

  • Last visited

About peteblank

  • Rank
    Member

Recent Profile Visitors

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

  1. Okay now this is weird. I'm trying to make a clock in phaser and I set it so whenever it reaches 10 seconds it goes back to 0. Yet it gets stuck in 9. Here's the code: var timerevent=0; var timerseconds=0; function update() { if (timerseconds<9) { timerevent=Phaser.Math.CeilTo(this.time.now,[3]); timerseconds=timerevent/1000; } if (timerseconds>9) { timerseconds=0; timerevent=0; } console.log(timerseconds); } It also starts at 3 seconds for some reason.
  2. Sure in the create event I use this.anims.create({ key: "punch", frames: this.anims.generateFrameNumbers("punch", { start: 0, end: 7 }), frameRate: 15, repeat: -1, }); and in the update event I use else if (Phaser.Input.Keyboard.JustDown(shift)) { console.log("pressed down key"); player.setVelocityX(0); player.anims.play("punch"); punching = true; }
  3. Okay sorry for making another thread. I looked up the manual and examples this time around. For the keyboard event I have it set to JustDown instead of isDown. Which means the the key is registered as being pressed just once. The problem is that when the animation plays, it just plays one frame instead of the whole animation. Please help, I'm close to completing my game.😓
  4. never mind, I found about checkDown on the examples page Sorry about that
  5. Well never mind. I'll just copy and paste it every time I create the coin no biggie. I've come across another problem though. I want to use the checkDown(key,[,duration]) method I'm tying to make it so my character waits before it punches every time I press the shift key.
  6. I'd like to create a function and be able to call it in another function. this one specifically function coins(coin) { coin.setBounce(1); coin.body.setGravityY(300); this.physics.add.collider(coin, platforms); this.physics.add.collider(player, coin, collectCoin, null, this); coin.setVelocityX(60); coin.setVelocityY(-300); coin.setCollideWorldBounds(true); } That way every time the coin is created I can call the function for the coin's physics.
  7. Thank you but I had already solved it.
  8. hey sorry for the n00b question, but I'm stuck. function changeBlock (player, blocks) { if (player.y>blocks.y+40) { coin.create(block.x,block.y-40,'coin'); this.sound.play('brick'); blocks.destroy(); } } I got the player to be able to destroy the block when it jumps below it. But what I want is for the block to change sprite to the dud block and create a coin on top.
  9. Hello I'm just starting out phaser 3. I followed the tutorial but I can't get the sprite to load. I used the following. function preload () { this.load.image('dog', 'dog.png'); } function create () { this.add.image(200,200,'dog'); } The dog.png image is located on the same folder. What am I doing wrong?