0
$\begingroup$

Here is the thing, I'm currently working on a project for my internship. It is about an interactive boatride which there are multiple atributes that te boat stops at. After you completed a level the boat starts to float on further into the game.

Right now I am working on the Proof of concept. The technical part. The levels work. The buttons work, but there is just one thing I can't seem to figure out.

enter image description here The monkey in this scene is the working button. Once clicked, the blue square on the rail disappears and the boat is able to go along the tracks onto the next level.

The orange cylinder with the blue square has an "always sensor to a action actuator" that , when playing the game, keeps spinning in one direction. To show that the action changes I made another animation where the cylinder is turning into the other direction.

So here is the problem. When you click on the monkey, it sends multiple messages to different objects. All of them work just fine but the action on the cylinder does not change. enter image description here This is the current logic i provided to the cylinder. Because of the past failures, I have erased the message sensor.

So:

  • I have got 2 actions for the cylinder (one activated by an "always sensor")

  • There is a button which sends out a message once clicked

Is there a way to make this work properly?

If there is any information missing reguarding this problem please let me know. I will gladly expand my explanation of my current problem.

Thanks

$\endgroup$

1 Answer 1

0
$\begingroup$

The always sensor (with the controller) activates/deactivates the action actuator. It does not change the configuration of the actuator.

As it is now it reads like this:

Always (due to True Level Triggering) -> activate the actuator

This means at each single frame you tell the actuator to play the action.

You wrote you want to play another action. To do so you need another action actuator that does exactly that.

Now you need a way to determine when to play what action. There are mutliple ways to achieve that. Here is one.

You define two modes: playing A and playing B You start with mod playing A.

Add a property call it "mode" make it String and Initialize it with "playing A".

Now change your always sensor to a property sensor listening on property "mode" to be equal to "playing A".

Right now it should work as before. You start the game and the object plays A.

(Hint: switch the action actuator to loop stop mode and you can disable the true level triggering at the property sensor)

Now add another Property sensor that checks "mode" to be equal to "playing B". Connect to a controller, connect to another action actuator defining the other action.

So this is what you wanted to get. A way to play another action.

Now you need to control what action to play. I assume you send a message "play B" at the moment you want to see the second action.

Add a message sensor that listens to "play B", connect to a controller, connect to a property actuator that changes "mode" to "playing B".

With that you can change the animation in-game. Just send "play B" and the object will stop playing A (dependent on the actuator mode) and starts playing B.

To switch back you need to add a similar logic listening to another message subject (or the same if you want to toggle).

$\endgroup$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .