Your sample code is being blocked by my corporate firewall for the moment, but I have the hunch that you’re still going about this in a confused manner.
In the code block you quoted initially, every time you press a key, it will create and start a new interval that moves player1. i.e.
[you press ‘a’] -> Panda creates the ‘a’ event automatically -> ‘a’ is caught (because of your accept statement) and runs _izquierda -> _izquierda creates a new posInterval to move player1 to the absolute position (-70,y,z), from wherever it is (let’s assume (0,0,0), over the course of 5 seconds (incidentally, you can just start the posInterval, you don’t need to wrap it in the Sequence)
[you press ‘a’ 1 second later] -> Panda creates the ‘a’ event automatically -> ‘a’ is caught (because of your accept statement) and runs _izquierda -> _izquierda creates a new posInterval to move player1 to the absolute position (-70,y,z), from wherever it is (as a function of the interval that’s still going), over the course of 5 seconds, so now you have 2 intervals fighting over player1’s position
[you press ‘a’ 1 second later] -> … -> now you have 3 intervals going. Assuming a start position of (0,0,0), one is moving player1 from (0,0,0) to (-70,0,0), one is simultaneously trying to move it from (-14,0,0) to (-70,0,0), one is trying to move it from (-28,0,0) to (-70,0,0)
Is this the behavior you want?
I would assume you’re interested in
[you press ‘a’] -> stuff happens -> player1 starts moving in the -x direction
[you release ‘a’] -> stuff happens -> player1 stops moving in the -x direction
Intervals are a very awkward way to do this, but something on the order of
move = self.player1.posInterval(duration=5, pos=(-70,0,0), startPos=(0,0,0), other=self.player1)
might be a little closer to what you want. Note the ‘other’ argument, specifying that the coordinates are relative to self.player1’s corrdinate space rather than (by default) self.player1’s parent’s coordinate space.
Personally, I’d have ‘a’ do a taskMgr.add(moveTask) and ‘a-up’ do taskMgr.remove(moveTask) with moveTask containing some riff on
changeInTime = task.time - globalOldTime