Questions tagged [sklabelnode]

Node that draws strings on iOS systems.

Node that draws strings on iOS systems.

https://developer.apple.com/library/IOs/documentation/SpriteKit/Reference/SKLabelNode_Ref/index.html

196 questions
4
votes
1 answer

SKLabelNode: Possible to insert NSTextAttachment or icon into block of text?

I have a SKLabelNode which has a string that I'd like to replace with an icon. let attachment = NSAttributedString(attachment: txt) attributedString.replaceCharacters(in: NSRange(location: range.location, length: range.length), with:…
Dandy
  • 1,203
  • 1
  • 16
  • 31
4
votes
2 answers

SKWarpGeometry on SKLabelNode as child of SKEffectNode flips label upside-down

I'm trying to warp an SKLabelNode as a child of SKEffectNode (documentation says you can do that), but it flips the label node upside-down before it applies the warp. This may be a bug, but before I file it, I thought I'd ask on here... Here's my…
Darth Flyeater
  • 151
  • 1
  • 5
4
votes
1 answer

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

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…
hka
  • 73
  • 5
4
votes
2 answers

Why does my SKLabelNode go off the page if the score increases

So I have an SKLabelNode which displays the users high score, when the users highs score is for example 5 the labels position isn't in the same position to where it would be if the score was for example 35, or 100 makes the label go off screen,…
Andrew Harris
  • 396
  • 7
  • 24
4
votes
1 answer

Prevent SKLabelNode from receiving Touches

I have a number of SKSpriteNodes with SKLabelNodes as children. What I would like is for any touch within the bounds of the sprite node to be handled by the sprite node, and for its children (the label nodes) to completely ignore touches. I tried…
zeeple
  • 5,509
  • 12
  • 43
  • 71
4
votes
1 answer

SKLabelNode positioning not working as expected

I am working on a game and i need to implement the top bar, holding the details like score and other stuff. My top bar should have the following (left to right): - a 50x50 icon that changes according to level, but it's the same size - a label with…
Deea B
  • 301
  • 6
  • 15
4
votes
6 answers

Delay when calling SKLabelNode?

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…
fuzzygoat
  • 26,573
  • 48
  • 165
  • 294
3
votes
1 answer

SKLabelNode Border and Bounds Issue

I am attempting to create text that has an outline. I am currently using SKLabelNode with NSAttributedString, which you can now do in SpriteKit as of iOS 11. The problem is, if the stroke width is too thick, then the outline gets cut off by what…
MikeL
  • 163
  • 10
3
votes
1 answer

Adding a background to a SKLabelNode

I have been trying to add a background around my SKLabelNode, but I can't figure out how to do it programmatically in swift 3. I see some old posts that use .background, but that doesn't work for me. let background = SKSpriteNode(color:…
GS.
  • 123
  • 12
3
votes
0 answers

SKLabelNode background colour

Im trying to add a kind of background to a label node in my swift game. imagine my background moving with white clouds, but i want to show the score in the top middle of the scene, everytime a cloud passes the score doesn't show (as i want the text…
LukeTerzich
  • 555
  • 1
  • 4
  • 17
3
votes
2 answers

SpriteKit device orientation change causes SKLabelNode distortion Swift

I am using SpriteKit to write a game for iOS in Swift. I am still fairly new to SpriteKit. I would like to support both orientations for both iPhone and iPad, and have found this: multiple orientations in SpriteKit This works as expected in the…
Itergator
  • 299
  • 3
  • 16
3
votes
1 answer

Int into label SpriteKit SKView, hl

I just want to know if is it possible to make a label or anything else who will be a integer and to display it to my gameview. var pvElf = SKLabelNode(fontNamed:"Chalkduster") pvElf.text = "100"; pvElf.fontSize = 45; pvElf.position = CGPoint(x:370,…
Kraven
  • 245
  • 1
  • 3
  • 16
3
votes
0 answers

SKLabelNode intrinsicContentSize

How would you get the intrinsicContentSize like for a UILabel but for an SKLabelNode? My not-so-educated-guess would be to create a UILabel with the same font and just get its' intrinsicContentSize... but this seems sloppy.
twodayslate
  • 2,803
  • 3
  • 27
  • 43
3
votes
2 answers

Optimizing SKLabelNode to reduce performance issues

Creating an RPG with SpriteKit has me creating SKLabelNode's for displaying all game text. I'm suffering performance issues (FPS dropping & the game lagging) every time my multi-line text box begins auto typing inputted text which uses…
Krekin
  • 1,516
  • 1
  • 13
  • 24
3
votes
1 answer

How to center the text inside the SkLabelNode

I do not mean this one: Label.horizontalAlignmentMode = SKLabelNode HorizontalAlignmentModeCenter Or Label.verticalAlignmentMode =
Nour
  • 333
  • 2
  • 10
1
2
3
13 14