From 938c35196b75f77340ea2a2a2829a77c25190432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chauntalle=20Schu=CC=88le?= Date: Fri, 15 May 2020 13:30:56 +0200 Subject: [PATCH] Resizing Button Abbrechen in ModalAttack --- GoldWars/GoldWars/CancelBtnNode.swift | 39 ++++++++++++++------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/GoldWars/GoldWars/CancelBtnNode.swift b/GoldWars/GoldWars/CancelBtnNode.swift index fcd2382..34cad7f 100644 --- a/GoldWars/GoldWars/CancelBtnNode.swift +++ b/GoldWars/GoldWars/CancelBtnNode.swift @@ -29,27 +29,28 @@ class CancelBtnNode: SKSpriteNode { self.isEnabled = isEnabled let texture = SKTexture(imageNamed: "yellow_cross") super.init(texture: texture, color: SKColor.white, size: texture.size()) + self.size = CGSize(width: 30, height: 30) self.position = position - let label = SKLabelNode(fontNamed: "Courier-Bold") - label.fontSize = 30 - label.fontColor = SKColor.black - label.zPosition = 1 - label.verticalAlignmentMode = .center - label.text = text - label.name = "label" - - if iconName.isEmpty { - label.position = CGPoint(x: 0, y: 0) - } else { - label.position = CGPoint(x: size.width * 0.25, y: 0) - let icon = SKSpriteNode(imageNamed: iconName) - icon.position = CGPoint(x: -size.width * 0.25, y: 0) - icon.zPosition = 1 - self.addChild(icon) - } - self.addChild(label) - + let label = SKLabelNode(fontNamed: "Courier-Bold") + label.fontSize = 30 + label.fontColor = SKColor.black + label.zPosition = 1 + label.verticalAlignmentMode = .center + label.text = text + label.name = "label" + + if iconName.isEmpty { + label.position = CGPoint(x: 0, y: 0) + } else { + label.position = CGPoint(x: size.width * 0.25, y: 0) + let icon = SKSpriteNode(imageNamed: iconName) + icon.position = CGPoint(x: -size.width * 0.25, y: 0) + icon.zPosition = 1 + self.addChild(icon) + } + self.addChild(label) + isUserInteractionEnabled = true }