Jump to content

sprite with graphic child and mouseevents


nuvorm
 Share

Recommended Posts

I am currently trying to get mouseevents working on a sprite with a graphic as a child. Is this even possible? It does not seem to work.

 

basically doing this

 

    var sprite=new Phaser.Sprite(this.game,0,0);
    sprite.inputEnabled = true;
    sprite.input.useHandCursor = true
    var ptn=new Phaser.Graphics(this.game, 0,0);
    
    this.addChild(sprite);
    sprite.addChild(ptn);
    sprite.x=320
    sprite.y=240
    ptn.lineStyle(4, 0x0000FF, 1);
    ptn.moveTo(0,0); 
    ptn.lineTo(800,-800);
 
    sprite.events.onInputDown.add(this._onMouseDown, this);
 
 
the sprite is only clickable for a square of 100px x 100px
 
any thoughts?
 
Wouter
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...