Sign in to follow this  
Manikant tiwari

attaching a text with sprite image and making the text able to tween with sprite image

Recommended Posts

I am very new to phaser. I am creating a game with phaser 2.x. I want to apply tween on text along with the sprite which is parent of the text, because I have made text as a child of the sprite image.

I have tried with the following code.

var GameState = {
        this.load.image('blackboard', 'assets/images/ticket2.jpg')
        this.load.image('arrow', 'assets/images/arrow.png')
        this.blackboard = this.add.sprite(, 525, 'blackboard');

        this.arrow = this.add.sprite(40, 370, 'arrow')
        this.arrow.inputEnabled = true;, this)
  showBlackboard: function () {
        var whiteStyle1 = { font: "25px Arial", fill: "#ffffff" } = this.add.text(120,280,"1",whiteStyle1);
        var tween = this.add.tween(this.blackboard);{ y: 350 }, 500)

Only the blackboard is being tweened. Even the text is not being printed on the screen. Can anybody give me a solution please

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.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.