play IPO back and forth with one actuator

Hey guys, back with another problem : i’ve animated a door opening, i’ve got a sensor listening for mouse input, linked to a python script which in turn is linked to an IPO actuator.I use a bool property to check if the door is open or closed.

What i want to have happen :
1 when i click, the script checks if the door is open
2 if it’s not the actuator plays frames 1 through 30 and then sets the property to tell me that it’s open
3 if the door is open the actuator plays frames 30 through 1 and sets the property to tell me that the door is closed

THE PROBLEM : it seems that i can’t change the values i entered in the logic block using the script, if i enter in the logick bloc start 1 and end 30 only the open animation plays, if i enter start 30 and end 1 only the close animation plays, my script looks like this :


if doorState.data == 0 :

                # the door is closed
                # play open animation
                openDoor.setStart(1)
                openDoor.setEnd(30)         
                GameLogic.addActiveActuator(openDoor, 1)
                doorState.setData(1) # door has been opened
                
            else :
               # the door is open
                # play close animation
                openDoor.setStart(30)
                openDoor.setEnd(1)         
                GameLogic.addActiveActuator(openDoor, 1)
                doorState.setData(0) #door has been closed

is there a bug with the actuator that won’t allow me to change it’s data ?

my solutions as i see them would be :
either use two actuators for playing back and forth the animation
either animate the door closing and opening whithin the same ipo

but these are both undesirable since the actuator should be able to do what i’m trying to do with it, can you guys help pls :frowning:

Try using an IPO actuator with it set to Flipper?

don’t check for an open or closed door, just check for which IPO frame its on,

then u can set the IPO type to pingpong, and have it play itself backwards simply by stating that it should play for another 29 frames only if IPO frame of the door animation is currently at 1 or 30 and mouse has been clicked.

=)

edit: oh it’s actually simpler than I thought, u dont’ even have to check the IPO frame, just set it to Ping Pong on mouseclick - it will only register at the end of the animation

the guy above was right except it’s not Flipper, flipper means u have to hold the key down, ping pong, as the name implies u only have to -hit- the key.

just do the open and close animation in the same IPO.Open is frames from 1-10, and close is 11-21.when you want it to open play 1-20, when it is time to close have it play 11-21.

thanks for the suggestions guys, i haven’t tried ping pong yet, using one actuator to play separate parts of the ipo didn’t work, i’m currently using two actuators to play the open and close, but i’ll try ping pong after i clean up my code

http://blenderartists.org/forum/showthread.php?t=130690

thanks zogodg :slight_smile: