Question about change texture in tween onReapeat

Recommended Posts

I modified the tween loop examples in v3.

I'd like to change the texture when every tween loop finished.

But the texture flickers after setTexture(). Am I doing anything wrong?


var config = {
    type: Phaser.WEBGL,
    width: 800,
    height: 600,
    backgroundColor: '#2d2d2d',
    parent: 'phaser-example',
    scene: {
        preload: preload,
        create: create

var game = new Phaser.Game(config);

function preload ()
    this.load.image('block', 'assets/sprites/block.png');
    this.load.image('arrow', 'assets/sprites/arrow.png');

var name = ['block', 'arrow'];
var i=0;

function create ()
    var marker = this.add.image(100, 300, 'block').setAlpha(0.3);
    var image = this.add.image(100, 300, 'block');

        targets: image,
        x: 300,
        duration: 1000,
        repeat: -1,
        onRepeat: function(tween, target){


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.