I have a health bar I created in SpriteKit.
I have a function that creates the health bar and attaches it to an SKSpriteNode(dragonNode)
The health bar I current have implemented is simply a SKSpriteNode with a rectangular shape.
Here is the code
func dragonHealth(dragonNode: SKSpriteNode) -> SKSpriteNode{
healthbar = SKSpriteNode(color: UIColor.greenColor(), size: CGSizeMake(self.frame.size.width * 0.5, self.frame.size.height * 0.015))
healthbar.anchorPoint = CGPointMake(0, 0.5)
healthbar.position = CGPointMake(self.frame.size.width * -0.23, self.frame.size.height * 0.3)
healthbar.runAction(SKAction.resizeToWidth(self.frame.size.width * 0.1, duration: 3))
dragonNode.addChild(healthbar)
return dragonNode
}
Can someone share a way to implement a border to my current health bar. I think it will look better that way.