software-projekt-2-gold-wars/GoldWars/GoldWars/Components/DefBoostSkillComponent.swift

34 lines
764 B
Swift

//
// DefBoostSkillComponent.swift
// GoldWars
//
// Created by Niko Jochim on 01.05.20.
// Copyright © 2020 SP2. All rights reserved.
//
import GameplayKit
class DefBoostSkillComponent: GKComponent{
let shapeNode: SKShapeNode
let labelNode: SKLabelNode
init(text: String, texture: SKTexture?, anchorPoint: CGPoint) {
self.labelNode = SKLabelNode(text: text)
self.shapeNode = SKShapeNode(circleOfRadius: 30)
self.shapeNode.position = anchorPoint
self.labelNode.position = CGPoint(x: anchorPoint.x, y: anchorPoint.y - 15)
if texture != nil {
shapeNode.fillTexture = texture
}else {
shapeNode.fillColor = SKColor.gray
}
super.init()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}