SpriteKit

RSS for tag

Drawing shapes, particles, text, images, and video in two dimensions using SpriteKit.

SpriteKit Documentation

Posts under SpriteKit tag

49 Posts
Sort by:
Post not yet marked as solved
0 Replies
520 Views
mac mini 2018, MAC OS Ventura 13.5.2, Xcode 15.0 im running my game app in iPhone SE(3rd gen) device(not simulator) with IOS 17 and getting the following error in console: [0x159dec540|RoomCongruence::Processor|Processor] One or more of the chosen IR Presets does not contain room congruence data or the data is corrupted. err shows in console among this other errs messages: getFilePtr: error -1 getting file status [Room Congruence] isIrDataUserDataDictionaryStructurallyValid: IRData User Data invalid - underlying CF object is nil. [0x159dec540|RoomCongruence::Processor|Processor] One or more of the chosen IR Presets does not contain room congruence data or the data is corrupted. the error is showing only(one time) when user have started a game, but not showing if user select to play again. app have been tested on IOS 15 and 16 but not showing this error. appreciate any help, i can provide any other data as necessary. Sorry if im may be missing any info or data necessary this my first time posting here, thanks.
Posted
by jav79.
Last updated
.
Post not yet marked as solved
0 Replies
509 Views
mac mini 2018, MAC OS Ventura 13.5.2, Xcode 15.0 using SpriteKit im running my game app in iPhone SE(3rd gen) device(not simulator) with IOS 17 and getting the following error in console: [Room Congruence] isIrDataUserDataDictionaryStructurallyValid: IRData User Data invalid - underlying CF object is nil. the error is showing only(one time) when user have started a game, but not showing if user select to play again. the error is showing among the following console errs: getFilePtr: error -1 getting file status [Room Congruence] isIrDataUserDataDictionaryStructurallyValid: IRData User Data invalid - underlying CF object is nil. [0x159dec540|RoomCongruence::Processor|Processor] One or more of the chosen IR Presets does not contain room congruence data or the data is corrupted. app have been tested on IOS 15 and 16 but not showing this error. appreciate any help, i can provide any other data as necessary. Sorry if im may be missing any info or data necessary this my first time posting here, thanks.
Posted
by jav79.
Last updated
.
Post not yet marked as solved
2 Replies
1.6k Views
HELLO WORLD! I am currently developing an amazing Unity mini Game. The game development has come to the deploying stage. Using Unity allows me to deploy this game on MacOS, iOS, Android and Windows which is fantastic . However, I really need this game to have the iOS widget extension as a key feature on mobile. Just like the "Steve" dinosaur game which can be played in widget. I had seen a lot of tutorials and youtube videos but still cant find a solution which make Unity iOS app into a widget. If I really want to make widget Game on iOS, do I need to develop the whole game all over again in xcode or using GameKit? Really hoping there's a way to simply convert the Unity iOS app into a widget.
Posted Last updated
.
Post not yet marked as solved
1 Replies
463 Views
Hi all So I'm quite new into GameDev and am struggling a bit with the Tilemap All my elements have the size of 64x64. As you can see in my screenshot there is some gap between the street and the water. It might be simple but what's the best way to fix that gap? I could increase the width of the left and right edge png but then I will sooner or later run into other problems as it then is not fitting with the rest. Thanks for your help Cheers from Switzerland
Posted
by SooX.
Last updated
.
Post not yet marked as solved
2 Replies
1.4k Views
GCVirtualController isn't displaying when used with SKScene class. The Virtual controllers appear but then it seems that they are obscured by the SKScene itself!? The documentation says that calling connect() will display the virtual controllers but I seem to be missing how to add the controllers to the SKScene? class GameScene: SKScene { private var _virtualController: Any? @available(iOS 15.0, *) public var virtualController: GCVirtualController? { get { return self._virtualController as? GCVirtualController } set { self._virtualController = newValue } } override func didMove(to view: SKView) { let background = SKSpriteNode(imageNamed: ".jpg") background.zPosition = -1 addChild(background) let virtualConfig = GCVirtualController.Configuration() virtualConfig.elements = [GCInputLeftThumbstick, GCInputRightThumbstick, GCInputButtonA, GCInputButtonB] virtualController = GCVirtualController(configuration: virtualConfig) virtualController?.connect() } } I've also tried adding the virtual controllers in the UIViewController but this doesn't work either.
Posted Last updated
.
Post not yet marked as solved
6 Replies
787 Views
I'm trying to add a SpriteKit scene to my view using SpriteView(scene:SKScene(fileNamed: "SceneName")!). This works well, but how can I interact with the scene? Thanks in advance for your answer ❤️
Posted
by Xenon_MXL.
Last updated
.
Post not yet marked as solved
17 Replies
7.1k Views
I've an app I've been working on for quite some time now. It uses SpriteKit. The windows with the scenes in them are generated programmatically. All of a sudden, when it's up and running through XCode, the console throws out a continuous stream of errors - probably in the order of 1 per second. The main one that makes up this stream is: 2022-03-07 20:07:38.765930+0000 My*App[8461:465673] [] CurrentVBLDelta returned 0 for display 1 -- ignoring unreasonable value But others that appear slightly less frequently are: 2022-03-07 20:07:38.447800+0000 My*App[8461:465143] Metal GPU Frame Capture Enabled 2022-03-07 20:07:38.448070+0000 My*App[8461:465143] Metal API Validation Enabled 2022-03-07 20:07:38.613097+0000 My*App[8461:465640] [] [0x7f9596053820] CVCGDisplayLink::setCurrentDisplay: 1 2022-03-07 20:07:38.613415+0000 My*App[8461:465640] [] [0x7f9596053820] Bad CurrentVBLDelta for display 1 is zero. defaulting to 60Hz. 2022-03-07 20:07:38.613442+0000 My*App[8461:465640] [] [0x7f9596053800] CVDisplayLinkCreateWithCGDisplays count: 1 [displayID[0]: 0x1] [CVCGDisplayLink: 0x7f9596053820] 2022-03-07 20:07:38.613467+0000 My*App[8461:465640] [] [0x7f9596053800] CVDisplayLinkStart 2022-03-07 20:07:38.613487+0000 My*App[8461:465640] [] [0x7f9596053820] CVDisplayLink::start 2022-03-07 20:07:38.613541+0000 My*App[8461:465640] [] [0x7f9596053800] CVDisplayLinkStart 2022-03-07 20:07:38.613575+0000 My*App[8461:465640] [] [0x7f9596053820] CVDisplayLink::start 2022-03-07 20:07:38.613634+0000 My*App[8461:465671] [] [0x600000c09f10] CVXTime::reset 2022-03-07 20:07:38.613718+0000 My*App[8461:465671] [] CurrentVBLDelta returned 0 for display 1 -- ignoring unreasonable value 2022-03-07 20:07:38.639810+0000 My*App[8461:465671] [] CurrentVBLDelta returned 0 for display 1 -- ignoring unreasonable value 2022-03-07 20:07:38.639887+0000 My*App[8461:465671] [] [0x7f9596053820] CVCGDisplayLink::getDisplayTimes display: 1 -- SLSDisplayGetCurrentVBLDelta returned 0 => generating fake times 2022-03-07 20:07:38.673702+0000 My*App[8461:465653] [] [0x7f9596053820] CVCGDisplayLink::setCurrentDisplay: 1 2022-03-07 20:07:38.673748+0000 My*App[8461:465653] [] [0x7f9596053820] CVDisplayLink::stop 2022-03-07 20:07:38.673862+0000 My*App[8461:465653] [] [0x7f9596053820] Bad CurrentVBLDelta for display 1 is zero. defaulting to 60Hz. 2022-03-07 20:07:38.673883+0000 My*App[8461:465653] [] [0x7f9596053820] CVDisplayLink::start I really don't know how else to describe this. I can only imagine having to hand over the entire project as lately I've only been working on the storyboard file so how would this affect it? To be honest the only change I can see is my upgrade to OSX 12.2.1. It's definitely something to do with SpriteKit since not initialising a window with a scene in it stops the errors from showing.
Posted
by todd_d.
Last updated
.
Post not yet marked as solved
0 Replies
320 Views
[SKCropNode setMaskNode:] crash, any idea? Help! Crashed: com.apple.main-thread EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x000000012e8067b0 0 SpriteKit 0x62d2c SKCCropNode::setMaskNode(SKCNode*) + 8 1 SpriteKit 0xa0854 -[SKCropNode setMaskNode:] + 88
Posted
by Lee_Lv.
Last updated
.
Post not yet marked as solved
0 Replies
309 Views
I have a sprite kit scene with an edge loop physics body set programmatically with the category bit mask set to a custom Physics Category called Edge. Through the scene editor, I've added several sprite nodes with varying physics body types and various category masks and collision masks. The collision mask for a particular sprite node includes the Edge category. Initially, I have this node partially off the screen on the scene editor but when I run the program, it appears completely inside the edge loop. Is it possible to have a sprite node be positioned partially inside the edge loop and partially outside the edge loop?
Posted
by guti7.
Last updated
.
Post not yet marked as solved
1 Replies
492 Views
I love the new UIImage(resource:) initializer that uses the automatically generated symbols for my image assets. However, there does not appear to be an equivalent in SpriteKit so I am forced to still use SKSpriteNode(imageNamed:) I am using Xcode 15 Beta 7. Will this be included when Xcode 15 goes into production?
Posted
by hotngui.
Last updated
.
Post not yet marked as solved
0 Replies
478 Views
Xcode will try to open to the last opened project, which caused the crash, but it will just crash again. Any suggestions? Edit: I submitted the logs to apple and a restart did not resolve. Translated Report (Full Report Below) Process: Xcode [836] Path: /Applications/Xcode.app/Contents/MacOS/Xcode Identifier: com.apple.dt.Xcode Version: 14.3.1 (21815) Build Info: IDEFrameworks-21815000000000000~2 (14E300c) App Item ID: 497799835 App External ID: 857328487 Code Type: ARM-64 (Native) Parent Process: launchd [1] User ID: 501 Date/Time: 2023-09-02 09:57:22.3965 -0400 OS Version: macOS 13.5.1 (22G90) Report Version: 12 Anonymous UUID: C53B443F-47B9-4610-5294-CDFB25DDE82B Time Awake Since Boot: 300 seconds System Integrity Protection: enabled Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_PROTECTION_FAILURE at 0x000000016b5d3fe0 Exception Codes: 0x0000000000000002, 0x000000016b5d3fe0 Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11 Terminating Process: exc handler [836] VM Region Info: 0x16b5d3fe0 is in 0x167dd0000-0x16b5d4000; bytes after start: 58736608 bytes before end: 31 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL mapped file 167dcc000-167dd0000 [ 16K] r--/rw- SM=COW ...t_id=d707e06b ---> STACK GUARD 167dd0000-16b5d4000 [ 56.0M] ---/rwx SM=NUL ... for thread 0 Stack 16b5d4000-16bdd0000 [ 8176K] rw-/rwx SM=PRV thread 0 Kernel Triage: VM - (arg = 0x0) pmap_enter retried due to resource shortage VM - (arg = 0x0) pmap_enter retried due to resource shortage VM - (arg = 0x0) pmap_enter retried due to resource shortage VM - (arg = 0x0) pmap_enter retried due to resource shortage
Posted
by guti7.
Last updated
.
Post not yet marked as solved
1 Replies
559 Views
Hi, I'm creating a SF Symbols image like this: var img = UIImage(systemName: "x.circle" ,withConfiguration: symbolConfig)!.withTintColor(.red) In the debugger the image is really red. and I'm using this image to create a SKTexture: let shuffleTexture = SKTexture(image: img) The texture image is ALWAYS black and I have no idea how to change it's color. Nothing I've tried so far works. Any ideas how to solve this? Thank you! Best Regards, Frank
Posted Last updated
.
Post not yet marked as solved
0 Replies
453 Views
just using SKView func texture(from node: SKNode, crop: CGRect) -> SKTexture? crash_info_entry_0 -[MTLTextureDescriptorInternal validateWithDevice:]:1325: failed assertion `Texture Descriptor Validation MTLTextureDescriptor has width (8256) greater than the maximum allowed size of 8192. MTLTextureDescriptor has height (8242) greater than the maximum allowed size of 8192. ' Help!
Posted
by Lee_Lv.
Last updated
.
Post not yet marked as solved
7 Replies
1.7k Views
Im programmatically using SKTileMapNode. The code is C# (Xamarin.iOS) but should be readable by every Swift/ObjC developer.The problem is that the sorting of tiles in isometric projection seems to be incorrect and I cannot see why. To test, the map has 1 row and 5 columns. See the screenshot:https://dl.dropboxusercontent.com/u/111612273/SVhjD.pngThe tiles at 0|0 and 2|0 are in front of the others. The pyramid styled tile at 4|0 however, is drawn correctly in front of the one at 3|0.I'm using two simple tiles: The first one has a resolution of 133x83px and the second one is 132x131px:https://dl.dropboxusercontent.com/u/111612273/bcIvP.pngandhttps://dl.dropboxusercontent.com/u/111612273/wzCZV.pngThis is what it looks like in Tiled and what I am trying to reproduce: https://dl.dropboxusercontent.com/u/111612273/66G6p.pngThe tile map is setup and added to the scene using the following code:var tileDef1 = new SKTileDefinition (SKTexture.FromImageNamed ("landscapeTiles_014")); var tileDef2 = new SKTileDefinition (SKTexture.FromImageNamed ("landscapeTiles_036")); var tileGroup1 = new SKTileGroup (tileDef1); var tileGroup2 = new SKTileGroup (tileDef2); var tileSet = new SKTileSet (new [] { tileGroup1, tileGroup2 }, SKTileSetType.Isometric); var tileMap = SKTileMapNode.Create(tileSet, 5, 2, new CGSize (128, 64)); tileMap.Position = new CGPoint (0, 0); tileMap.SetTileGroup (tileGroup1, 0, 0); tileMap.SetTileGroup (tileGroup2, 1, 0); tileMap.SetTileGroup (tileGroup1, 2, 0); tileMap.SetTileGroup (tileGroup2, 3, 0); tileMap.SetTileGroup (tileGroup2, 4, 0); tileMap.AnchorPoint = new CGPoint (0, 0); Add (tileMap);The tile size used to initialise the tile map (128|64) looks strange to me. It really hasn't anything to do with the texture size of the tiles and unlike everywhere else in SpriteKit it doesn't seem to be using "points". However, this is the size where Tiled is giving me nicely aligned tiles and also SpriteKit is looking good, besides the sorting issue.What am I doing wrong or where am I thinking wrong?
Posted
by Krumelur.
Last updated
.
Post not yet marked as solved
3 Replies
896 Views
hey i want my character to add a jumping animation to my doodlejump clone style. I think I know how to specify the sprites but I fail with the query isJumping = true. can someone help me? the coin provides the platform on which the player lands the ground is only at the start // GameScene.swift // megaJump // // Created by Dennis Sergel on 26.06.23. // import Foundation import SpriteKit class GameScene: SKScene, SKPhysicsContactDelegate{ let background = SKSpriteNode(imageNamed: "background") let player = SKSpriteNode(imageNamed: "Monster2") let ground = SKSpriteNode(imageNamed: "ground") let coin = SKSpriteNode(imageNamed: "coin") enum bitmasks: UInt32 { case player = 0b1 case coin = 0b10 } override func didMove(to view: SKView) { self.size = CGSize(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height) self.anchorPoint = .zero background.position = CGPoint(x: size.width / 2, y: 1060) background.zPosition = 1 background.setScale(1.3) addChild(background) physicsWorld.contactDelegate = self ground.position = CGPoint(x: size.width / 2, y: 80) ground.zPosition = 5 ground.setScale(2.5) ground.physicsBody = SKPhysicsBody(rectangleOf: ground.size) ground.physicsBody?.isDynamic = false ground.physicsBody?.affectedByGravity = false addChild(ground) player.position = CGPoint(x: size.width / 2, y: 150) player.zPosition = 80 player.setScale(0.14) player.physicsBody = SKPhysicsBody(circleOfRadius: player.size.height / 2) player.physicsBody?.isDynamic = false // later is true player.physicsBody?.restitution = 1 player.physicsBody?.friction = 0 player.physicsBody?.angularDamping = 0 player.physicsBody?.categoryBitMask = bitmasks.player.rawValue player.physicsBody?.collisionBitMask = 0 player.physicsBody?.contactTestBitMask = bitmasks.coin.rawValue addChild(player) animatePlayer(isJumping: true) makeCoin() } func animatePlayer (isJumping: Bool){ if isJumping { player.texture = SKTexture(imageNamed: "monster") }else{ player.texture = SKTexture(imageNamed: "Monster2") } } func didBegin(_ contact: SKPhysicsContact) { let contactA: SKPhysicsBody let contactB: SKPhysicsBody if contact.bodyA.categoryBitMask < contact.bodyB.categoryBitMask{ contactA = contact.bodyA // player contactB = contact.bodyB // Coin } else { contactA = contact.bodyB // player contactB = contact.bodyA // coin } if contactA.categoryBitMask == bitmasks.player.rawValue && contactB.categoryBitMask == bitmasks.coin.rawValue{ if player.physicsBody!.velocity.dy < 0 { player.physicsBody?.velocity = CGVector(dx: player.physicsBody!.velocity.dx, dy: 120) } } } override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) { for touch in touches { let location = touch.location(in: self) player.position.x = location.x } } override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) { player.physicsBody?.isDynamic = true player.physicsBody?.applyImpulse(CGVector(dx: 0, dy: 120)) } func makeCoin() { coin.position = CGPoint(x: size.width / 2, y: 150) coin.zPosition = 5 coin.setScale(0.14) coin.physicsBody = SKPhysicsBody(rectangleOf: coin.size) coin.physicsBody?.isDynamic = false coin.physicsBody?.allowsRotation = false coin.physicsBody?.affectedByGravity = false coin.physicsBody?.categoryBitMask = bitmasks.coin.rawValue coin.physicsBody?.collisionBitMask = 0 coin.physicsBody?.contactTestBitMask = bitmasks.player.rawValue addChild(coin) } }
Posted
by Senat.
Last updated
.
Post not yet marked as solved
0 Replies
474 Views
I have multiple images that at various times I need to replace a target image for a SKSpriteNode. Each of these multiple images has a different size. The target SKSpriteNode has a fixed frame that I want to stay fixed. This target is created via: myTarget = SKSpriteNode(imageNamed: “target”) myTarget.size = CGSize(…) myTarget.physicsBody = SKPhysicsBody(rectangleOf: myTarget.size) How do I resize each of the multiple images so that each fills up the target frame (expand or contract)? Pretend the target is a shoebox and each image is a balloon that expands or contracts to fill the shoebox. I have tried the following that fails, that is, it changes the size of the target to fit the new image .. in short, it does the exact opposite of what I want. let newTexture = SKTexture(imageNamed: newImage) let changeImgAction = SKAction.setTexture(newTexture, resize: true) myTarget.run(changeImgAction) Again, keep frame of myTarget fixed and change size of newTexture to fit the above frame ..
Posted
by JohnLove.
Last updated
.
Post not yet marked as solved
1 Replies
890 Views
I have Xcode 14.3.1 /////START of Code import SpriteKit import GameplayKit class PlayerControlComponent : GKComponent, ControlInputDelegate { var touchControlNode : TouchControlInputNode? func setupControls (camera: SKCameraNode, scene: SKScene){ touchControlNode = TouchControlInputNode(frame: scene.frame) touchControlNode?.inputDelegate = self touchControlNode?.position = CGPoint.zero camera.addChild(touchControlNode!) } func follow(command: String?) { print("command:(String(describing: command))") } } ///////End of code I have no error in project and the simulator shows launch screen then precedes to what I have on the game scene when I have no component in the component inspector of the the Sprite(player) when I add a component to the component inspector of the Sprite(player) that is when, after the launch screen, it is a grey screen. The component is supposed to add the controls I created in the TouchContorolNode file and have the camera and controls so as the player moves the controls follow the Sprite(player). Does anyone know why the screen is turning Grey after the launch screen with the comment attached to the Sprite(player)?
Posted
by Saturn87.
Last updated
.
Post not yet marked as solved
1 Replies
586 Views
Hey y'all, I've been facing an incredibly bothersome error and wanted to see if you had any comments/fixes for whats going on. I'm attempting to create a custom shape using the Path { path in } initalizer, but am receiving the following error Referencing initializer 'init(codingKey:)' on 'RawRepresentable' requires that 'Path' conform to 'CodingKeyRepresentable' I ended up copying the code here, but am still receiving the same errors. I'm running xCode 14.3
Posted
by hunterd.
Last updated
.