Ok I was wondering instead of following the “loading animations” tutorial in the manual would it be more efficient to do a If…Then statement for loading animations based on what buttons/actions are done?
example (script may not be exact or anything related to panda’s scripting format)
def actions of characters()
If keyboard buttons press is forward
then “play forward animation”
if key_press = space
then “play jump animation”
this way I can have all my animation calls in one place…but I’m worried about speed. will loading with an if then slow the speed of the animation so much that you can tell its transition from that animation…oh and one more thing…is it right for me to assume that the animation will play all the way through even if there is an interupter…wait…i could do an else statement…then maybe have a handler for that
else keypress_handler #used to break animation and play next animation
keypress_handler = function that diciphers which buttons was pressed and proceeds to go to that animations if then code
again please excuse me for not writing the code into actually panda/python format I just wanted anyone who reads this to get the general idea…any code snippets will help but i searched around and no one has had this type of question before so I am assuming I’m the first if I’m wrong PLEASE do not hesitate to let me know if this question has been asked before!
loading an animation is different from playing an animation. check out :
thats what I ment could I implement both into an if then form so I could have a list i will probably just assign a pointer to the actual animation and animation play
have the animation pointer
anim1 = animation file
if keypress= space
then load anim1
else load keypress(keypress_handler)
that way i can just have all my animations loaded and call on them when needed instead of having to define which animation loads with which button press and prevent confusion…i dont know but it helps me it might not help anyone else lol
self.accept("space-down",self.jump)#I dont exactly remember the conventions...
#jump physics code...
if "jump" in self.loadedanims:
Did you read the Roaming Ralph Tutorial code?
I must say I do not undestand what you do not understand…
no, no more questions it was answered in another post. see what I wanted was to ‘prefetch’ the animation hence it wouldnt have to load from the hdd everytime BUT panda has a character ‘pool’ in which the characters that are called reside in RAM which loads way faster than a hdd. so with that said the animations attached to the character also reside in the ram from my understanding plz correct me if im wrong