Commit Graph

7 Commits

Author SHA1 Message Date
Benoit Bolsee
1c663bbc7e First batch of GE API cleanup.
The principle is to replace most get/set methods of logic bricks by direct property access. 
To make porting of game code easier, the properties have usually the same type and use than
the return values/parameters of the get/set methods. 
More details on http://wiki.blender.org/index.php/GameEngineDev/Python_API_Clean_Up

Old methods are still available but will produce deprecation warnings on the console: 

"<method> is deprecated, use the <property> property instead"

You can avoid these messages by turning on the "Ignore deprecation warnings" option in Game menu.

PyDoc is updated to include the new properties and display a deprecation warning
for the get/set methods that are being deprecated.
2008-12-29 16:36:58 +00:00
Benoit Bolsee
bc8f002a4c BGE state system improvement: the sensor with Level option enabled will trigger the controller of a newly activated state, even if the sensor is already connected to an active state; new isTriggered() python function to determine which sensor triggered the current controller.
Previously, this behaviour was available only for sensors
that were not connected to any active state, which was
forcing the game designer to duplicate sensors in some 
cases.
For example the Always sensors used to initialize the 
states needed to be duplicated for each state. With this
patch, a single Always sensor with Level option enabled
will suffice to initialize all the states. 
A Python controller can determine which sensor did trigger
with the new SCA_ISensor::isTriggered() function.

Notes:
- When a sensor with level option enabled is connected
  to multiple controllers, only those of newly activated
  states will be triggered. The controllers of already
  activated states will receive no trigger, unless the 
  sensor internal state toggled, in which case all the
  controllers are triggered as always.
- The old isPositive() function returns the internal
  state of the sensor, positive or negative; the new 
  isTriggered() function returns 1 only for sensors
  that generated an event in the current frame.
2008-08-23 11:54:27 +00:00
Benoit Bolsee
fda00bc034 BGE patch: New Delay sensor (derived from patch #17472)
Introduction of a new Delay sensor that can be used to 
generate positive and negative triggers at precise time,
expressed in number of frames. 
The delay parameter defines the length of the initial 
OFF period. A positive trigger is generated at the end
of this period. The duration parameter defines the 
length of the ON period following the OFF period.
A negative trigger is generated at the end of the ON period. 
If duration is 0, the sensor stays ON and there is no 
negative trigger. 
The sensor runs the OFF-ON cycle once unless the repeat 
option is set: the OFF-ON cycle repeats indefinately 
(or the OFF cycle if duration is 0).

The new generic SCA_ISensor::reset() Python function
can be used at any time to restart the sensor: the
current cycle is interrupted and no trigger is generated.
2008-08-16 20:45:37 +00:00
Benoit Bolsee
5eb14d70b9 BGE patch: Add PyDoc for new logic bricks, set exception message on Py error, remove args on Py functions that don't take any to save CPU time 2008-07-23 21:37:37 +00:00
Kester Maddock
0dfc3a3b78 Use epydoc for generating game python reference (like the bpython guys) 2004-05-31 13:06:04 +00:00
Kester Maddock
d38329b5aa Added Python module for Lights.
Added attributes to the vertex class.
2004-05-30 11:09:46 +00:00
Kester Maddock
a96955efc2 Game Python Reference Manual.
This manual lists all the Python classes and modules for Game Objects, Sensor bricks, Controllers etc.
Missing: Actuator & Controller reference.
2004-05-24 07:49:50 +00:00