Movement question (need help with python)

How the heck does the message actuator work? What does it do? Is it possible to change a property using them?

The reasons for these questions is because I want to be able to do something and maybe messages can help. What I need is two property sensors attached to an and controller which is connected to an IPO actuator. Is it possible (and I’ve tried) to have one of the property sensors to be a property of that object and the other from another object.? As far as I know it doesn’t work.

The message sensor is basically just used to trigger something from one object to another object, or to broadcast something. The best use of it is to cause a level to end. For example, I could have an object that when the character colides with it it would send a message via the message actuator, then an object, like a “level completed” text, would have the msesage sensor on it triggered to say an IPO actuator to show the text.

If you just need two properties from different objects to be the sensors for one actuator, then it’s simple. Select both objects at once by shift-right-clicking on each. Then go to the game buttons and make sure the “sel” button is enabled and it will show you the logicbricks for both objects. You can then link the logicbricks from each one to each other as if they were the same object, though they can have differnet properties.

Hope that helps!

Pooba

Hi,

with the message actuator you can send a message (or signal) to another object.

For example, object 1 has the following logic bricks:

[ KEYBOARD ]o---------o[ AND ]o----------o[ MESSAGE ]

key: Space Subject: play IPO

And then object 2 has these logic bricks:

[ MESSAGE ]o---------o[ AND ]o----------o[ IPO ]

Subject: play IPO Play

                                                               Start: 1    End: 20

This way, when you press the spacebar, object 1 sends a message to object 2 to play an IPO.

You can also change properties this way. Or use any actuator for the object receiving the message. Hey, messages have even more functions and uses, but for this I’m not the right person to explain :slight_smile:

Another method is selecting both objects, when you go to the Logic buttons you’ll see the logic bricks for both of them. This way you can directly connect logic bricks of both objects :smiley:

victor

Thanks, that helped. Now I have another question. How would I be able to move an object a set distance (in this case, exactly 1.75 on x axis and 1.75 on y axis) without using IPO. Is there some python script I could write (if so, help me) or just using logic bricks?

When you use the Motion actuator, you have 6 different types of motion:

Force, Torque, dLoc, dRot, LinV and AngV.

With dLoc you can precisely determine how much you want to move an object.

victor

Ok, I knew that, but all that does is keep moving it in one direction, it doesn’t move it only 1.75 units on the x and y axis, it keeps moving it in that direction.

In most cases you get such a result, yes. But try to combine this with a message actuator (nice coincidence):

The object you want to move:

[ MESSAGE ]o----------o[ AND ]o----------o[ MOTION ]

subject: move – dLoc: x 1.75 y 1.75

Another object which sends the message:

[ KEYBOARD ]o----------o[ AND ]o----------o[ MESSAGE ]

key: Space – subject: move

Now the object moves only 1.75/1.75 each time you press the spacebar

victor

thanks, that helps alot.

Edit:
Actually, I have another question. Is it possible to detect the location of an object relative to another, such as left or right (preferably diagonal)? If not by logic bricks, can someone help write me a sample script able to do this?

Example:

The O is diagonally left of the P, so O will move diagonally right.

O
__P

Are you talking about homing or repelling objects? If so, then you can use a combination of Edit Object|Track To and Motion.

Not really. Alright, what I’m making is a checkers board. I’m making it so that when you left click on a piece and right click on the board space, the piece will move there. The thing I’m looking for now is a script or something that can detect if the piece selected is diagonally left or right of the space selected. That way it can send a message to the piece to move in the direction of the space. I can’t really use ‘track to’ or IPO or anything because then there would be tons of logic bricks for each piece. I’m trying to keep it simple. Anyway, any help writing a script like that would help (I have almost no experience with python).

Thanks in advance.