Skip to content

Button click area problems #65

@indra-uolles

Description

@indra-uolles

I'm making a splash screen. It has a background image and a button on it. Background image is jpg (1200x520) and button image is png (105x75). Code looks like this:

splash = g.group();

bg = g.sprite("background.jpg");
bg.x = 0;
bg.y = 0;
splash.addChild(bg);

var buttonFrames = g.frames(
    "assets/images/howtobtn2.png",
    [[0,0],[0,50],[0,75]],
    105, 25
  );

howtoBtn = g.button(buttonFrames);
howtoBtn.x = 100;
howtoBtn.y = 207;

splash.addChild(howtoBtn);

howtoBtn.release = function(){
  g.state = howto;
};

I don't understand why click area (where pointer appears) is above the button image, not right over it. If I don't assert howtoBtn coordinates then click area position is ok.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions