2
$\begingroup$

I have a 1000 frame animation organized into 4x200 frame sections and I would like to use BGE to loop certain sections and then use a "next" button progress to the next section.

kinda like:

var progress1; var progress2; var progress3;

if progress1 = 0
   play
   loop frames[1-200]
else
   play
   goto section2

//section 2
if progress2 = 0
   play
   loop frames[201-400]
else 
   play
   goto section 3

//section 3
if progress3 = 0
   play
   loop frames[401-600]
else 
   play
   goto END 

Can this be achieved?

$\endgroup$
1
$\begingroup$

I suggest to split the animation(s) into several segments. That means you have one ActionActuator for each segment defining the begin and end of the action to be played. E.g. start:1, end:200

To deal with each single segment I recommend to use a state of the build-in state machine. This allows to focus on the specific segment without creating too much spaghetti bricks.

Here is an example with two states. You can configure your ActionActuators as you like, but I recommend Mode:play

State A: enter image description here

State B: enter image description here

As you hopefully see the structure of each state is pretty similar.

  1. when entering the state -> start playing
  2. when the playing ends -> transit to the next state (can even be the same one, if you want to implement a loop.

And yes, you can transit to other states on any event you like, e.g. key press.

To get more details have a look at Action sequences with logic bricks - the power of the ActuatorSensor. It comes with an example.

I hope it helps

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.