sprite-kit

Node in swift not appearing

和自甴很熟 提交于 2020-01-15 09:32:08
问题 I'm trying to put a node in my game on Swift, but it's not appearing. Please help! import SpriteKit import GameplayKit class GameScene: SKScene { override func didMove(to view: SKView) { let levelLabelNode = SKLabelNode(fontNamed: "Arial") levelLabelNode.text = "Level" levelLabelNode.fontSize = 30 levelLabelNode.fontColor = SKColor.white levelLabelNode.position = CGPoint(x: self.frame.size.width/2, y: self.frame.size.height*0.75) self.addChild(levelLabelNode) here's the code 回答1: I copied the

Node in swift not appearing

…衆ロ難τιáo~ 提交于 2020-01-15 09:32:06
问题 I'm trying to put a node in my game on Swift, but it's not appearing. Please help! import SpriteKit import GameplayKit class GameScene: SKScene { override func didMove(to view: SKView) { let levelLabelNode = SKLabelNode(fontNamed: "Arial") levelLabelNode.text = "Level" levelLabelNode.fontSize = 30 levelLabelNode.fontColor = SKColor.white levelLabelNode.position = CGPoint(x: self.frame.size.width/2, y: self.frame.size.height*0.75) self.addChild(levelLabelNode) here's the code 回答1: I copied the

SKPhysicsJoint: Contacts and collisions not working

谁说我不能喝 提交于 2020-01-15 07:36:25
问题 On IOS7.1, using SpriteKit, I've created two simple rectangular sprites with corresponding physics bodies. I set up contact and collision bit masks, and all works exactly as I expect: contacts are detected and collisions prevent the two rectangles from overlapping. But when I create an SKPhysicsJointSpring object and join the two rectangles, no contacts are ever detected even though the rectangles sometimes overlap during simulation. (The spring behavior works just as one would expect, though

SKSpriteKit, detect non-transparency parts

本秂侑毒 提交于 2020-01-15 03:42:07
问题 I am making a game in SKSpriteKit, I am trying to make a foreground object with this Image, http://minus.com/i/OQ0boloElnCr if an object touches the non-transparency in the picture(the ceiling and rock paths), the object dies. Is it possible in Sprite kit to detect the ceiling, the non-transparency parts of the image 来源: https://stackoverflow.com/questions/20089846/skspritekit-detect-non-transparency-parts

Storing Sprite Kit Level Data

我的梦境 提交于 2020-01-14 12:36:40
问题 There is a project I am working on in which a set of targets appear onto the screen. The targets should appear a certain amount at the same time, and with a certain delay in between each appearance. My question is how I would correctly store the level data for this game. I was considering using a csv file to store the level data (target type, location, delay, etc.), but I'm wondering if there is a better way to do it. I had also considered making a level object to store level information, but

Storing Sprite Kit Level Data

社会主义新天地 提交于 2020-01-14 12:35:52
问题 There is a project I am working on in which a set of targets appear onto the screen. The targets should appear a certain amount at the same time, and with a certain delay in between each appearance. My question is how I would correctly store the level data for this game. I was considering using a csv file to store the level data (target type, location, delay, etc.), but I'm wondering if there is a better way to do it. I had also considered making a level object to store level information, but

Spritekit: how to make game screen view move upwards as node “jumps” along the y axis?

不羁的心 提交于 2020-01-14 05:18:06
问题 could someone please post an example code of how i could make my game screen move up as my player node "jumps" up the y axis. the same as doodle jump? at the moment it obviously just jumps straight out of the top of the screen. any help with making my "platform" nodes remove themselves from the parent and then reapear when they go out the bottom of the view as i move up the screen would help aswell. and one last thing, how do i add more than one node to the initial view. [self add child:node]

How do I size sprites in a universal sprite kit game

泪湿孤枕 提交于 2020-01-14 05:16:08
问题 I'm relatively new to swift programming. I have made an app where I didn't use SpriteKit and I would size most views by scaling down the images to a multiple of the screens width and height. Not sure if this is the best tactic, but it worked and I was able to build an app that looked good on all devices. With spritekit and the scene.sks files, I don't have the option of auto-layouts to size my sprites like I did before. There isn't a lot of content about universal apps online, so I'm

How to put AdMob Banner in SpriteKit?

百般思念 提交于 2020-01-14 03:44:05
问题 I am creating an game in SpriteKit, and I don't know how to use AdMob banner in SpriteKit. I know how to use with Swift where you drag the view to your storyboard, and etc... But once again, Can anyone help me to use it in SpriteKit? Getting this error when applying to place banner. To get test ads on this device, call: request.testDevices = @[ * !********'" ];** 回答1: Everything is the exact same as with UIKit , except that you have to position it programmatically. Also make sure that this

Change SKScene using presentScene()

烈酒焚心 提交于 2020-01-14 02:48:09
问题 In my SpriteKit Game i'm using: self.scene!.removeFromParent() let skView = self.view! as SKView skView.ignoresSiblingOrder = true var scene: PlayScene! scene = PlayScene(size: skView.bounds.size) scene.scaleMode = .AspectFill skView.presentScene(scene, transition: SKTransition.fadeWithColor(SKColor(red: 25.0/255.0, green: 55.0/255.0, blue: 12.0/255.0, alpha: 1), duration: 1.0)) to move from one scene to another. But how can I go back to the original scene? Using the same principle of code