ruslanfan

Members
  • Content Count

    6
  • Joined

  • Last visited

  1. ruslanfan

    WIP DuckDuck

    Another successful day Animations of dots when player is halfaway from center, was running every time when i press button aand its lack of performance. Everything was soo slow. Triger for animation in "if statement" but must be running only once time. I found this clever solution 🔮 Yep, whole day
  2. ruslanfan

    WIP DuckDuck

    Hello everyone! I am working on a game for two players. Mechanic is simple, players starting from center and move to opposite direction by hitting left or right arrow button. The winner is who first will reached edge of screen. Here is working demo Yeah, visually game is far away from nice and cool, but i think i am in right direction. I will try to not forget to write posts in this topic. 💜 Today i kinda proud of myself for this "for loop" because it's short and smart ha-ha for(i=0;i<move.length;i++){ for(k=0;k<move.children[i].length;k++){ game.add.tween(move.children[i].children[k]).to({ x:width/2, y:height/2, width:0, height:0 }, game.rnd.integerInRange(1000,5000), ease, true); } } Just look at this before and after:
  3. ruslanfan

    image top of rectangle

    @dude78 in my scene two rectangles at center with width = 0, and when i press arrow right or left width of particular rectangle visually increase, so the left rectangle is minus value because it's moving to left side of screen. Here it is https://codepen.io/ruslanlearncode/full/yRbKPd/ Oh yes, my mistake, i see it now, "Should always be either zero or a positive value".
  4. ruslanfan

    image top of rectangle

    for example i can use png instead "new Phaser.Rectangle" and it looks ok, but it needs images - not ok
  5. ruslanfan

    image top of rectangle

    Hello! Dont know how to move image top of rectangle. Anyone know how to fix this? Thanks! var width = window.innerWidth; var height= window.innerHeight; var glass; var Left; var game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.WebGL, 'phaser-example', { preload:preload, create: create, render: render, update: update }); function preload(){ game.load.image('glass','glass.png'); } function create(){ game.stage.backgroundColor = '#ffffff'; Left = new Phaser.Rectangle(width/2, 0, -100, height); glass = game.add.sprite(100,100,'glass'); leftKey = game.input.keyboard.addKey(Phaser.Keyboard.LEFT); leftKey.onDown.add(leftW, this); } function leftW(){ Left.width-=50; } function update(){ Left.width +=1; if(Left.width>-1){ Left.width=0; } } function render () { game.debug.geom(Left, '#fbc162'); }
  6. ruslanfan

    delete-solved

    Hi everyone! in my project i want show some text for a short time and than remove it, but its not working maybe there is some other way to create text for short time? or maybe i put in wrong place if-statement? update: function() { this.rock.tilePosition.x -=0.5; this.cloud.tilePosition.x -=2; game.physics.arcade.overlap(this.bird, this.gems, this.hit, null, this); if (this.bird.y<10){ var t = game.add.text(200,200,'text'); } if(this.bird.y > 20){ t.destroy(); } },