sklabelnode

Add dynamically SKLabelNode to MKTVIew

岁酱吖の 提交于 2020-04-30 07:13:29
问题 I am working on metal view that shows the heart rate graph. between every peak of this graph, I need to add a label. In this process, chart moving from right to left I have an array that dynamically shows the x coordinate of this label for example when one value should show in the screen, this array contain only element and if there are more, it contain more element, this array is named coordinates I use a for loop to get every element for coordinate in coordinates { } I also have another

Add custom “number” images to SKLabelNode in as a Score in SpriteKit with Swift

邮差的信 提交于 2020-01-13 05:50:12
问题 I basically want to add custom font numbers (with images) in Singles and add them for my score in my game with SpriteKit. This is the font image style They are numbers from 0 to 9 I have been trying to figure this out for a while. I'm not sure if you can add it to SKLabelNode or if you would have to make it in a class. 回答1: SKLabelNode would not allow for bitmap fonts. If your custom font was TTF, you would be able to use the custom font with SKLabelNode . An explanation how is here:

How to change text of a SKLabelNode?

倖福魔咒の 提交于 2019-12-24 06:06:08
问题 How do I update a label's text that was created in initWithSize? Here is the code for the label within the initWithSize: SKLabelNode *scoreLabel = [SKLabelNode labelNodeWithFontNamed:@"TimesNewRoman"]; scoreLabel.text = [NSString stringWithFormat:@"%i", score]; scoreLabel.fontSize = 30; scoreLabel.position = CGPointMake(290, CGRectGetMidY(self.frame) - 30); scoreLabel.zRotation = -M_PI/2; [self addChild:scoreLabel]; As the game is running I update the variable score and I was just wondering

Delay when calling SKLabelNode?

做~自己de王妃 提交于 2019-12-21 18:05:49
问题 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

Delay when calling SKLabelNode?

我怕爱的太早我们不能终老 提交于 2019-12-21 18:04:43
问题 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

SKLabelNode will disappear but is still clickable

若如初见. 提交于 2019-12-20 04:28:21
问题 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

SKLabelNode creates black line and not showing text on iPhone4

筅森魡賤 提交于 2019-12-13 20:23:33
问题 I am loading different texts into a SKLabeNode it works fine on iPhone5, simulator, etc... but on iPhone4 I sometimes just get a black line, instead of the text. It is weird that always the same texts are generating the failure, but I cannot figure out what is happening. The code is: ButtonText=@""; ButtonLabel=[SKLabelNode labelNodeWithFontNamed:@"Marker Felt"]; ButtonLabel.fontSize=46; ButtonLabel.text=ButtonText; ButtonLabel.position=CGPointMake(0, 0); ButtonLabel.verticalAlignmentMode

Does userInteractionEnabled property work correctly on SpriteKit nodes?

允我心安 提交于 2019-12-12 18:10:54
问题 I have following simple code: // // BGMyScene.m // Test1 // // Created by AndrewShmig on 3/10/14. // Copyright (c) 2014 Bleeding Games. All rights reserved. // #import "BGMyScene.h" @implementation BGMyScene - (id)initWithSize:(CGSize)size { if (self = [super initWithSize:size]) { /* Setup your scene here */ self.backgroundColor = [SKColor colorWithRed:0.15 green:0.15 blue:0.3 alpha:1.0]; // first label SKLabelNode *myLabel = [SKLabelNode labelNodeWithFontNamed:@"Chalkduster"]; // myLabel

How to disable anti-aliasing in SKLabelNode?

丶灬走出姿态 提交于 2019-12-12 01:38:48
问题 I want to use a pixel font in my SpriteKit game. But I can't use a bitmap font because I need to support many languages (too many characters). So I should use a ttf font file. I tried the following code, but characters were blurred by anti-aliasing. let myLabel = SKLabelNode(fontNamed:"My-Pixel-Font") myLabel.text = "Hello" myLabel.fontSize = 10 myLabel.position = CGPoint(x: 100.0, y: 100.0) myLabel.fontColor = SKColor.GrayColor() self.addChild(myLabel); Is there a good way to disable anti

updating an SKLabel to show the right integer

独自空忆成欢 提交于 2019-12-11 06:39:39
问题 ok so first off I have an achievement Variable that is defined from a struct like so: struct Achieve { var node: SKSpriteNode? var aName:String = "" var aDes:String = "" var aImage: String = "" { didSet { node?.texture = SKTexture(imageNamed: aImage) } } var aAmount:Int = 0 var aRequired:Int = 0 var aStage:Int = 0 } var Ach1 = Achieve(node: nil, aName: "Player", aDes: "Games Played", aImage: "locked", aAmount: 0, aRequired: 10, aStage: 1) My problem is when I try and change the number of the