So, I have a game where there are many different cards.
Each one uses the same class, and I want the attack value of one card to affect the health of the one it is touching,
how do I go about this?
public void changeHealth(int amount){
health += amount;
}Card intersectingCard = (Card)getOneIntersectingObject();
if(intersectingCard != null){
int changeHealthAmount;
//changeHealthAmount = whatever code figures out how to change the health
intersectingCard.changeHealth(changeHealthAmount);
} for(Actor cardActor:getIntersectingObjects(Card.class)){
Card card = (Card)cardActor;
int changeHealthAmount;
//code to set changeHealthAmount to what it should be
card.changeHealth(changeHealthAmount);
}