
-----------------------------------
blackheart5598
Mon Jan 13, 2014 6:08 pm

Trying to make a parabolic jump trail for characters mario-like game :(
-----------------------------------
What is it you are trying to achieve?
I am trying to make a parabolic jump trail for my characters so that they don't all jump in the same way and height which makes it look awkward.


What is the problem you are having?
I am unable to do what I said above :(


Describe what you have tried to solve this problem
I have tried using a parabolic formula of y=x**2 but that doesn't seem to work.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
here is my jump procedure, if it is not enough i don't ming giving more information about my game. Thanks in advance



procedure jump
    for count : 1 .. 180 by 5
        Input.KeyDown (chars)
        if chars ('d') then
            d := d + 25
            if (100 + d) >= 300 then
                picx := picx - 10
            end if
        end if
        if chars ('a') then
            d := d - 25
        end if
        if ((70 + d) = maxx) then
            d := 1140

        end if
        w := 0
        w += 150 * (sind (count))
        Draw.FillOval (100 + d, 200 + round (w), 30, 40, 68)
        Draw.FillBox (72 + d, 240 + round (w), 160 + d, 230 + round (w), red)
        Draw.FillArc (102 + d, 240 + round (w), 30, 30, 0, 180, brightred)
        Draw.FillOval (87 + d, 210 + round (w), 5, 5, black)
        Draw.FillOval (115 + d, 210 + round (w), 5, 5, black)
        Draw.FillArc (105 + d, 190 + round (w), 10, 10, 0, 20, black)
        Draw.FillArc (100 + d, 190 + round (w), 10, 10, 160, 180, black)
        Draw.FillArc (105 + d, 175 + round (w), 15, 15, -30, 30, black)
        Draw.FillBox (70 + d, 90 + round (w), 130 + d, 160 + round (w), brightred)
        Draw.FillArc (105 + d, 160 + round (w), 25, 25, 0, 25, red)
        Draw.FillArc (95 + d, 160 + round (w), 25, 25, 155, 180, red)
        Draw.Line (70 + d, 90 + round (w), 70 + d, 30 + round (w), black)
        Draw.Line (100 + d, 90 + round (w), 100 + d, 30 + round (w), black)
        Draw.Line (101 + d, 90 + round (w), 101 + d, 30 + round (w), black)
        Draw.Line (130 + d, 90 + round (w), 130 + d, 30 + round (w), black)
        Draw.FillOval (60 + d, 50 + round (w), 20, 20, 68)
        Draw.FillOval (-40 + d, 50 + round (w), 20, 20, 68)
        Draw.FillOval (-140 + d, 50 + round (w), 20, 20, 68)
        Draw.FillOval (-240 + d, 50 + round (w), 20, 20, 68)
        Draw.FillOval (-340 + d, 50 + round (w), 20, 20, 68)
        Draw.FillBox (40 + d, 70 + round (w), 100 + d, 80 + round (w), red)
        Draw.FillBox (-60 + d, 70 + round (w), 0 + d, 80 + round (w), red)
        Draw.FillBox (-160 + d, 70 + round (w), -100 + d, 80 + round (w), red)
        Draw.FillBox (-260 + d, 70 + round (w), -200 + d, 80 + round (w), red)
        Draw.FillBox (-360 + d, 70 + round (w), -300 + d, 80 + round (w), red)

        View.Update
        delay (25)
        Draw.FillOval (100 + d, 200 + round (w), 30, 40, colorbg)
        Draw.FillBox (72 + d, 240 + round (w), 160 + d, 230 + round (w), colorbg)
        Draw.FillArc (102 + d, 240 + round (w), 30, 30, 0, 180, colorbg)
        Draw.FillOval (87 + d, 210 + round (w), 5, 5, colorbg)
        Draw.FillOval (115 + d, 210 + round (w), 5, 5, colorbg)
        Draw.FillArc (105 + d, 190 + round (w), 10, 10, 0, 20, colorbg)
        Draw.FillArc (100 + d, 190 + round (w), 10, 10, 160, 180, colorbg)
        Draw.FillArc (105 + d, 175 + round (w), 15, 15, -30, 30, colorbg)
        Draw.FillBox (70 + d, 90 + round (w), 130 + d, 160 + round (w), colorbg)
        Draw.FillArc (105 + d, 160 + round (w), 25, 25, 0, 25, colorbg)
        Draw.FillArc (95 + d, 160 + round (w), 25, 25, 155, 180, colorbg)
        Draw.Line (70 + d, 90 + round (w), 70 + d, 30 + round (w), colorbg)
        Draw.Line (100 + d, 90 + round (w), 100 + d, 30 + round (w), colorbg)
        Draw.Line (101 + d, 90 + round (w), 101 + d, 30 + round (w), colorbg)
        Draw.Line (130 + d, 90 + round (w), 130 + d, 30 + round (w), colorbg)
        Draw.FillOval (60 + d, 50 + round (w), 20, 20, 68)
        Draw.FillOval (-40 + d, 50 + round (w), 20, 20, 68)
        Draw.FillOval (-140 + d, 50 + round (w), 20, 20, 68)
        Draw.FillOval (-240 + d, 50 + round (w), 20, 20, 68)
        Draw.FillOval (-340 + d, 50 + round (w), 20, 20, 68)
        Draw.FillBox (40 + d, 70 + round (w), 100 + d, 80 + round (w), red)
        Draw.FillBox (-60 + d, 70 + round (w), 0 + d, 80 + round (w), red)
        Draw.FillBox (-160 + d, 70 + round (w), -100 + d, 80 + round (w), red)
        Draw.FillBox (-260 + d, 70 + round (w), -200 + d, 80 + round (w), red)
        Draw.FillBox (-360 + d, 70 + round (w), -300 + d, 80 + round (w), red)
        if (100 + d) >= 700 then
            picx := picx - 5
        end if
        if picx  ground
        y = y + y_velocity % move the character upwards 'y_vel' 
        y_velocity = y_vel - 0.5 % decrement y_vel by a constant
    else
    y_vel = 0 % set y_vel to zero
end loop
[/code]

EDIT: it seems somebody beat me to the punch...

-----------------------------------
Raknarg
Mon Jan 13, 2014 9:07 pm

RE:Trying to make a parabolic jump trail for characters mario-like game :(
-----------------------------------
As the others have suggested, think about how gravity works in real life. It doesn't matter what your horizontal direction is, that will stay constant. However, what happens when you jump? You move upwards at a certain initial speed, and then the earth is pulling you down at a constant rate.

Try converting that into code.

If the player jumps, set the y direction speed up.

While the player is in the air (think about what that means in terms of x and y), constantly pull him towards the ground.

@keyboardwalker & evildaddy giving a new person in programming a bunch of code to help him out is giving him a fish instead of teaching him how o fish.
