My code example already did link it: ninja.y += ninja.v_y
though it really should be (my mistake): ninja.y += ninja.v_y * dt It should be updating ninja.y every update, as long as this is true (regardless of the key state): if ninja.y > floor or ninja.v_y > 0: And just in case you though ninja.v_y = 30 should be the initial value... It's not. 0 should be. 30 is the velocity that's set when a player pressed the jump button (if they are still on the ground). The velocity is reduced every update by gravity (ninja.v_y -= dt * 20) and the position is adjusted every update by velocity (ninja.y += ninja.v_y * dt). On Fri, Aug 26, 2011 at 2:05 PM, Paul <[email protected]> wrote: > ok, but when i use 'ninja.v_y = 30' for the velocity, how is that > supposed to correspond to the ninja.y value??? how do i link the > velocity to the y value? thnx > > On Aug 26, 4:26 pm, Michael LaRue <[email protected]> wrote: > > Just need to initialize it at the beginning. ninja.v_y = 0 > > > > > > > > > > > > > > > > On Fri, Aug 26, 2011 at 1:24 PM, Paul <[email protected]> wrote: > > > okay, haha now im stuck. > > > > > i dont have any variable 'ninja.v_y', is there supossed to be that > > > variable or am i supposed to declare ninja.v_y as something ??? > > > plz help , thanks! > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "pyglet-users" group. > > > To post to this group, send email to [email protected]. > > > To unsubscribe from this group, send email to > > > [email protected]. > > > For more options, visit this group at > > >http://groups.google.com/group/pyglet-users?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "pyglet-users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/pyglet-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en.
