I have a turret sprite, which I destroy at the beginning of the layout.
At runtime 4 copies of this is created as can be seen above. I gave them private variables.
Here is the problem:
It seems, the created turret sprites' .Angle properties cannot be accessed via their private variables ?
I want to narrow down the angle range of the turrets so they can only rotate away from the ship in a ~110? wide angle. The turrets must not turn toward the other turrets beside them, plus they must of course not turn inside, the deck the ship, so they cannot shoot their own destroyer's control towers into pieces.
I want to get each turrets current Angle, compare and don't allow it to increase or decrease too much.
Turret.Angle('ID')
Turret('ID').Angle
Turret.Value('ID') & Turret.Angle
give errors.
Here an "if" would be helpful, like:
If (turret('ID').Angle > 320)
Turret('ID').Angle--;
Is there any way to access & compare private variables of created objects? I want a lot of turrets created at begin of layout so making and adding 50 unique turrets sprites by hand is not very flexible.
I thought of maybe making a global variable, create a loop but i can't access the created objects properties AND private variable at the same time.
I can only set its position by directly accessing the private variable:
Turret: Set position to object MyDestroyer image point 'ID'
"Compare angle" does not give access to the created turrets private variable so I could identify, which turrets angle should be compared.
Compare private variable gives errors, when I try to give it
Turret.Angle('ID')
Turret('ID').Angle
<img src="smileys/smiley19.gif" border="0" align="middle" />