Resizing Button Abbrechen in ModalAttack

This commit is contained in:
Chauntalle Schüle 2020-05-15 13:30:56 +02:00
parent 8b840b5089
commit 938c35196b

View File

@ -29,26 +29,27 @@ class CancelBtnNode: SKSpriteNode {
self.isEnabled = isEnabled self.isEnabled = isEnabled
let texture = SKTexture(imageNamed: "yellow_cross") let texture = SKTexture(imageNamed: "yellow_cross")
super.init(texture: texture, color: SKColor.white, size: texture.size()) super.init(texture: texture, color: SKColor.white, size: texture.size())
self.size = CGSize(width: 30, height: 30)
self.position = position self.position = position
let label = SKLabelNode(fontNamed: "Courier-Bold") let label = SKLabelNode(fontNamed: "Courier-Bold")
label.fontSize = 30 label.fontSize = 30
label.fontColor = SKColor.black label.fontColor = SKColor.black
label.zPosition = 1 label.zPosition = 1
label.verticalAlignmentMode = .center label.verticalAlignmentMode = .center
label.text = text label.text = text
label.name = "label" label.name = "label"
if iconName.isEmpty { if iconName.isEmpty {
label.position = CGPoint(x: 0, y: 0) label.position = CGPoint(x: 0, y: 0)
} else { } else {
label.position = CGPoint(x: size.width * 0.25, y: 0) label.position = CGPoint(x: size.width * 0.25, y: 0)
let icon = SKSpriteNode(imageNamed: iconName) let icon = SKSpriteNode(imageNamed: iconName)
icon.position = CGPoint(x: -size.width * 0.25, y: 0) icon.position = CGPoint(x: -size.width * 0.25, y: 0)
icon.zPosition = 1 icon.zPosition = 1
self.addChild(icon) self.addChild(icon)
} }
self.addChild(label) self.addChild(label)
isUserInteractionEnabled = true isUserInteractionEnabled = true
} }