On Feb 2, 2008 9:54 AM, yoshi <[EMAIL PROTECTED]> wrote:
> My problem is this: if I push the UP key it executes the function, but
> in that function I somehow have to make the character jump up and
> animate.
> I cannot simply do something like this in character class definition:
>
> def jump(self,parent):
> for i in range(5): #go up
> self.current_image = self.frames['jump'][i]
> self.y += 10
> self.update()
> self.parent.update()
> for i in range(4,-1,-1): #fall back down
> self.current_image = self.frames['jump'][i]
> self.y -= 10
> self.update()
> self.parent.update()
>
> (the self.update() simply blits the current image to the current x and
> y)
>
Yeah, I'd expect that to happen. How to you intend to draw multiple frames
with one screen flip?
>
> This will ignore the framerate cap.
>
> If I enter a clock.tick() inside the jumping function or the update it
> will screw up the framerate. I have tried adding clock.tick() in the
> for loops and while the framerate was ok, it stalled any music that
> played until the animation was over.
> Is there any way to create this jumping animation without the music
> stalling? I know that when i push the UP key to jump I go into the
> jumping loops and outside the mainloop and that's what makes the music
> stall, but I have no other idea how to create the jumping animation.
>
> I tried creating a variable that saves the current jump frame and
> increments it without using a for loop but that requires me to keep
> the UP key pressed until the animation is finished.
>
> Any hint/idea would be helpful.
> If anyone wants to see the full source code, just say so. I didn`t
> post it yet because I didn`t think it is necessary.
>
Just look at some example implementations first before going any further -
you need to scrap your current implementation. And understand that you
update the current frame ONCE per iteration of your game's main loop. Some
places to look for tips in the pyglet project:
./experimental/animation.py
./examples/astraea/astraea.py
--
\\\\\/\"/\\\\\\\\\\\
\\\\/ // //\/\\\\\\\
\\\/ \\// /\ \/\\\\
\\/ /\/ / /\/ /\ \\\
\/ / /\/ /\ /\\\ \\
/ /\\\ /\\\ \\\\\/\
\/\\\\\/\\\\\/\\\\\\
d.p.s
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---