Sign in to follow this  
Ninjadoodle

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

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);
    }
});

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.