08-30-2015, 03:36 PM
Declaring the variables in a list like that only shows that the following variables are all of the same type.
Note that I moved "originX" and "originY" to the group of variables that you set yourself, and moved "cellX" and "cellY" to the group of variables that are determined within the loop which you do not set yourself. For the first group, I assume that you have all of these values and can set them. "originX" and "originY" represent the starting position to render the hearts at. "cellPixelWidth" and "cellPixelHeight" represent the size of each heart, though the values can include some padding (be larger than the sprite sizes).
Code:
//I assume that hp and maxhp are whole integer values and that each of these variables are defined
short hp, maxhp, maxHeartsPerRow;
short cellPixelWidth, cellPixelHeight;
short originX, originY;
short wholeHeartSpriteID, emptyHeartSpriteID;
//originX and originY are the top left position to begin rendering hearts from.
short i;
short posX, posY;
short cellX, cellY;