Another day, another dollar…

Status update:

Implemented the dual weapon system with some minor AI.  Enemies will only carry 1 weapon (Except maybe later grenades + weapon), and have unlimited ammo.  Players will now use whichever weapon has range, and then if the enemy comes closer switch to the shorter range weapon.  If the player has grenades and the enemy steps within range, the player will automatically arm grenades.

Heavy weapons and grenades have limited ammo: if the player runs out they will swap to another weapon.  If that other weapon was also a grenade/heavy, they will swap to a default pistol.  (Which was a pain, creating stats for a weapon that the player doesn’t “have”, so they can’t sell it for a weird, endless cash bug…)

Working with my talented artist, all weapons now have a reload animation, and those were edited and hooked up.  Reloading takes as long as the animation, plus the cool down of the weapon.  They look brilliant, by the way. :)

Besides having retarded AI, combat is pretty much done, in its basic form.  Time to move to formations, research, base management, story telling elements, leveling, interface, polishing and balancing…..

Whew!

Producer, Director, Programmer, Manager

Short update:  Reviewed and gave further direction to my music and art teams.  (ie, the music guy and the art guy.)

Working with some very skilled individuals, and just finished negotiations with the sound guy.  Will provide some examples later when it gets further along, but very excited.

My art guy is working non-stop, as he’s leaving for vacation soon and I want him to do as much as he could so I can continue my work.  But here’s an example of what he cooked up yesterday:

Ghost walking

It’s a joy working with him.  Today has been an admin day.

Progress

Alrighty, short overview of today:

Finished grenade arc.

Implemented grenade explosion damage.

Doesn’t seem like much, but doing the grenade damage was difficult.  Given the entire system is mocked up for 1 on 1 shooting, basically the grenade does a sweep of all the people in range and shoots at them.  Even worse, I had programmed it so that distance checks were only calculated between soldiers, so I had to create a phantom soldier per grenade blast…

Long story short, grenades now work!  Up next?  Bazookas if I’m ambitious, a bit of a break if I’m not…

 

The Life of a Programmer/Designer

Alright.  So I got a bunch done today.

I added Bazooka shooting animations, added enemy machine gun animations, updated this website, created a combat scene, cut apart the explosion animations, created a new animation library for explosions, created a new sprite library for explosions, rockets, grenades, then I programmed the grenade object, the explosion object, the code to throw a grenade…

It’s been a long day.

But what got me caught up for an hour or two was getting the fake 3D, 2D grenade parabola correct.

It started out simple.  2 second throw, so take the start, take the end, divide by two, use that speed as the translation.  Great if you want to throw the grenade at the enemy like a fast ball.

Now, add a gravity like parabola?  On TOP of that linear motion, because in 2.5D that 2 dimensional move is just supposed to be the X…?

Well, I added a sine curve on top of the position each frame, but then that made the grenade just fly off into space.  Ah, adding every frame is taking the integral of the sine curve, which of course keeps growing.  So we need to add the difference.  But oh, hey, just in case it wasn’t confusing enough, the standard sin function is in radians, so make sure you remember your degrees to radians conversions.  And then remember you want the sine to divide by two because of the 2 second flight time.  And don’t forget that you want this to be frame dependent speed, so make sure to play with Time.deltaTime…  Anyways, at one point the line of code was like this:

transform.position.y += (Time.deltaTime * 10 * Mathf.Sin((Time.time – throwStartTime)/2)*Mathf.PI) – (Time.deltaTime * 10 * Mathf.Sin((Time.time – throwStartTime + Time.deltaTime)/2)*Mathf.PI);

See what I did there?  I hope not.  If so, please go make your own game.  Or work for me cheap.

Anyways, finally got it working after beating my (admittedly non-engineery) head against a wall for a while.  Here’s final code:

var arc : float;

//Flat travel variables

transform.position.x += Time.deltaTime * xspeed;

transform.position.y += Time.deltaTime * yspeed;

//Parabolic arc for Y

arc = 5*Mathf.Sin((Time.time – throwStartTime)/2*Mathf.PI) – prevYHeight;

transform.position.y += arc;

prevYHeight = 5*Mathf.Sin((Time.time – throwStartTime)/2*Mathf.PI);

Admittedly, after two seconds the grenades curve up amusingly, as per the sine curved, but I’ll handle that in a bit…

Hello world!

Ah, Hello World.  The classic programming introduction.

Anyways, thus begins the website of War Heroes, the greatest game to come to iOS!  Ever!  Forever!…

Or, at least here begins what information I can get to you about the game as I attempt to program, manage art, UI, etc, etc, etc…

May there be mercy on my soul. -.-