Hi all, i am currently learning lab 2 tutorial from walkerboystudio and it’s quite fun indeed…
i have finished the game but i want to add one variation more…
this is the game anyway:
http://hymoo.tv/testing-game-kapal/testing-game-kapal.html
please test it…when the player ship gets hit by the UFO, as you can see there’s no visual effect at all. I want the player ship to flash (blinking, like common 2d ship game)…how to do that?
Something like this is probably what you’re looking for:
public function blinkOut():IEnumerator {
var duration:float = .8;
var blinkTime:float = .1;
var renderers = gameObject.GetComponentsInChildren(Renderer);
for (var i = 0.0; i < 1.0; i += blinkTime * (1/duration)) {
for (var r:Renderer in renderers) {
r.enabled = !r.enabled;
}
yield new WaitForSeconds(blinkTime);
}
}
You can play with duration and blink time to get the desired effect and make sure that the renderers ultimately end up enabled.
Check out iTween. It has ColorTo and ColorFrom methods that, combined with its event callbacks, could easily be chained together to achieve the effect you’re looking for.
Ah, yeah for flashing colors something like iTween would work better. I mis-read your question. My method will completely turn on / off the renderers creating a blinking effect.
hi everyone, yes waitforseconds definitely not what i’m looking for…
this iTween seems like what i want for the animation but I honestly don’t understand how do I install this?
after unzipping the file what i get is simply one file iTween 2.cs, how do i put that into my unity?
(im using mac, but i do have windows too and i have unity there so I think it’s alright if i have to use this in windows - i prefer if it works in mac though)
If you’re writing in C# just drop the .cs file anywhere in your project and then you can reference it like you would any other static method. This is documented on their site.
I dont write in C# i write in js
*nvm, i didnt read their website. Now I will play with it, thanks.