Easy way to make an SKLabelNode non-transparent background? - sprite-kit

Is there an easy way to make an SKLabelNode non-transparent, so that the bounding frame is solid and covers the background scene?
I know I can add another sprite and float the text over it, but I'm just wondering if I'm missing some obvious built-in way to do this?

Related

Border around the image within an NSImageView

I have an NSImageView which contains an image. Is there a simple way to draw a border around just the image (which might be smaller than the NSImageView), and not the entire NSImageView?
[Answering my own question.]
On the off chance that someone comes cross this page looking to get something similar done, a simple way to do it is by using a wrapper view, and setting a border on the inner view.

Adjust Sprite's Brightness

I have a button which when touched, I would like it to shrink and darken slightly. It's easy enough to shrink the button (SKAction.scaleTo), but I can't seem to find a way of darkening it (I'm not actually sure if it is possible to darken a sprite with an SKAction).
I can add a solid black sprite over the top of the button and adjust the alpha to darken when touched, but before I implement this into my code, I just wanted to make sure there wasn't something simpler available that I just haven't discovered yet.
SKAction.colorizeWithColor or SKAction.colorizeWithBlendFactor may help you

Cocos2d mask layer (tilemap lighting)

I'm trying to add lighting to a certain extent within my tilemap based iPhone game. For lack of a better example, I'm trying to add minecraft style lighting - the further a tile is from the light source the greater "dark" tint it has.
The most efficient way I can think of doing this would be to add some type of mask over the tilemap layer in order to create this effect and simply move the masks with the tilemap as the player moves around.
I haven't been able to find any documentation on how to add masks to an entire layer, is this possible? Or is it bad practice? Or can you think of a better possible method for achieving this effect?
The simplest and most efficient solution would be to modify the color property of a tile. By default all nodes have the color "white" and by applying gray colors between black & white you'll be able to control the brightness of the tile.
Note however that when you do treat a tile like a CCSprite, cocos2d will change the tile from its basic implementation and change it into a CCSprite. This may become a performance and/or memory issue. Each CCSprite instance was 420 Bytes last time I checked in cocos2d 0.99.

how to unveil a picture in andengine

Recently i discovered andengine and I'm playing a little with it.
I would like to put a picture in background and cover it with a solid colored rectangle, and be able to cut out polygon shaped parts from the rectangle to unveil the portion of the underlying picture corresponding to that polygon... I hope I explained myself.
I'm not focusing on the polygon shape, it could also be a rectangle or a circle.
Thx in advance for your suggestions
this is a more complex problem than it sounds.
You could play around with some uncommon Blendfunctions. This could work like drawing the uncovered polygons first and blending the image only where there is a high saturation or so...
Alternatively you would seek for sth like a RenderTexture and dynamically make it more transparent where it is touched. This requires the FBO Extension, which is a core part of GLES2 and optional on GLES1.
I hope this helped :-)
Best Regards,
Nicolas

cocos2d screen effect

I am working on my iPhone game using cocos2d. I want to implement the effect: when my hero dies, the screen gradually turns to black/white/grey. That is, all the UI elements and game sprites' color turn black/white/grey. Could anyone tell me how to do that? I have tried to add a CCColorLayer as a mask, but that doesn't look good. And if you add another image for each elements, the size of the app will double. So any other methods to do this?
Have you tried CCTintby ?
http://www.cocos2d-iphone.org/api-ref/0.99.5/interface_c_c_tint_by.html
It tint's sprites by a colour. You could do it on every child of your gameLayer.
Maybe you can render your scene to a texture and then manually convert the texture's pixels color to gray. Then render the texture to the screen.