0
$\begingroup$

I'm quite new to Blender's game engine, but I'm trying to give it a go now.

My first try was to create a simple WASD keys character movement using the logic editor.

For that, I needed to set the Loc (location offset) in the motion actuator for each keypress, but since they would be all the same value, and I could want to change them at a later time, I wanted to use some kind of variable to control it, like "character_speed". I know this seems like an overkill, but I'm thinking ahead for keeping things organized for bigger projects.

Is there support for something like that? Maybe using python scripting or drivers?

Thank you!

$\endgroup$
1
  • $\begingroup$ There's nothing wrong with thinking ahead! $\endgroup$ Commented Jun 4, 2016 at 23:10

1 Answer 1

2
$\begingroup$

you can add custom properties to any object in your scene to store simple data types like an integer,string,boolean,float or a timer variable.

The property sensor allow you to test their values , and the property actuator to affect to them new values.
the controller can do logic operations to combine tests and trigger different actuators.

for complex data types , like arrays and structures, you have to use a python script.

$\endgroup$
8
  • $\begingroup$ ok, I can create new properties in the object, but how do I call or access them in the logic editor? (or anywhere else, for that matter) $\endgroup$
    – arvere
    Commented Jun 4, 2016 at 18:54
  • $\begingroup$ you add a property sensor to test on their values, and a property actuator to change their values $\endgroup$
    – user2816
    Commented Jun 4, 2016 at 19:01
  • $\begingroup$ alright, but what is it possible to use properties like that in fields like those from motion actuators? i.imgur.com/Ilv1QNU.jpg $\endgroup$
    – arvere
    Commented Jun 4, 2016 at 19:42
  • $\begingroup$ I don't think you can put them there without a script ,the properties can be access inside a script , and you can call the same function the actuators call with the values of your properties. $\endgroup$
    – user2816
    Commented Jun 4, 2016 at 19:53
  • 1
    $\begingroup$ Hey, don't give up! It isn't that hard because I've done it and it wasn't too hard for me. I just can't remember what file I have it in. You can set a driver up quite easily and use that to drive the variable value for your speed. Drivers allow for variables and math functions. You just have to know the formula you want to use to calculate the speed. $\endgroup$ Commented Jun 4, 2016 at 23:17

You must log in to answer this question.

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