
-----------------------------------
RaLz
Mon May 26, 2003 3:56 pm

Parabola bullet thing
-----------------------------------
ok im making that one tank game where there are two tanks on bothsides and you shoot a bullet and it has to make an arch shape to get to the other side and hit the other tank.
Now i know im supposed to use a parabola for the bullet but i am bad at math and i don't know where to start so if someone could please do the bullet process for me or help me out that would be great. It needs to include how much power the shot is going to have and altitude.

-----------------------------------
AsianSensation
Mon May 26, 2003 4:14 pm


-----------------------------------
Projectile_Posx := Projectile_Velocity * cosd (Angle) * Projectile_Time 
Projectile_Posy := (-1 / 2) * Gravity * Projectile_Time ** 2 + Projectile_Velocity * sind (Angle) * Projectile_Time 

it's the coordinates for the projectile, put it in a loop, increase the time variable each loop, and u should have it. I also have the equation that involves air-resistance, if you want it, i'll post it up.

-----------------------------------
RaLz
Mon May 26, 2003 6:53 pm


-----------------------------------
yea that would be cool if you could

-----------------------------------
RaLz
Mon May 26, 2003 6:56 pm


-----------------------------------
also it would be cool if you could explain that code to me cuz i don't get any of it

-----------------------------------
void
Mon May 26, 2003 8:43 pm


-----------------------------------
basic projectile physics:
x= v*cos*theta*t
y=v*sin*theta-g*t^2/2

v=velocity
cos and sin are constants (use sind and cosd when ur doing it in turing)
t= time
g= gravity (i think its 9.8 or 9.3 m/ s^2)
theta= angle at which the projectile is shot
x= x-co ordinate
y= y- co ordinate
but yea....if you dont understand that...you should go ask your math teacher...they'll prolly help you better AND they will think ur a smart kid and boost your mark a good 3-4 %  :D  any more help..just ask

-----------------------------------
RaLz
Mon May 26, 2003 8:46 pm


-----------------------------------
thanx douchie

-----------------------------------
void
Mon May 26, 2003 8:51 pm


-----------------------------------
yo!!.. who da blu...wiyado...who is this kid!!! and how does he know who i am...(only people i know can mess up my name like that and get away with it!!) lol..yea..who is this?

-----------------------------------
Homer_simpson
Mon May 26, 2003 8:52 pm


-----------------------------------
oh that's some cool formula :D  8) 
good to know...=)

-----------------------------------
RaLz
Mon May 26, 2003 8:53 pm


-----------------------------------
Ok i don't get what the projectile time has to do with it

-----------------------------------
RaLz
Mon May 26, 2003 8:55 pm


-----------------------------------
its Raheel

-----------------------------------
void
Mon May 26, 2003 8:56 pm


-----------------------------------
how long it takes to get from the initial launching point to reach the landing point....just make time a constant...its better that way/......WHO ARE YOU?!?!?!?!?....TELL ME...BEFORE I KILLL YOU (that was not a threat)

-----------------------------------
Homer_simpson
Mon May 26, 2003 9:02 pm


-----------------------------------
ok... i tried using it in turing... one problem...
how do u multiply sine or cos in the formula?

-----------------------------------
void
Mon May 26, 2003 9:15 pm


-----------------------------------

var x, y, th : real
const v := 9
const t := 1
const g := 9.8
th := 12
x := v * cosd (th) * t
y := v * sind (th) * t - g * t ** 2 / 2

now the only problem is making x and y back into integers so i can locate with themm.....

-----------------------------------
AsianSensation
Mon May 26, 2003 9:23 pm


-----------------------------------
x := cosd(angle) + (mass * velocity * cosd(angle) / air resistance) * (1 - e**(-air resistance * time / mass)) 

y := sind(angle) - (mass * gravity * time / air resistance)+((mass * velocity * sind(angle) / air resistance) + (mass**2 * gravity / (air resistance**2))) * (1 - e**(-air resistance * time / mass))

http://www.phy.davidson.edu/StuHome/jocampbell/projectile/projectile.htm

I think that web site give u the equation and maybe some explaination for it.

-----------------------------------
RaLz
Mon May 26, 2003 9:35 pm


-----------------------------------
Yeahhhh this game has gotten wayy to complicated for me since iam onlin gr 10 and ihaven't learnt that much physics i will prolly not be able to do this. So any other suggestions cuz i thought this game wouldn't be this hard

-----------------------------------
Homer_simpson
Mon May 26, 2003 9:38 pm


-----------------------------------
so this would be the code:
var x, y, th : real
const v := 50
var t := 1.0
const g := 9.8
th := 45

loop
    t += .1
    x := v * cosd (th) * t
    y := v * sind (th) * t - g * t ** 2 / 2
    drawfilloval (round (x) + 100, round (y) + 200, 5, 5, 12)
    delay (50)
    drawfilloval (round (x) + 100, round (y) + 200, 5, 5, white)
    drawdot (round (x) + 100, round (y) + 200 + 6, 9)
    exit when t >= 10
end loop


-----------------------------------
AsianSensation
Mon May 26, 2003 9:40 pm


-----------------------------------
well, u don't really have to understand it to use it. I mean, it's just plugging in the numbers and constants and producing a value(personally, I'm in grade 10 too, and I manage to learn a bit of physics myself, but not that much, and I just plugged in numbers). But if you think this is too hard, then you could just make a cursor, and have the tanks shoot in whatever direction ur cursor in pointing at.

-----------------------------------
void
Mon May 26, 2003 9:50 pm


-----------------------------------
oky...time to teach a few rules of thumb
#1- age doesnt affect knowledge
#2- when a gr.10 is doing a summative, (s)he is not gonna program AIR RESISTANCE into the game
#3- NEVER, EVER, EVER MAKE THINGS CONFUSING he asked how to do simple projectile, not a whole re-enactment so that nasa can plot a chart of how a bullet travels and then crate an ultimate bullet that isnt affected by petty things such as air resistance

-----------------------------------
RaLz
Mon May 26, 2003 9:52 pm


-----------------------------------
yea i wanted to use the arrow keys and just increase the value and decreease the angle
and then have like up and down be the power the bullet is shot at

-----------------------------------
Homer_simpson
Mon May 26, 2003 9:54 pm


-----------------------------------
or this ....  8) 
View.Set ("graphics:3000;900")
var x, y, th : real
var v := 80
var t := 1.0
const g := 9.8
th := 45
var xx := 0
var x2 := 0
var bounce := 20
loop
    t += .1
    x := v * cosd (th) * t
    y := v * sind (th) * t - g * t ** 2 / 2
    if y = 20 or v 