2 Replies Latest reply on Sep 17, 2007 1:11 PM by 300thnickattempt

# Tanks/Towers/Catapults

Hello everybody, I'm relatively experience with flash and coding. I'm right about to start on a small game project that's along the lines of those old games where 2 tanks face off and each player must input the power and angle of attack and "walk-in" their shots before their opponent does the same. It's the same basic principle that I'm looking for for my game but I wanted some advice for where to begin. I'm mostly confused at about how to approach the code for the shot itself.

I have been reading the flash manual about this and I see that I for sure need to incorporate trig, but which of the three I'm unsure of yet. In looking at any given sin wave, I see that the path which I am after lies along the top half of the y-axis (on a standard grid). I'm a little confused about how I'd trap my code to only have the object follow the upper part of the curve and not have the shots loop under and come back up. I don't want to attempt a collision call on this quite yet as I'm worried about variations in positions and heights of the attacking objects.

My concern is that if my tank is raised up near the top of the screen and I'm firing on a tank that's well below that height, I will get strange results once the bullet comes back down to the same height as my tank. Like it will wave up and down because it's not terminating.

Do I have to do some special code to get the initial launch and then incorporate some form of gravity accelleration to achieve this parabollic arc path? Any advice (or free code :) ) would be great in helping me get started.

Does my question make sense? Basically I need help with the code to get that power/angle-LOBB effect on the bullets.

Thanks,
Pawz

• ###### 1. Re: Tanks/Towers/Catapults
Hello,
I suggest you should look up some physics 12 formulas, especially for projectiles, and kinematics (in 2 dimensions). I’ve coded 2d tank shooters and 3d tank shooters before, and the formulas I needed are under those 2 topics.
• ###### 2. Re: Tanks/Towers/Catapults
Thank you, I will start my research now.