Quantcast
Channel: Question and Answer » libgdx
Viewing all articles
Browse latest Browse all 434

how to remove game objects after on overlap in LIBGDX game

$
0
0

I have gold stars in my game that give score to game hero if the hero overlap with the star. What I want is to remove star once it overlap with hero object.
I give score by checking overlap with this code

public void scorecount(Hero myhero){

            if (!star.isScored() && Intersector.overlaps(myhero.getBoundingBalloon(), star.getStarCircle())) 
    {

                addScore(1); // give one plus always
  star.setScored(true);


AssetLoader.coin.play();

}

Now once I give score and setScore true , i want to remove star.
How can I do that?
I tried for setvisible method but I dont know how to use it. Because just Calling star.setVisible() ask to create this method in star class. then in star class I dont know what should be given inside this method body.


Viewing all articles
Browse latest Browse all 434

Trending Articles