Jump to content

Trying to call a tween from a class not working - SOLVED


Ninjadoodle
 Share

Recommended Posts

Hi guys

I'm trying to setup a tween inside a classes mousedown function, but for some reason it's not doing anything. Any ideas on what I'm doing wrong?

Thank you in advance :)

LetterTile = game.Class.extend({

    init: function(x, y, frame) {
        this.sprite = new game.Animation([
            'letterTile0001.png',
            'letterTile0002.png',
            'letterTile0003.png',
            'letterTile0004.png',
            'letterTile0005.png',
            'letterTile0006.png',
            'letterTile0007.png',
            'letterTile0008.png',
            'letterTile0009.png',
            'letterTile0010.png',
            'letterTile0011.png',
            'letterTile0012.png',
            'letterTile0013.png',
            'letterTile0014.png',
            'letterTile0015.png'
        ]);

        this.sprite.mousedown = function() {

            if (game.scene.started) {

            	//this.scale.set(0.5);
            	//this.alpha = (0.5);

            	this.addTween(this.scale, {
                    x: 0.5,
                    y: 0.5
                }, 1000, {
                    easing: 'Quadratic.InOut',
                    repeat: Infinity,
                    yoyo: true
                }).start();
            }
        }

        this.sprite.interactive = true;
        this.sprite.position.set(x, y);
        this.sprite.anchor.set(30, 30);
        this.sprite.stop(frame)
        this.sprite.addTo(game.scene.mg);
    }
});

 

Link to comment
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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...