Topic:   intro + artillery game   (Read 43550 times)


0 Members and 1 Guest are viewing this topic.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: intro + artillery game
« Reply #45 on: January 13, 2012, 10:05:05 AM »
There's plenty of ways you could use the engine...
Hmm.
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Circuit


  • GMG-er

  • **


  • Posts: 299

  • blast from the past
Re: intro + artillery game
« Reply #46 on: January 13, 2012, 09:02:46 PM »
Thanks for explaining that Eq.  I've been trying to think of different ways to simulate physics in my game.  I like the basic control scheme, but the animation of the artillery shell isn't realistic, and the aiming just doesn't "feel" right to me.  I wish I knew more about physics.
« Last Edit: January 13, 2012, 09:05:36 PM by Circuit »

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: intro + artillery game
« Reply #47 on: January 13, 2012, 10:18:09 PM »
You know what? I'll try and convert a projectile motion thing I made in class for SC and get back to you.

EDIT: Won't be back in school until Monday which is too bad because we had a great, elegant way to do the equation that gives back the X and Y position as a function of time, angle and initial height and velocity.
Or maybe I can remember it. :/
« Last Edit: January 14, 2012, 07:01:18 PM by Connors »
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Circuit


  • GMG-er

  • **


  • Posts: 299

  • blast from the past
Re: intro + artillery game
« Reply #48 on: January 14, 2012, 07:36:57 PM »
Thanks, that would be helpful.  If you can't remember it right now, that's OK.

EqwanoX


  • Administrator

  • GMG Extraordinaire

  • *****


  • Posts: 1180
Re: intro + artillery game
« Reply #49 on: January 15, 2012, 02:07:52 PM »
i was able to add a simple ai but this was harder than i thought, i'm not good with math. the damage isnt completely accurate but it works. it checks to see if the center pixel of the tank sprite is within the damage box, the inaccurate part is that the box has corners where as the blast is circular, then i just ported over the controls from FreeThrow2k12

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: intro + artillery game
« Reply #50 on: January 15, 2012, 04:30:32 PM »
You guys can easily add the Distance Formula.

Gotta remember how to square something with SC though. Or there are workarounds.
If the distance is less than the radius of the explosion in pixels it hit. If you could improve it to work with the shape of the tank that's even better.
And does it use Circuit's explosion code? Because that makes proper nice round craters. :P
« Last Edit: January 15, 2012, 04:36:37 PM by Connors »
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Circuit


  • GMG-er

  • **


  • Posts: 299

  • blast from the past
Re: intro + artillery game
« Reply #51 on: January 15, 2012, 04:39:19 PM »
That's pretty good!  I like how the sliders keep their positions after you fire a shot, so that you can fire the same shot repeatedly.  My game doesn't have that.  Also, the AI isn't bad.  It seems very accurate at times.  You should make it so the AI's shots gradually get closer and closer to the player, the same way that a human plays the game.

I was gonna suggest using the distance formula (aka Pythagorean theorem) but Connors just barely beat me to it.  I wrote a method for this which uses the SQRT and POW commands.  Basically, call the method with the explosion XY coordinates and the tank XY coordinates as arguments.  The method returns the calculated distance.  If the distance is less than or equal to the explosion radius, it's a hit.  You can also make the amount of damage proportionate to the distance: closer = more damaging.
« Last Edit: January 15, 2012, 04:44:52 PM by Circuit »

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: intro + artillery game
« Reply #52 on: January 15, 2012, 04:55:01 PM »
So Tuesday I'll be able to copy the code I used for the "Zippy the Clown" assignment in which we do some calculations for shooting him out of a canon, and see when he hits the ground. XD
It uses the initial angle, velocity height and time in the air and returns both x and y. This will be fun.
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/