Official Everybody Edits Forums

Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?

You are not logged in.

#1 2015-11-06 23:56:25

Jabatheblob1
Member
Joined: 2015-03-01
Posts: 856

Internal Assesment

Hello everyone, I need help. Not in a coding aspect exactly, I am beginning to make a game for my Ib Math Class, which is a lower level calculus class. I need to make a game kind of like apple shooter.
6vY1O4_SoiqVOeSnxlTrX75EhwR13QPJ4Wl-TuwWbrMlNbTabxUyZdoInPWfFQMPElJb5Jqk=s640-h400-e365
I need to be able to make a dotted line that tracks the players arrow with a quadratic formula(Or other formula), then i need the arrow to be a tangent line that will follow the quadratic function.
I cannot ask for help with the coding(Exact coding) but what i do need help with is a program to help me achieve this. I want to use c# to make it but i something to allow me to make the graphics easier. I know no program to do that or good programs to help me achieve this. Any input or help is welcome. //forums.everybodyedits.com/img/smilies/smile


If you would like me to make a bot for you, go here.

Offline

#2 2015-11-07 00:15:31

ewoke
Member
Joined: 2015-02-20
Posts: 412

Re: Internal Assesment

you could try using html5's canvas element


if you can read this....good for you

Offline

Wooted by:

#3 2015-11-07 08:56:27

hummerz5
Member
From: wait I'm not a secret mod huh
Joined: 2015-08-10
Posts: 5,853

Re: Internal Assesment

or C#... just do graphics
graphics paste the image
graphics paste the other image
oh, but you wanted animation?
nah, not so bad.
If you just want the equation, uhm... what is it?

honestly, I wanted to make this for EE (for like 1.5 minutes) but couldn't find the right formula for that whole right angle thing

please share cuz I can't google

Offline

#4 2015-11-07 13:11:58

Processor
Member
Joined: 2015-02-15
Posts: 2,246

Re: Internal Assesment

HOW THE BOB IS THIS RELATED TO EE? Moved to off-topic.


I have never thought of programming for reputation and honor. What I have in my heart must come out. That is the reason why I code.

Offline

#5 2015-11-07 19:36:42, last edited by hummerz5 (2015-11-07 19:37:13)

hummerz5
Member
From: wait I'm not a secret mod huh
Joined: 2015-08-10
Posts: 5,853

Re: Internal Assesment

Processor wrote:

HOW THE BOB IS THIS RELATED TO EE? Moved to off-topic.

hummerz5 wrote:

honestly, I wanted to make this for EE (for like 1.5 minutes) but couldn't find the right formula for that whole right angle thing

edit: misattributed quotations

Offline

#6 2015-11-08 08:35:15, last edited by Tako (2015-11-08 09:41:13)

Tako
Member
From: Memphis, Tennessee, USA
Joined: 2015-08-10
Posts: 6,663
Website

Re: Internal Assesment

This is how I would do the math side of this. Just a warning, it's a roller coaster.

If you start with the factored form of a concave-down quadratic, you can plug in the roots (0 and max distance, d):
png.latex?%5Cdpi%7B100%7D%20%5Cbg_black%20h%28t%29%20%3D%20-%28t%20-%200%29%28t%20-%20d%29

Then consider that the arc has variable height, and to stretch it vertically, you multiply the whole thing by some constant a:
png.latex?%5Cdpi%7B100%7D%20%5Cbg_black%20h%28t%29%20%3D%20-at%28t%20-%20d%29

Now, understand that a is not the maximum height. a is a constant that is proportional to the maximum height. To find the actual maximum height, we must find the derivative and set it equal to 0. That will give us the t value that, in conjunction with a, results in the maximum height.
png.latex?%5Cdpi%7B100%7D%20%5Cbg_black%20h%27%28t%29%20%3D%20-a%28t%20-%20d%29%20-%20at
png.latex?%5Cbg_black%200%20%3D%20-a%28t%20-%20d%29%20-%20at
png.latex?%5Cdpi%7B100%7D%20%5Cbg_black%20t%20%3D%20%5Cfrac%7Bd%7D%7B2%7D

This makes sense: the highest point is exactly halfway between the beginning and end, d/2. Plug that into the original equation to see what a is.
png.latex?%5Cdpi%7B100%7D%20%5Cbg_black%20h%28%5Cfrac%7Bd%7D%7B2%7D%29%20%3D%20a%28%5Cfrac%7Bd%7D%7B2%7D%29%5E2
png.latex?%5Cbg_black%20a%20%3D%20%5Cfrac%7Bh%28%5Cfrac%7Bd%7D%7B2%7D%29%7D%7B%28%5Cfrac%7Bd%7D%7B2%7D%29%5E2%7D

Now let's replace the a in the original with this value. Also, this may be a little confusing, but I'm going to replace h(d/2) with a different a that is equal to the maximum height.
png.latex?%5Cdpi%7B100%7D%20%5Cbg_black%20h%28t%29%20%3D%20-%5Cfrac%7Bat%7D%7B%28%5Cfrac%7Bd%7D%7B2%7D%29%5E2%7D%28t%20-%20d%29

Finally, consider that the arrow does not start from (0, 0) but (0, b) where b is the archer's height. Therefore we need to shift the graph up b.
png.latex?%5Cdpi%7B100%7D%20%5Cbg_black%20h%28t%29%20%3D%20-%5Cfrac%7Bat%7D%7B%28%5Cfrac%7Bd%7D%7B2%7D%29%5E2%7D%28t%20-%20d%29%20+%20b

And to recap:
h(t) is height
a is max height
b is height of person
d is the final distance*
t is time

* Since we shifted the graph up b units, the arrow will go a little further. To accommodate this, solve for d when h(t) = 0 (hardcore Algebra II). That solution will be the ACTUAL final distance (I'll call it "c"). I think you can replace d with (c - d) to fix this problem, but I can't really explain it.

Oh, wait, instead of adding b we need to stretch the entire graph horizontally and shift it left such that the y intercept is b and d and a are unaffected. It's 2:36 AM. I'm going to sleep. You're capable of doing that, right? Okay, great.


Yeah, well, you know that's just like, uh, your opinion, man.

Offline

Wooted by:
Tako1446968115556440

Board footer

Powered by FluxBB

[ Started around 1735311072.1204 - Generated in 0.033 seconds, 12 queries executed - Memory usage: 1.46 MiB (Peak: 1.61 MiB) ]