Thursday, January 21, 2016

Player Hit Effect

What's up today?

Not much! Actually not much in the way of results.. X_X  For the past couple days the resting animations have been kicking my ass.  They are hard.  The idea is since there won't be that many animations in the game, they should all be higher quality.  Also they are a little fan servicey, with panty shots or somewhat suggestive movements.  



This one was the original concept but the motion looks half finished.  Finding a way to push the motion further has been vexing.

Then an art buddy suggested trying a fresh attempt which resulted in this:


But this one looks like she should be on a dance floor.  Which is no surprise, the reference was a dancing girl.  There are some things appealing about it but overall I thought 'nope nope lets make it be a bouncy taekwondo style'



But that concept didn't really appeal to me either so I went back to the first one again.  And sunk another 5 hours into it.  I'm loving the art practice.  Art is hard and improving is fun.  I totally don't mind spending MONTHS just working on the art.  Time just flies by.

At which point I realized I need a 1 hr per day programming rule to make sure the project doesn't grind to a halt.

Nice, so what are we doing now?

Next we're going to do a somewhat easy (hopefully) hit reaction.  When the player is hit by a bottle there should be some reaction.  I don't want to do a reaction animation for each situation.  (Not yet) Instead we'll do one of those 'quick freeze and flashing white' things.  Maybe the player is invincible for a couple seconds after getting hit?  Nah.. That makes it too easy.

Sounds good, what's first?

Well-

Wait do you think people will be thrown off by this 'stream of consciousness' style question/answer format?

Yep definitely, which is why they should check out David Morrell's book http://www.amazon.com/The-Successful-Novelist-Lifetime-Publishing/dp/1402210558
and try it out for themselves, it's a very helpful tool to prevent all kinds of mental blocks.

Cool, so where were we?

First we gotta figure out how to make a white layer on top of our character sprite.  Sprites have a setColor() function so let's use that.

Hm.  

*Some time later*


Turns out that the set color function tints the sprite.. it's a little like a multiply layer in photoshop.  Which means we can't 'tint' white..




*Much time later*

Well shaders are a really interesting option..  Look at all this crazy nonsense: http://glslsandbox.com/

*Day later*

So we've got a shader set up that makes something very white-ish. I'm liking it.



I'm tempted to figure out how to throw a solid black outline on it but.. we'll leave that until much later

The code breakdown goes like:



The shader stuff is more than a little confusing and it's going to need a lot of time to for me to learn it. Definitely check out some Youtube tutorials.

What's next?

Now we gotta make it flash white..  We could use a nested timer like we did with the smoke animation.  We could.. hmm let's see how many flashes would look good.. Let's make a mock in Photoshop.


Yeah I guess 3 flashes at .1 seconds each looks good, but maybe 4 flashes is better.. somehow 3 doesn't feel like 3 right?  It feels like 2 unless you really look at it?  I'm not sure.. not sure.. hm..

What are you thinking?

I'm not sure if the player should be invincible for the .3 seconds after they get hit and If they are I'm not sure how that would affect the code design.  We could use an attribute on the character class 'FlashState' and we have a nested timer that turns it on and off every .1 seconds.  Or we could have a counter and count the time in the render method.  I guess the counter would use fewer resources but it's less appealing code-design wise.. For now let's go with not invincible.  


The Timer.Task needs to be cancelled before you can call it again, but that's fine it, it actually looks better than if the flashes were getting overlayed on top of each other.  (I guess)  Also the setShader method is apparently heavy and meshes are recommended, but I'm not sure how to go about creating a mesh for the sprite..  Something to look into when we get closer to the optimization phase

And here's the video of our progress!  Yep.. the trees are flashing.. because they are easier to see than our little stick man..


No comments:

Post a Comment