Results 1 to 12 of 12

Thread: Gravity script

  1. #1
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default Gravity script

    Im making a script for the game Zwok.
    I want the script to find out where the ball is landing.

    I found this cool gravity-script made by Zup (http://www.srl-forums.com/forum/gravity-t904.html?t=904 DO NOT POST! THE THREAD IS OLD!) and uses that as a source to find out where its goind to land. But i need help. Please make the whole Gravity; procedure if you want to.

    The thing is: use your chars position (ManX, ManY) and find ur mouse position (MouseX, MouseY), then find out what ball you are using (becase theres different gravity on them) and paint the path (on the client using GetClientCanvas.Pixels[MouseX, MouseY] := 255; )

    - Zytex.

  2. #2
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Bump

    I know this is a double post, but since no one posted here in 1 day, i post this.

    Anyone who can help me?

  3. #3
    Join Date
    Apr 2007
    Posts
    994
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    It's going to be hard, because There is a time limit for each turn.
    [QUOTE]<GoF`> oh no its Raymooond
    <Raymooond> Heya
    <GoF`> is it ray or some other ray?
    <LeeLokHin> No idea
    <LeeLokHin> Raymond, what's the game you like the most?
    <Raymooond> Runescape
    <-- LeeLokHin has kicked Raymooond from #srl (Faker.)[/QUOTE]

  4. #4
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Yes 10 secs, but it takes about 2 secounds to paint the line. I only do this for practise...

  5. #5
    Join Date
    Apr 2008
    Location
    Northwest england
    Posts
    1,179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    well the speed of excearation due to the earths gravity with no other forces acting up on an object is 9.81Ms^-2
    Blank!

  6. #6
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    But do you think this game cares about that?

    I already found out that the Normal and Rollers gravity is the same.

  7. #7
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Double post again...

    No one posts.. Please someone help me!
    Why is this always happening to meeeee?!

  8. #8
    Join Date
    Oct 2006
    Location
    finland, helsinki
    Posts
    2,501
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    you would have to get the length of the arrow and based on that add a "speed" value to the gravity value which u also have to use math to get.

    Code:
    • Narcle: I recall Jukka releasing a bunch of scripts like this before... Its how he rolls I think. rofl
    • Solarwind: Dude, you are like... t3h s3x.
    • Hy71194: JuKKa you're a machine! You released 3 scripts in 10 minutes! :O
    • benjaa: woah.... Jukka is the man Guildminer pwns all
    • NaumanAkhlaQ: And JuKKa Is my Her0!

  9. #9
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    The length of the arrow.. Hmm.. If the script writes the path when the arrow is at the biggest, then u dont need to shot when the arrow <> biggest..

    And the gravity is simple, the normal ball is about 0.6 or so, and the bounce is like 0.875... I just do some test and see if the gravity is right, if not, then i change it.

    Not THAT hard JuKKa

  10. #10
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    BUMP!

    Anyone?

  11. #11
    Join Date
    Jul 2008
    Location
    California
    Posts
    255
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Alright my internet's being retarted and I cannot load the game.

    I'm a nerd. I love physics. BUT.. before I can answer your question, I need a couple of answers. stupid internet.

    1) Does the ball accellerate from side to side? (left to right/right to left?)

    2) Does anything interfere with the ball's path while it is in motion? If so, it will require more calculations.

    3) Are you given enough space and time for you to capture the balls location at 2 instances to calculate it's velocity?


    This is very basic physics. If the ball does not accellerate from side to side, then all you need to do is calculate how far it will go in the time that it takes the ball to fall.

    You said that you have already gotten the amount of gravity. Good; less for me to explain.

    So, You take difference in Y value (height) from the ball to the ground and you calculate how long it will take the ball to fall that distance (with gravitational accelleration...)
    Code:
    ---Formula:       //NOTE this ONLY works if you are starting the ball from a height with absolutely NO downward velocity.
    t = sqrt((2 * h) / g)
    t = time
    sqrt = the square root of()
    (2 * h) = 2 times the height of the ball (difference in y value)
    /g = divided by the accelleration, or gravity.
    -----------
    All you need to do fill in the approporate variables to this equation and you will have calculated the time it takes to fall.

    Now what you need to do is calculate how far side to side it will travel within that given time. If there is no side to side accelleration it is very easy:

    Code:
    ---Formula:
    x = v * t
    x = distance
    v = velocity
    t = time
    -------------------
    However if there is any accelleration you need to use this formula:
    Code:
    ---Formula:
    X = (Vo * t) + (1/2 * a * t^2)
    x = distance
    Vo = original velocity
    t = time
    a = accelleration
    t^2 = time raised to the power of 2.
    By doing this you will calculate how far to the left or to the right of the original position the ball will travel BEFORE it touches the ground (where it hits the ground)

    If you need further help, PM me and we'll work something out. It's VERY difficult to explain all of this in text.

    Hope I helped.



    *EDIT*
    Waddo:
    well the speed of excearation due to the earths gravity with no other forces acting up on an object is 9.81Ms^-2
    It is not 9.81Ms^-2... Well it is, but thats typed all wrong and has a completely different meaning to it. The way you typed it, it sounds like it is 9.81 Milliseconds raised to the power of -2.
    It is actually 9.8066(rounded to 9.81)m / (s^2). Here it is 9.8066 meters per second squared. as I said.. I love physics...
    Unfortunately, no active scripts atm.

  12. #12
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Quote Originally Posted by doom0791 View Post
    Alright my internet's being retarted and I cannot load the game.

    I'm a nerd. I love physics. BUT.. before I can answer your question, I need a couple of answers. stupid internet.

    1) Does the ball accellerate from side to side? (left to right/right to left?)

    2) Does anything interfere with the ball's path while it is in motion? If so, it will require more calculations.

    3) Are you given enough space and time for you to capture the balls location at 2 instances to calculate it's velocity?


    This is very basic physics. If the ball does not accellerate from side to side, then all you need to do is calculate how far it will go in the time that it takes the ball to fall.

    You said that you have already gotten the amount of gravity. Good; less for me to explain.

    So, You take difference in Y value (height) from the ball to the ground and you calculate how long it will take the ball to fall that distance (with gravitational accelleration...)
    Code:
    ---Formula:       //NOTE this ONLY works if you are starting the ball from a height with absolutely NO downward velocity.
    t = sqrt((2 * h) / g)
    t = time
    sqrt = the square root of()
    (2 * h) = 2 times the height of the ball (difference in y value)
    /g = divided by the accelleration, or gravity.
    -----------
    All you need to do fill in the approporate variables to this equation and you will have calculated the time it takes to fall.

    Now what you need to do is calculate how far side to side it will travel within that given time. If there is no side to side accelleration it is very easy:

    Code:
    ---Formula:
    x = v * t
    x = distance
    v = velocity
    t = time
    -------------------
    However if there is any accelleration you need to use this formula:
    Code:
    ---Formula:
    X = (Vo * t) + (1/2 * a * t^2)
    x = distance
    Vo = original velocity
    t = time
    a = accelleration
    t^2 = time raised to the power of 2.
    By doing this you will calculate how far to the left or to the right of the original position the ball will travel BEFORE it touches the ground (where it hits the ground)

    If you need further help, PM me and we'll work something out. It's VERY difficult to explain all of this in text.

    Hope I helped.



    *EDIT*
    Waddo:

    It is not 9.81Ms^-2... Well it is, but thats typed all wrong and has a completely different meaning to it. The way you typed it, it sounds like it is 9.81 Milliseconds raised to the power of -2.
    It is actually 9.8066(rounded to 9.81)m / (s^2). Here it is 9.8066 meters per second squared. as I said.. I love physics...
    Ø_Ø

    ..My gosh..

    I only understanded like... nothing of that
    Joke^

    1) There is no accelleration after the ball is in the air.
    2) There is no wind or anything like that.
    3) Uhm.. Whaat? I got 10 secound before the time is up, this should not take more than 2 secounds at max.

    You got msn? we can talk there if you do? kk thx

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Gravity: Extended? Help Please.
    By Dusk412 in forum OSR Help
    Replies: 13
    Last Post: 12-23-2007, 11:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •