Skip to content Skip to sidebar Skip to footer

Health For Each Enemy

as my game progresses the enemies get stronger. To make the enemies stronger I made a private int called thealth (probably a bad programming choice) and each time the sprite is tou

Solution 1:

Suggestions to fix your code:

  1. Make sure the enemy sprite is a class and thealth is contained in it(a little obvious but just in case)

  2. Make sure the thealth variable doesn't have the static keyword (if it does then that variable will be shared in all instances of the class).

eg.

classEnemyextendsSprite{
    int thealth=4; //Or whatever you want really
}

Post a Comment for "Health For Each Enemy"