Sunday, June 30, 2013

First real punch

I've been studying and testing for a while and I came out with a solution for the interaction (such as I give the punch and the opponent gets the hit). It will be a huge amount of code, if I stick on this solution, but it will be very precise. I tried to use the native functions for the collisions but they ain't work well because we are, anyway, in a 3D environment.
So I have to list all the combinations of action between the 2 players and determine what is what for each one when, obviously, the 2 players are close enough to each others.
At the moment I'm using the opponent as a sparring partner. I managed to do the first interaction which is the normal frontal punch (Z key) and a normal "got hit" animation. Moreover I added a kind of spark animation between the punch and the body which indicates the hit is given. I added also two different sounds: one from the opponent that gets hit and the other the normal sound of the hitting punch.
Here the screenshot of the first real given punch.

Uploading the screenshot I noticed the shadow of the challenger is slightly shifted to the left. Fixed just now.

Sunday time

Happy Sunday to everyone. I started this Sunday (I can't go out yet due to a local virus I've got) watching the F1 GP of Silverstone (great final part of the race) and relaxing a bit. Then I started coding again using as background music a compilation of Chris Hulsbeck (an great video game composer since the C64) which is very motivating.
I corrected several minor bugs and a little glitch which was making an animation flickering a bit. Now is nice and fluid. With a little trick and just 2 lines of code I now the shadow when jumping moves backward giving a very realistic effect. The shadow itself going backward goes also smaller (prospective) automatically because drawn in a 3d environment.
Now it is time to start to study the collisions.

Saturday, June 29, 2013

Flipping sprites commands and shadows!

Took me something like 5 hours of deep study and coding but we have the flipping sprites once they cross each others.
Making the visual flipping haven't been that hard but it took so much time to make all the routine to invert the commands (the action you normally do with punch+left for example now is done with punch+right) and to retouch all the code of the shadows that actually have to flip too! Fortunately thanks to a little trick I didn't have to use another set of sprites (same mirrored) but the same ones saving a lot of memory.
Now, finally, starts the interaction with the other bad guy which will be for very long time (till the AI will be developed - final step) just a sparring partner :D


Point of the situation so far

Ok in this exact moment we have 2 players on the screen, one just there (your opponent) but animated in standing position and with his own shadow. The other is your character controllable with the keyboard, with a good range of actions (not complete yet) and his own shadow. Animated background and 3D environment with lateral scrolling (parallax effect of the combat floor) and vertical scrolling when jumping.
So far so good.
From the picture you can see the presence of the 2nd character and the brand new shadow system.
Before to make the two opponents interact I need to make the routine that swap the players (and the controls) once they cross each others. I don't really know how to do it and how is realized in other games so i will start to study and analyze some other fighting games.

new shadows

I spent the whole day so far to rewrite the code for the shadows (which I just wrote yesterday). Before the shadow was basically an ellipse under the player's sprite more or less like in many other fighting games. I wanted to make real shadows, shadows that follow the physic rules and the character's movements. I was training and the idea about how to do that just came in my mind. After 3 hours of trying, coding, re-design we have dynamic shadows! The move along the main sprite movements and they change inclination depending where the sprite is comparing with the virtual pint of light. The effect in motion is amazing. Very happy about that.
I just placed another character sprite in the came...standing still...meaning I will start the interaction between fighters....hard part!

Friday, June 28, 2013

Defenses

I just added the defense with  the key "C". You can defend by standing and in low position. The defense has priority on all the other moves but don't let you (of course) attack. You can't defend yourself when jumping.
Seems to work just fine. It's almost time to make some interactions, from tomorrow I will start to work at the code to actually give pain to some other bad guy.
Time to sleep.

The character has a shadow

I added a shadow to the character. The shadow moves along the player sprite and it alternates 2 frames (so far): large shadow and normal shadow depending from the action of the player: in fact some character sprites are wider than others. Now is just 2 frames to see if the global effect works (and it does), we'll see later on if is the case to put some additional ones.

The image of the shadow has been created with the large use of the glow effect around a single black pixel: in this way we can see the shadow but there is the transparency necessary to create a realistic shadow effect.
In the screenshot you can see the glowing shadow (large one) while the character is kicking.