Jump to content

bitmaps over a sprite


Recommended Posts

When you say 'bitmap' do you mean a Phaser BitmapData object?  If yes, then you need to make a sprite or image using this, then you can add that image/spriteas a child to sprite1 just like as you have tried.

If sprite1 is moving around then the child will move with it because it is positioned relative to its parent (sprite1).

Link to comment
Share on other sites

ok i followed your advice but now im facing problems with the position:


    bmd = game.add.bitmapData(200,500);
    bmd.y = 100;
    bmd.x = 100;
    nuevodiskette = game.add.sprite(0,0,bmd);
    nuevodiskette.anchor.setTo(0.5, 0.5);



if i want to check if the mouse pointer is inside the bitmap what should i use?


i tried 

  if (game.input.activePointer.isDown ){
           var x = Math.floor(this.game.input.x  - bmd.x  );
           var y = Math.floor(this.game.input.y  - bmd.y );


but it seems to be an offset, when i click for example (100,100) when bitmaps is at 100,100 too, the hole seems to be upper, not exactly at mouse x and y


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