Scale a SKPhysicsBody, how?
If you assign a physics body to a sprite and scale that sprite, the physics body will scale with it.
SKAction scale physicsBody
If you set the size of the physicsbody to the size of the circle, you may achieve what you seek.
_circle = [SKSpriteNode spriteNodeWithImageNamed:@"cirlce"];
_circle.physicsBody = [SKPhysicsBody bodyWithCircleOfRadius:_circle.size.width/2];
Increasing the size of a spriteNode using spriteKit in update function (Swift)
Whoever told you to not use SKActions is wrong. This is exactly when you want to use an SKAction, and if you have multiple circles pulsing, you use the same action on all circles.
You really want to keep your update function as small as possible. Trust in apple’s optimizations because they have better access to the API than you do.
Change SpriteNode PhysicsBody Size at Run Time
According to SpriteKit documentation the area of a SKPhysicsBody can't be modified, so you need to create another SKPhysicsBody instance and copy the values you want to keep from the previous instance.
SpriteKit: Physics bodies breaking under too much force (applyForce)
The higher the nodes with physics bodies, the lower the framerate.
The lower the framerate, the crazier the engine gets. One time I've even see it make some kind of blackhole.
It'll help if you lessen the force against the wall, whether gravity, or velocity from applyforce. Also making sure there's enough space for them will help.
Using precise collision detection will even lessen the framerate further.
SpriteKit help understanding scaling
iPhone 6 is close enough in resolution to iPhone 5 that it's meant to use 2x images.
1136 x 640 - iphone5
1334 x 750 - iphone 6
Because your background is 640 pixels tall, it will have some space missing on the top and bottom in portrait mode. You need to make a background with areas that you don't mind being cut off on smaller devices (iphone 4 and 5). Or you need to have a black frame around your game on the iphone 6. I wouldn't recommend scaling every image..
This was a common issue even before iphone 6 was around. This image kind of shows what I'm talking about
http://cdn5.raywenderlich.com/wp-content/uploads/2013/09/Aspect-Ratio-Diff.jpg
Image Sizes
You need three image sizes.
@2x = iphone4s, 5, 5s, 6 (you use this for non retina ipads as well)
@3x (1.5 * 2x) = iphone 6 PLUS
@2x~ipad (2 * 2x) = ipad retina and retina mini
the way you want to organize this is up to you. In my game I split my images up into two sets of atlases. one for iPad and one for Iphone.
My way of organizing my atlases
Images with no suffix are for the non-retina ipads.
In my code I have a simple function to decide which texture atlas I want to load.
func getTextureAtlas(filename: String) -> SKTextureAtlas {
var name = filename
if UIDevice.currentDevice().userInterfaceIdiom != .Phone {
name = "\(name)-ipad"
}
return SKTextureAtlas(named: name)
}
example useage:
shipAtlas = getTextureAtlas("ship")
Related Topics
Non-Main Bundle File as Alert Sound
Expand Uitextview and Uitableview When Uitextview's Text Extends Beyond 1 Line
Creating a Rtsp Client for Live Audio and Video Broadcasting in Objective C
Gmsmapview Animatetocameraposition Zoom in - Zoom Out Animation
Change Duration (Speed) on a Running Animation
Stream Data from Network in Avaudioengine, Is It Possible
Change Splash Screen Image Programmatically
Add View as a Parameter to a Custom Viewmodifier
Cocoa Pods Install on iOS Project Not Working
Aes 128 Message Decryption -- Swift, iOS
Ruby: Loaderror - Library Not Found for Class Digest::Sha1 -- Digest/Sha1
How to Handle Usernotifications Actions in iOS 10
Dyld: Library Not Loaded: @Rpath/Mydsk.Framework/Mydsk -> Swift iOS 8.0
Crashing While Collection View Cell Deletion Because of "Uicollectionviewlayoutattributes"
How to Make Async/Await in Swift
Draw Button on Top of Avplayer
Which View Controller Should I Pass in My Swift Native Code for a Flutter Plugin