Reputation: 695
My light:
self.light = [[SKLightNode alloc] init];
self.light.categoryBitMask = 0;
self.light.falloff = 1;
self.light.ambientColor = [UIColor whiteColor];
self.light.lightColor = [[UIColor alloc] initWithRed:1.0 green:1.0 blue:0.0 alpha:0.5];
self.light.shadowColor = [[UIColor alloc] initWithRed:0.0 green:0.0 blue:0.0 alpha:0.3];
self.light.zPosition = 200;
[self.world addChild:self.light];
On Update I change light position to character position.
I tried everything and just can't see my light.
Upvotes: 1
Views: 685
Reputation: 883
Adding a light to a scene doesn't add a white circle, a light-bulb, or something like that to the scene, it just illuminates everything with that light. So you will not "see the light", just its effects.
If you want to see the shadows the light casts, you have to activate the shadows for each object that must cast shadows. You can do this for your SKNode with:
yourSKNode.shadowCastBitMask = 1
Finally, if you want to make a bump effect on something like a background, you must create the background using:
let background = SKSpriteNode(imageNamed: "theName", normalMapped: true)
background.lightingBitMask = 1
Upvotes: 1