Benoit Bolsee
9b4956ae22
BGE patch: KX_STATEx constant to allow simple state manipulation in setState()
...
The constants KX_STATE1 to KX_STATE30 can be used
with setState() to change the object state in a
python controller. The constants are defined in the
GameLogic module so that the full name is
GameLogic.KX_STATE1 to GameLogic.KX_STATE30 but you
can simplify this with the import statement:
from GameLogic import *
cont = getCurrentController()
ob = cont.getOwner()
ob.setState(KX_STATE2) #go to state 2
KX_STATEx constants are defined as (1<<(x-1))
Binary operators |, &, ^ and ~ can be used to combine states:
You can activate more than one state at a time with the | operator:
ob.setState(KX_STATE1|KX_STATE2) #activate state 1 and 2, stop all others
You can add a state to the current state mask with:
state = ob.getState()
ob.setState(state|KX_STATE3) #activate state 3, keep others
You can substract a state to the current state mask with the & and operator:
state = ob.getState()
ob.setState(state&~KX_STATE2) #stop state 2, keep others
You can invert a state with the ^ operator:
state = ob.getState()
ob.setState(state^KX_STATE2) #invert state 2, keep others
2008-09-22 19:54:30 +00:00
..
2008-09-20 11:08:35 +00:00
2008-09-05 14:33:36 +00:00
2008-09-04 20:51:28 +00:00
2008-07-10 12:47:20 +00:00
2008-09-04 20:51:28 +00:00
2008-09-20 11:08:35 +00:00
2008-09-20 11:08:35 +00:00
2008-07-29 15:48:31 +00:00
2007-01-13 08:30:08 +00:00
2008-09-04 20:51:28 +00:00
2008-09-04 20:51:28 +00:00
2008-09-04 20:51:28 +00:00
2008-07-22 09:53:25 +00:00
2008-07-21 12:37:27 +00:00
2008-07-01 16:43:46 +00:00
2008-05-24 08:34:04 +00:00
2008-09-20 11:08:35 +00:00
2008-08-14 08:58:25 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-09-20 11:08:35 +00:00
2008-09-20 11:08:35 +00:00
2008-09-06 14:13:31 +00:00
2008-04-16 22:40:48 +00:00
2008-09-21 15:17:50 +00:00
2008-09-21 15:17:50 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-09-20 11:08:35 +00:00
2008-09-12 02:15:16 +00:00
2008-09-20 22:19:59 +00:00
2008-09-09 22:40:10 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-07-21 12:37:27 +00:00
2008-08-27 06:02:10 +00:00
2008-07-08 12:18:43 +00:00
2008-09-20 11:08:35 +00:00
2008-07-23 21:37:37 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-09-04 20:51:28 +00:00
2008-04-16 22:40:48 +00:00
2008-09-18 01:46:28 +00:00
2008-09-18 01:46:28 +00:00
2008-09-10 09:51:06 +00:00
2008-09-04 20:51:28 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-08-17 17:08:00 +00:00
2008-07-25 13:45:57 +00:00
2008-09-06 14:13:31 +00:00
2008-08-27 19:34:19 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-09-20 11:08:35 +00:00
2008-09-18 01:46:28 +00:00
2008-07-30 17:41:47 +00:00
2008-07-30 17:41:47 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-08-14 03:23:36 +00:00
2008-07-23 21:37:37 +00:00
2008-07-21 12:37:27 +00:00
2008-07-21 12:37:27 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-09-20 11:08:35 +00:00
2008-08-14 08:58:25 +00:00
2008-04-16 22:40:48 +00:00
2008-09-06 14:13:31 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-09-04 20:51:28 +00:00
2008-09-04 20:51:28 +00:00
2008-09-04 20:51:28 +00:00
2008-08-27 19:34:19 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-09-06 14:13:31 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-07-25 21:14:23 +00:00
2008-09-22 19:54:30 +00:00
2008-09-12 02:15:16 +00:00
2008-09-20 11:08:35 +00:00
2008-04-16 22:40:48 +00:00
2008-08-27 19:34:19 +00:00
2008-08-27 19:34:19 +00:00
2008-07-30 17:41:47 +00:00
2008-07-30 17:41:47 +00:00
2008-09-20 11:08:35 +00:00
2008-08-28 19:37:49 +00:00
2008-09-20 11:08:35 +00:00
2008-08-27 03:34:53 +00:00
2008-06-25 14:09:15 +00:00
2008-06-25 14:09:15 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-09-20 11:08:35 +00:00
2008-09-05 02:53:12 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-09-20 22:19:59 +00:00
2008-09-04 20:51:28 +00:00
2008-09-20 11:08:35 +00:00
2008-07-19 07:45:19 +00:00
2008-09-04 20:51:28 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-06-14 17:12:49 +00:00
2008-08-28 08:13:58 +00:00
2008-04-16 22:40:48 +00:00
2008-09-20 11:08:35 +00:00
2008-06-22 14:23:57 +00:00
2008-07-21 12:37:27 +00:00
2008-07-21 12:37:27 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-08-05 16:23:33 +00:00
2008-07-30 17:41:47 +00:00
2008-09-20 11:08:35 +00:00
2008-07-30 17:41:47 +00:00
2008-09-20 11:08:35 +00:00
2008-08-14 08:58:25 +00:00
2008-09-06 14:13:31 +00:00
2006-02-21 07:08:23 +00:00
2008-09-04 20:51:28 +00:00
2008-04-16 22:40:48 +00:00
2008-09-20 11:08:35 +00:00
2008-09-05 16:22:14 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-04-16 22:40:48 +00:00
2008-09-04 20:51:28 +00:00
2008-09-04 20:51:28 +00:00