pypalgame Module
Python Bindings for PAL geared toward game development
Module functions:
-
pypalgame.init(gravity=(0, -9.8, 0), pygame=None)[source]
Initializes the module.
This function must be called before any other function from this library is called
gravity: int int int, default = (0,-9.8,0): gravity to be applied to the world.
pygame: the pygame instance to be used to emit events.
-
pypalgame.update(time_step)[source]
Steps the simulation.
timestep: time since last step
-
pypalgame.cleanup()[source]
Ends the simulation.
-
pypalgame.get_time()[source]
Returns age of the simulation.
-
pypalgame.get_time_step()[source]
Returns last timestep.
-
pypalgame.set_group_collision(group1, group2, collide)[source]
group1,group2: the groups between which the relation is being set.
collide: bool, wether or not the two groups can collide with eachother
-
pypalgame.get_gravity()[source]
Returns the current direction of gravity.
returns:(x,y,z)
-
pypalgame.get_up_axis()[source]
Return the index, i.e. x (0), y (1), or z(2), to use for up.
-
pypalgame.get_events()[source]
returns all collision events for this step if ygame was not passed into
__init__.
if pygame was specifies in __init__ this function will post pygame mesages
instead.
-
pypalgame.SetCollisionAccuracy(accuracy)[source]
acccuracy: sets the acuracy of the simulateion, Ranges from 0..1, 0 indicates fast and inaccurate, 1 indicates accurate and slow.
-
pypalgame.raycast(pos, direction, max_range)[source]
returns a structure thusly: [pos,normal,distance,body,normal] any of these values may be ‘None’ if unavailable
pos: the position to start the cast from
dirction: the direction the cast will take
max_range: the max range of the cast