Reputation: 836
Does anyone have any good ideas of how to accomplish a slow motion effect in Sprite Kit for iOS? This would make all nodes including particle nodes move at 1/2 the speed and also make the particles move that 1/2 the speed.
I can think of how to do this manually, but I wanted to get some more ideas before I start implementing.
Upvotes: 7
Views: 1781
Reputation: 1726
I believe you can do:
self.physicsWorld.speed = 0.5;
The docs reference:
speed
The rate at which the simulation executes.
@property(nonatomic) CGFloat speed Discussion The default value is 1.0, which means the simulation runs at normal speed. A value other than the default changes the rate at which time passes in the physics simulation. For example, a speed value of 2.0 indicates that time in the physics simulation passes twice as fast as the scene’s simulation time. A value of 0.0 pauses the physics simulation.
Availability Available in iOS 7.0 and later. Declared In SKPhysicsWorld.h
Upvotes: 9
Reputation: 5795
In update method where you calculate movement speed everywhere when calculations are done multiply the movement by some variable, have it be 1 by default. But when you need slow motion set it to 0.5.
Upvotes: 4