sprite-kit

Is there a way to change the font and location of SpriteKit debug data?

风流意气都作罢 提交于 2019-12-10 06:41:03
问题 Basically what it says in the title. Is there a way to change the font and or location of SpriteKit debug data? The data that we set in the viewController: skView.showsFPS = YES; skView.showsNodeCount = YES; skView.showsDrawCount = YES; 回答1: You can add such debugging information to the scene by yourself: https://developer.apple.com/library/ios/documentation/GraphicsAnimation/Conceptual/SpriteKit_PG/Actions/Actions.html Example: Adding a Debugging Overlay section. 回答2: No. Those are all part

SKTexture nearest filtering mode doesn't work (Making Pixel Art)

孤人 提交于 2019-12-10 06:10:38
问题 I used a relatively small image (44pixel tall) and scaled it up to have a pixel art look. I tried to change the filtering mode to nearest so the anti-aliasing would disappear but it didn't. It appears with blurry edges. I tried the same with a background getting the same result. let myNode = SKSpriteNode() class GameScene: SKScene { func makeNode() { myNode.position = CGPoint(x: self.frame.size.width/2, y: self.frame.size.height/2) myNode.size = CGSize(width: 200, height: 200) myNode.texture

Draw in color the shape of your SKPhysicsBody

天大地大妈咪最大 提交于 2019-12-10 04:13:45
问题 Creating a game with SpriteKit and its actually working out very well. I am using physics and having the ability to see actually where my bodies are because I might have some alpha inside of my sprites will really be helpful. This will also be helpful for creating more precise bodies. In the documentation for SpriteKit they talk about a debugOverlay but the only example they give is to draw the direction of gravity. Here is the link: https://developer.apple.com/library/ios/documentation

Running out of memory in 'Other Processes' in Usage Comparion Xcode iOS9

拜拜、爱过 提交于 2019-12-10 03:41:39
问题 My app crashes on devices with 0.5GB memory. However, profiling memory usage in Xcode - it rarely goes above 140MB. I've used instruments to check leaks and there are none that are significant. However, when I run my app, the memory used by 'Other Processes' is always very high. This is the resting state after launching: I added a 1 second delay in each cycle of a loop in my code, and discovered that on each loop, the 'other processes' increases memory usage by about 3MB per object, until on

How to get the pressed keys in Swift

ε祈祈猫儿з 提交于 2019-12-10 03:31:52
问题 I am trying to learn the Swift language, and I followed a lot of tutorials on Youtube. Since most of them are for iOS, I wanted to make the OSX version of this one: https://www.youtube.com/watch?v=8PrVHrs10to (SideScroller game) I followed it carefully but I am stuck at about 22 minutes of the video when I have to update the player position. My first problem was to get the pressed keys. I come from C# language, so I wanted to find something like If(Keyboard.GetState().IsKeyDown(Keys.Right))

How to draw SKNode PhysicsBody for debugging?

寵の児 提交于 2019-12-10 03:28:48
问题 I create my SKPhysicsBody with rectangle from size, I set it to size of the node, but the collision detection does not work on good portion of the node. How do I draw the red frame around physics body? I tried using precise collision detection, but it doesn't help. I have checked some debug library but it draws only direct descendants of the scene, and my nodes are few levels deep. Author apparently doesn't know what recursion is. How do I draw red frame around physics body if my body is

Troubles using CGPathContainsPoint SWIFT

吃可爱长大的小学妹 提交于 2019-12-10 02:02:10
问题 I need to check if a CGPoint is inside a SKSpriteNode. After a little research, CGPathContainsPoint seems appropriated for my purpose. if CGPathContainsPoint(my_sprite_path, nil, my_point, false) { } But Xcode alerts me: Use of unresolved identifier CGPathContainsPoint I tried to import : import UIKit import CoreGraphics I'm using Xcode 8.0 beta 6. Did I miss anything? 回答1: As of Swift 3, many Core Graphics functions are now methods on the corresponding type. In your example: if my_sprite

Swift 3 (SpriteKit): Reseting GameScene doesn't deallocate

谁都会走 提交于 2019-12-10 00:16:27
问题 I have been trying to reset the GameScene by creating a new duplicate of the GameScene, which works. However, the problem is that the scene doesn't deallocate, which is definitely an issue since I profiled my app with Allocations and saw that the memory was 'clogging' and 'piling' up. This is my code for my GameViewController and my GameScene: import UIKit import SpriteKit import GameplayKit var screenSize = CGSize() class GameViewController: UIViewController { override func viewDidLoad() {

Color keying video with GPUImage on a SCNPlane in ARKit

南楼画角 提交于 2019-12-10 00:02:54
问题 I am trying to play a video, showing transparency in an ARSCNView . A SCNPlane is used as a projection space for the video and I am trying to color key this video with GPUImage . I followed this example here. Unfortunately, I have not found a way to project that video back on my videoSpriteKitNode . Because the filter is rendered in a GPUImageView , and the SKVideoNode takes a AVPlayer . I am not sure if it is possible at all, what I am trying to do, so if anyone could share their insight I'd

Use UIInterpolatingMotionEffect in SpriteKit?

五迷三道 提交于 2019-12-09 23:53:05
问题 UIInterpolatingMotionEffect is intended for use with UIView, but is there a possibility to use it within SpriteKit on a node ? If not, does someone has an idea to realize the effect another way. Thanks in advance 回答1: Creating a parallax effect in Sprite Kit can be achieved by creating a set of SKNode layers, adding sprites to the layers, and then moving each layer by a different amount when the user tilts the device. You can optionally scale the layers to give the illusion of depth. Here's