I just started to study Structures, I think that this can be solved using Structures, but I'm not sure.
Case: I have a VC with many achievements that a player can unlock. Each achievement has: 1. an image of the border around the achievements of the image and text 2. the image of the achievement (each achievement has a simple “lock” to indicate that the achievement is blocked) 3. the text of the achievement 4. a logical value to determine the status of the achievement (false = blocked, true = unlocked) During the game, some achievements can be achieved. Thus, the boolean value will be true. When a player returns to a VC achievement, the achievement image must be set to the correct image for that achievement.
Problem: I now have the code:
func SetImagesForPowerUps()
{
if UnlockedAchievement1 == true
{
Achievement1Text.textColor = UIColor.greenColor()
Achievement1Image.image = UIImage(named: "Achievement1Unlocked")
}
if UnlockedAchievement2 == true
{
Achievement2Text.textColor = UIColor.greenColor()
Achievement2Image.image = UIImage(named: "Achievement2Unlocked")
}
}
, , . , , , , , .
: , ?