Jump to content

Need help adding Sprite to code


Recommended Posts

I am having trouble adding a sprite to this code instead of having an invisible shape that gives you points I would like to have a coin to collect which gives you points but I cant seem to get it to work


could someone tell me what the code should look like if i want to add a sprite to collect
            this.goalBody = new game.Body({
            position: {x: game.system.width + this.width / 2 + this.width + game.scene.player.body.shape.width, y: topHeight + this.height / 2},
            velocity: {x: this.speed},
            collisionGroup: 1,
            collideAgainst: 1
        this.goalBody.collide = function() {
            return false;
        var goalShape = new game.Sprite('media/powerup.png', this.width, this.height + game.scene.player.body.shape.height);
        this.sprite.anchor.x = this.sprite.anchor.y = 0.5;



Thanks for any help

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.

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.
  • Create New...