简体   繁体   中英

how to dissolve a sprite into pixels using cocos2d-x?

i have a LOGO image and i want to dissolve it into small square pixels images from down to top of the Logo image with fade in action and Logo remove completely then my game start. how can i do it in cocos2d-x v3 using C++ coding or any other way?Thanks in advance.

There's nothing in this code just to have permission to ask question i made it just like that.

CCAction *fadeIn = [CCFadeTo actionWithDuration:0.5 opacity:0.5];
CCAction *fadeOut = [CCFadeTo actionWithDuration:0.5 opacity:1.0];
CCSequence *pulseSequence = [CCSequence actions:[fadeIn copy],[fadeOut copy], nil];

I think your only method here to TRULY have the logo dissolve into pixels, will be brute force, which will mean rebuilding the logo one pixel at a time by adding single pixels sprites onto a layer, so instead of logo.png you have a ton of whitepixel.png redpixel.png etc, then send them into action. Depending on how fast it dissolves, this would work (although rebuilding the logo with pixel art will take a long time, i'd recommend doing it with a pixel matrix and write a function to place the sprites).

Alternatively, you can fake it by simply slowly covering/obscuring/fading the sprite top to bottom and spitting particles out along the wipe line. If you want it to un-print slowly one line at a time, you'd need 2 obscuring images, one to cover vertically as you go line by line, one to be wiping the next line horizontally. This would be much easier to demonstrate via video, add my Skype reduxde if you want and I can show you with some construction paper.

I'm bad with particles, but as long as you're picking particles that match the colors in the logo, most peoples eyes won't be able to track it to realize the pixels aren't a 1:1 match up.

For a logo that's say 160 by 100 pixels though, you're talking 16,000 sprites by the brute force method, which will undoubtedly lag out your devices (I've managed to get about 700-800 sprites in motion before until the engine chugs).

Probably your best bet would be to hire a graphic artist and do this as an animation using a sequence of photos (which would be choppy compared to a true dissolve).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM