In my example we have several kinds of enemies, all in the enemy family.
Now every enemy has the private variables for OriginalHeight and OriginalWidth.
These variables are set to their respective height and width values of enemy objects and instances at the start of layout, once.
Now in theory I thought, it will set the variables individually for every object in the enemy family. However what I can see in Debug Mode is that only one kind of enemy in the enemy family gets the values set. The other kinds of enemies have the variable, but don't set any value, it stays zero.
My confusion comes from the fact, that despite this, one of the formulas I used, containing these variables values, still works for every enemy type.
I basically set the position of the player in a certain case to: "enemy.X - enemy.OriginalWidth/2 - player.Width/2" and the same for Y and Height.
Divided by 2 because their hotspots are in the middle. I want to position them exactly next to each other, and both sprites so to speak with their feet, the bottom of their sprite at the same Y position.
The enemies purposefully for testing this have different sizes.
So I don't understand why, although their variables basically have the value 0, the positioning of the player still works fine for the other enemies?
Thank You in advance. <img src="smileys/smiley1.gif" border="0" align="middle" />