sklabelnode

Delay when calling SKLabelNode?

人盡茶涼 提交于 2019-12-04 10:36:12
I am having a problem with a slight delay (lag) when transitioning from one SKScene to another. By commenting out various bit of code I have narrowed this down to SKLabelNode , my guess is thats its loading / caching the font when called which is resulting in a small delay/stutter when stating up the new SKScene . Has anyone else noticed this, its less obvious when your just using a single SKScene (like the default template) as the slowdown just gets lost in the usual startup delay. Does anyone know a way round this, is there a way to pre-load the font? I guess I could load the font on the

SpriteKit: Is there a way to centre a SKLabelNode according to its baseline

别等时光非礼了梦想. 提交于 2019-12-04 04:52:31
问题 A label has four different verticalAlignmentMode : .Baseline , .Bottom , .Center and .Top . I would like the label to be centred on its position according to its baseline. .Center doesn't work for me because the bottom of the frame isn't the baseline of the text, but rather, the bottom of the lowest letter (like a 'y', for example). I have also tried using .Baseline and subtracting half the frame's height from the y-position, but this doesn't work either and results in the same problem as

Centre a SKLabelNode on a SKSpriteNode

寵の児 提交于 2019-12-04 02:55:10
I have an SKLabelNode that is the child of a SKSpriteNode because I'm trying to create a Button class to create buttons in an easier way. I've tried a couple of things using the anchor point of the SKSpriteNode, but I don't quite understand exactly what is going on. How do I centre the label onto the sprite (it's parent node)? I realized how to solve this...here's what i did. Keep in mind that I have a class called Button that is a subclass of SKSpriteNode. In the Button.m class I have an instance variable called label that is a SKLabelNode. I add the label node as a child to the button then

SKLabelNode will disappear but is still clickable

落爺英雄遲暮 提交于 2019-12-02 05:55:32
I am making a game using SpriteKit and Swift, running Xcode 6. I have an SKLabelNode , let's call it myLabelNode for this example. When I call myLabelNode.removeFromParent() it removes the node from the scene, as it should. The node count drops by 1, and it isn't visible anywhere on the screen. However, when I click the spot where myLabelNode previously was, my program will still call out the function that should only happen when myLabelNode is touched. I also tried combining myLabelNode.removeFromParent() with myLabelNode.hidden = true , but it is still touchable, and calls the function even

SpriteKit: Is there a way to centre a SKLabelNode according to its baseline

一世执手 提交于 2019-12-02 00:37:54
A label has four different verticalAlignmentMode : .Baseline , .Bottom , .Center and .Top . I would like the label to be centred on its position according to its baseline. .Center doesn't work for me because the bottom of the frame isn't the baseline of the text, but rather, the bottom of the lowest letter (like a 'y', for example). I have also tried using .Baseline and subtracting half the frame's height from the y-position, but this doesn't work either and results in the same problem as .Center . The text in the label I'm trying to centre is "Play!". Setting the mode to '.Center' makes the

Make touch-area for SKLabelNode bigger for small characters

↘锁芯ラ 提交于 2019-12-01 10:28:22
I'm adding an old-school high-score entry screen to my game, in which the users tap each letter to enter their name. Each letter, symbol or phrase ('DEL', 'SP' etc) is a single SKLabelNode and it's very difficult to tap on the ',' and '.' characters and some of the symbols though. Each tap is detected via the usual touchesBegan To make detention easier I plan on placing a larger node behind each letter and update touchesBegan to either detect a touch on the label itself or on this other label, in which case just use the child node for the touch (which will be the letter or phrase). Before I do

Make touch-area for SKLabelNode bigger for small characters

时光毁灭记忆、已成空白 提交于 2019-12-01 08:09:22
问题 I'm adding an old-school high-score entry screen to my game, in which the users tap each letter to enter their name. Each letter, symbol or phrase ('DEL', 'SP' etc) is a single SKLabelNode and it's very difficult to tap on the ',' and '.' characters and some of the symbols though. Each tap is detected via the usual touchesBegan To make detention easier I plan on placing a larger node behind each letter and update touchesBegan to either detect a touch on the label itself or on this other label

SKLabelNode delays app start

倖福魔咒の 提交于 2019-12-01 05:15:51
at the moment I'm coding a little app with SpriteKit, which works perfectly fine, but the only problem is an SKLabelNode, which I initialize with the following normal piece of code: ​self.scoreLabel = [SKLabelNode labelNodeWithFontNamed:@"Futura"]; self.scoreLabel.fontSize = 190.0f; self.scoreLabel.color = [SKColor whiteColor]; self.scoreLabel.alpha = .2; self.scoreLabel.text = @"00"; self.scoreLabel.position = CGPointMake(screenWidth/2,self.scoreLabel.frame.size.height/2); [self addChild:self.scoreLabel]; There a many more things to initialize, but they doesn't affect anything. If I comment

SKLabelNode delays app start

久未见 提交于 2019-12-01 02:31:10
问题 at the moment I'm coding a little app with SpriteKit, which works perfectly fine, but the only problem is an SKLabelNode, which I initialize with the following normal piece of code: ​self.scoreLabel = [SKLabelNode labelNodeWithFontNamed:@"Futura"]; self.scoreLabel.fontSize = 190.0f; self.scoreLabel.color = [SKColor whiteColor]; self.scoreLabel.alpha = .2; self.scoreLabel.text = @"00"; self.scoreLabel.position = CGPointMake(screenWidth/2,self.scoreLabel.frame.size.height/2); [self addChild

Resize a SKLabelNode font size to fit?

本小妞迷上赌 提交于 2019-11-30 15:22:30
问题 I'm creating a label inside of sprite kit and setting an initial size. Since the app is to be localized, words may appear longer in other languages than their english version. Therefore how can I adjust the font size of the label to fit within a certain width which in this case is the button. myLabel = SKLabelNode(fontNamed: "Arial") myLabel.text = "Drag this label" myLabel.fontSize = 20 回答1: I was able to solve this thanks to a comment by @InvalidMemory and the answer by @mike663. Basically