cocos2d screen effect - iphone

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.

Related

How do i make a 3d game pixel perfect? so that there is no anti aliasing or other filtering applied

This is what the game looks like in the 'game' window in unity, which is what it should look like https://ibb.co/xjst4vw achieved by removing all lighting including ambient lighting.
And this is what it looks once built https://ibb.co/4RcbMv8
Why is there a haze in the border between colors? How do I get it to be pixel perfect?
The aspect ratio of the in editor display is 160x144
I have change the game resolution by going to >edit >project setting >player and changing the height and width to the right size
The camera is also passing to a render texture which is of the right size, with the filter mode set to point.
I cant figure out what is causing this. to my knowledge All lighting is turned off. It looks like some up scaling error or maybe some sort of anti-aliasing effect which has also been turned off everywhere i could find.
Does anyone have an idea about what might be causing this? thanks.
There is postprocessing window in unity where you can specify such things like antyaliasing and so on. I think that this will make your game pixel perfect.
Found the answer to my own question the resolution in the >edit >project setting >player >resolution and presentation need to be as high res as it can be so in my case for a 1920x1080 screen it should 1120,1008 which is 160x144 scaled up by 7.
Then send data from you're main camera to a render texture that is set to the resolution you want (in my case 160x144) and create UI canvas that takes up the whole screen and a raw image as a child. Then put the render texture you created in the texture.

Scale UI buttons and images with screen size

I ma developing a game for unity and i want to be able to scale my buttons and UI elements to fit different screen sizes. Please how can i go about this? I have tried scale with screen size and it doesn't seem to help me. Is there a script i can use for this?
You will want to use a canvas scaler for this.
You simply attach this object to your canvas parenting your UI elements and it will scale them acordingly.
You will also want to make sure your UI elements are anchored correctly so that they stretch with their correct anchor point.

Unity Camera Target Texture Render Texture How To Get Masks To Work?

I'm looking at using Camera TartetTexture RenderTexture functionality for less processing intensive menu transitions but I'm having some trouble. Every texture I render out from the camera doesn't have masks working. I can see the whole version of every graphic on the screen. How can I get it rendering keeping the masks in tact? It is also failing to render any of my spawned prefabs. Either that or they could be hidden behind the unmasked graphics.
Also, I was told to render to a material. None of the shaders I've tried have supported the masks (don't know if that's really the problem) or have looked like the original image. They all look dark and moody, with the occasional weird alpha channel in the upper left corner. How can I get the image looking just like my screen?
My menus are all on a Screen Space - Overlay canvas, so they shouldn't need to be lit.

Transparent background affects text mesh in front

I have a plane behind a text mesh 3d that i use to make the text more visible. The plane is supposed to be slitghtly transparent but when i give it a transparent shader it starts acting like the pane is in front of the text when it actually is not. How can i fix this?
Okej i solved it using a canvas, TextMeshPro- text and as background i use a UI Image. That works as i intended.
Had the same problem and found the solution:
Go on the canvas, and increase "Order in layer" until it is fixed (if it doesn't work after like 4 or 5, sry it might be something else ^^')
If it works it simply meant that the UI text was rendered before the transparent material, so you wanna tell the canvas to render itself after the material.

How can I create a tile, overlay for a scene in Cocos2d?

I'm new to Cocos2d, but I can't seem to find the answer to this. I want to add an image that is mostly transparent as an overlay to my application. The image is overlayed on the app, and does not respond to screen taps. All gestures should "pass through" to the application.
The overlay image should actually be tiled. It's a small image that should repeat both horizontally and vertically.
How can I do this? In fact, this is an overlay that I would like to display for the duration of the entire application-- not just one specific scene. Is there a simple way to do this?
The point of my overlay is that I'd like to create a pseudo-scan line affect for a game which has an "8-bit" tone. The scan lines will be generated by applying the overlay to the game. The overlay is non-interactive and should always exist. So, this isn't a "tile based game", but I do need a tiling affect for this functionality.
You should be able to create a layer in each scene, set the zOrder to something large so that it overlays everything else, and set its isTouchEnabled attribute to NO. You can then add whatever you want to the layer, which could be your patterned image. To change the alpha, just set the opacity attribute of your image. The only issue that I can foresee is that the overlay might disable touch events for layers below it.