Merge branch '14-view-hud' into 'development'
Impl. HUD for GameScene Closes #14 See merge request marcel.schwarz/software-projekt-2!22
This commit is contained in:
commit
73a632056d
@ -17,6 +17,18 @@ class GameScene: SKScene, SKPhysicsContactDelegate {
|
||||
var player = [Base]()
|
||||
var popUpOnBaseCollision = SKSpriteNode()
|
||||
|
||||
// TODO: Refactoring following as Components in Sprint 2
|
||||
var timer = SKLabelNode()
|
||||
var backBtn = SKShapeNode(circleOfRadius: 40)
|
||||
var backLabel = SKLabelNode()
|
||||
var atkBoostSkill = SKShapeNode(circleOfRadius: 30)
|
||||
var defBoostSkill = SKShapeNode(circleOfRadius: 30)
|
||||
var spySkill = SKShapeNode(circleOfRadius: 30)
|
||||
var atkBoostLabel = SKLabelNode()
|
||||
var defBoostLabel = SKLabelNode()
|
||||
var spyLabel = SKLabelNode()
|
||||
// TODO: END
|
||||
|
||||
struct physicsBodyNumber {
|
||||
static let basePlayer1Number: UInt32 = 0b1
|
||||
static let basePlayer2Number: UInt32 = 0b10
|
||||
@ -52,7 +64,6 @@ class GameScene: SKScene, SKPhysicsContactDelegate {
|
||||
createVirginBases()
|
||||
connectBases()
|
||||
addPhysicsBodyToBase()
|
||||
|
||||
}
|
||||
override func didMove(to view: SKView) {
|
||||
let background = SKSpriteNode(imageNamed: "Background")
|
||||
@ -60,6 +71,38 @@ class GameScene: SKScene, SKPhysicsContactDelegate {
|
||||
background.zPosition = -1
|
||||
background.size = self.size
|
||||
self.addChild(background)
|
||||
|
||||
// TODO: Refactor following as Components in Sprint 2
|
||||
timer.text = "Roundtime: 30 Seconds left"
|
||||
timer.fontColor = SKColor.black
|
||||
timer.fontSize = 40
|
||||
timer.position = CGPoint(x: self.size.width/2, y: self.size.height * 0.9)
|
||||
backBtn.position = CGPoint(x: 40, y: self.size.height * 0.9)
|
||||
backBtn.fillColor = SKColor.gray
|
||||
backLabel.text = "Back"
|
||||
backLabel.position = CGPoint(x: backBtn.position.x, y: backBtn.position.y - 15)
|
||||
spySkill.position = CGPoint(x: self.size.width * 0.75, y: 40)
|
||||
spySkill.fillColor = SKColor.gray
|
||||
spyLabel.text = "Spy"
|
||||
spyLabel.position = CGPoint(x: spySkill.position.x, y: spySkill.position.y - 15);
|
||||
atkBoostSkill.position = CGPoint(x: self.size.width * 0.85, y: 40)
|
||||
atkBoostSkill.fillColor = SKColor.gray
|
||||
atkBoostLabel.text = "Atk"
|
||||
atkBoostLabel.position = CGPoint(x: atkBoostSkill.position.x, y: atkBoostSkill.position.y - 15)
|
||||
defBoostSkill.position = CGPoint(x: self.size.width * 0.95, y: 40)
|
||||
defBoostSkill.fillColor = SKColor.gray
|
||||
defBoostLabel.text = "Def"
|
||||
defBoostLabel.position = CGPoint(x: defBoostSkill.position.x, y: defBoostSkill.position.y - 15)
|
||||
self.addChild(timer)
|
||||
self.addChild(backBtn)
|
||||
self.addChild(backLabel)
|
||||
self.addChild(atkBoostSkill)
|
||||
self.addChild(defBoostSkill)
|
||||
self.addChild(spySkill)
|
||||
self.addChild(atkBoostLabel)
|
||||
self.addChild(defBoostLabel)
|
||||
self.addChild(spyLabel)
|
||||
// TODO: END
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user