java - I want to return true when my sprite is touched -


i want return true method touch, when sprite touched (also finger) how can make?

public class skipbutton extends rectanglebutton {         protected textureatlas atlastexture;      protected sprite sprite;       protected spritebatch batch ;       public skipbutton(vector2 coordinates, float width, float height)      {         super(coordinates, width, height);         atlastexture = assets.manager.get(constants.interface_atlas_path,                  textureatlas.class);         sprite = new sprite(atlastexture.findregion("skip_big"));      }      @override     public void draw(spritebatch batch)     {         sprite.draw(batch);     }      public boolean touch()     {        ...........     } 

libgdx has great button class has included boolean ispressed() want. can still make public method returns result of ispressed if want button private.

atlastexture = assets.manager.get(constants.interface_atlas_path,              textureatlas.class); drawable drawable = new textureregiondrawable(atlastexture.findregion("skip_big")); button = new button(drawable); stage.addactor(button);  public boolean touch() {     return button.ispressed(); } 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -