Moving in an Arc?!
Author |
Message |
mike200015
|
Posted: Sat Feb 05, 2005 12:40 pm Post subject: Moving in an Arc?! |
|
|
Is there a way to make sumthing move in an arc shape, i made a sun move across the sky , but it jus goes in a triangle shape, but i want it to go more like an arc. Heres the code:
code: |
var x2, y2 : int
x2 := 0
y2 := 40
colourback(brightblue)
%Sun Rising
for i : 1 .. 36
setscreen ("offscreenonly")
View.Update
cls
%sun
drawfilloval (x2, y2, 20, 20, yellow)
x2 += 8
y2 += 10
delay (300)
end for
for i : 1 .. 36
setscreen ("offscreenonly")
View.Update
cls
%sun
drawfilloval (x2, y2, 20, 20, yellow)
x2 += 8
y2 -= 10
delay (300)
end for |
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Bacchus
|
Posted: Sat Feb 05, 2005 3:15 pm Post subject: (No subject) |
|
|
parabolas, do a search for topics made by Homer_Simpson, hes probably the best on the subject for parabolas in turing (that i kno of) |
|
|
|
|
|
Neo
|
Posted: Sat Feb 05, 2005 3:38 pm Post subject: (No subject) |
|
|
Bacchus wrote: parabolas, do a search for topics made by Homer_Simpson, hes probably the best on the subject for parabolas in turing (that i kno of)
Actually all you have to know is a bit of grade 10 math.
code: |
var x, y := 0.0
setscreen ("offscreenonly")
colourback (black)
loop
cls
y := -.002 * (x - 320) ** 2 + 180
x += 1
drawfilloval (round (x), round (y), 20, 20, yellow)
if y < 0 then
x := 50.0
end if
View.Update
delay (5)
end loop
|
|
|
|
|
|
|
Bacchus
|
Posted: Sat Feb 05, 2005 3:56 pm Post subject: (No subject) |
|
|
ya unless you cant remember ne math cause u havent had it for about a year lol |
|
|
|
|
|
Andy
|
Posted: Sat Feb 05, 2005 4:00 pm Post subject: (No subject) |
|
|
law of the locus |
|
|
|
|
|
mike200015
|
Posted: Sat Feb 05, 2005 5:49 pm Post subject: (No subject) |
|
|
Neo wrote: Bacchus wrote: parabolas, do a search for topics made by Homer_Simpson, hes probably the best on the subject for parabolas in turing (that i kno of)
Actually all you have to know is a bit of grade 10 math.
code: |
var x, y := 0.0
setscreen ("offscreenonly")
colourback (black)
loop
cls
y := -.002 * (x - 320) ** 2 + 180
x += 1
drawfilloval (round (x), round (y), 20, 20, yellow)
if y < 0 then
x := 50.0
end if
View.Update
delay (5)
end loop
|
hey thank you very much neo, it works really well! |
|
|
|
|
|
TheZsterBunny
|
Posted: Sun Feb 06, 2005 4:38 pm Post subject: (No subject) |
|
|
lol. i had white for grade 10 math. can't remember a word of it. ^_^;
someone care to do a quick review on parabolas?
-Z |
|
|
|
|
|
mike200015
|
Posted: Tue Feb 08, 2005 5:16 pm Post subject: (No subject) |
|
|
Neo wrote: Bacchus wrote: parabolas, do a search for topics made by Homer_Simpson, hes probably the best on the subject for parabolas in turing (that i kno of)
Actually all you have to know is a bit of grade 10 math.
code: |
var x, y := 0.0
setscreen ("offscreenonly")
colourback (black)
loop
cls
y := -.002 * (x - 320) ** 2 + 180
x += 1
drawfilloval (round (x), round (y), 20, 20, yellow)
if y < 0 then
x := 50.0
end if
View.Update
delay (5)
end loop
|
what does that mean. the y:= -.002... how does it curve, i never learnt that? can anyone explain that |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Cervantes
|
Posted: Tue Feb 08, 2005 5:50 pm Post subject: (No subject) |
|
|
f(x) = a(x - p)^2 + q
a represents the "vertical stretch" or "vertical compression". A value > 1 will vertically stretch the parabola. A value between 0 and 1 will make the parabola compressed vertically. This can also be looked at as being stretched vertically. (Note that a cannot = 0) If a > 0, the parabola will "open upwards", meaning that it looks like a U. If a < 0, the parabola will "open downwards", meaning that it looks like an n.
In Neo's code, -.002 is the value for a. Changing it should yield a parabola that is vertically stretched or compressed.
I'm assuming that this code,
code: |
if y < 0 then
x := 50.0
end if
|
is trying to reset the parabola so the ball will move across the screen again. Mind you, it tends to screw things up if you change a to some other value.
-Cervantes |
|
|
|
|
|
mike200015
|
Posted: Thu Feb 10, 2005 1:09 pm Post subject: (No subject) |
|
|
got it.. thnx cervantes.. 1 more thing tho, what does the rest mean..
(x - 320) ** 2 + 180 |
|
|
|
|
|
zylum
|
Posted: Thu Feb 10, 2005 4:28 pm Post subject: (No subject) |
|
|
p is the y of the vertex and q is the x. |
|
|
|
|
|
Drakain Zeil
|
Posted: Sat Feb 12, 2005 8:55 am Post subject: (No subject) |
|
|
Paroblas are in the form f(x)=x^2
Just change your position on the X axis, by subbing in that number to the function, and you have your y-position, you can move in an arc.
There's elipses, circles and hyperbola are also, but those aren't functions and therefore you have somthing harder to stay in line with any consistancy.. errors could occur, etc. |
|
|
|
|
|
ssr
|
Posted: Sat Feb 12, 2005 10:32 pm Post subject: (No subject) |
|
|
LOL
Im just learning parabolas right now.
it was pretty ok.
Right now, I wanted to make some game like a guy jump and comes down, tnx for this topic guys |
|
|
|
|
|
Drakain Zeil
|
Posted: Sun Feb 13, 2005 11:31 am Post subject: (No subject) |
|
|
Ah, paroblas, once you get into 11/12 math, you'll laugh at "how hard" some of the math you did back then... y=mx+b is what we do in one step now, at the time it seems so complex.
Something to be said about the teaching done there eh?
Oh, all of those "soccer slimes" that lots of people play, use paroblas too.. if you don't know what I'm taking about, don't worry about it. |
|
|
|
|
|
ssr
|
Posted: Sun Feb 13, 2005 1:12 pm Post subject: (No subject) |
|
|
This is kinda spam, but ya, I do agree with u,Drakain Zeil |
|
|
|
|
|
|
|