Artificial Intelligence¶
Control the enemies behaviour (bats, ghosts, pendulum)
- src.ai.BL_EnemyArmatureObject¶
alias of BL_ArmatureObject
- class src.ai.Base(parent)¶
Bases: src.base.Base
- bats¶
- ghosts¶
- loop()¶
- pendulums¶
- spawnEnemies()¶
populate enemies
- trailSeek()¶
see if we are to be activated
- trailSeeker(ob, controller, actuator)¶
Store the object we use to evaluate the trail for enemy spawning
- class src.ai.Bat(scene, obj, target, speed, events, logger)¶
Bases: src.ai.FlyingEnemy
- enemy = 'BAT'¶
- ray_filter = 'bat'¶
- class src.ai.Enemy(speed, events, logger)¶
Bases: builtins.object
- addObject(scene, object_name, object_origin)¶
Spawn a new object in the game
- attack(origin)¶
Check if enemy is close enough to eat
- attack_distance_squared = 0.01¶
- classmethod calculateId()¶
Generates a new id based on the number of added instances
- changeState()¶
Called when the object changes to a relevant state, called from Logic Bricks
- end()¶
End the object, called from Logic Bricks
- evade_distance_squared = 100.0¶
- static getState(state)¶
Return the bitwise flag corresponding to this state
- classmethod hit(camera, origin, direction)¶
Try to hit an enemy from this origin at this direction If succeds, send a message to end the object
- init()¶
Initialize the object, called from Logic Bricks
- instances = 0¶
- kill()¶
Send message to eliminate the object It is called when we hit the enemy or the enemy hits us
- ray_filter = ''¶
- setSound(sound)¶
Setup OSC sound engine, called from sound.py
- sound_source¶
Return the object to use as reference for the sound origin
- subject¶
Message subject to use with the Message sensor to end the object
- class src.ai.FlyingEnemy(name, scene, obj, target, speed, events, logger)¶
Bases: src.ai.Enemy
- class src.ai.Ghost(scene, obj, target, speed, events, logger)¶
Bases: src.ai.FlyingEnemy
- activation_distance = 30.0¶
- attack_distance_squared = 0.25¶
- enemy = 'GHOST'¶
- ray_filter = 'ghost'¶
- src.ai.KX_EnemyGameObject¶
alias of KX_GameObject
- class src.ai.Pendulum(scene, obj, speed, events, logger)¶
Bases: src.ai.Enemy
- attack()¶
Called from Logic Brick callback We are already hitting the player
- end()¶
End the object, called from Logic Bricks
- enemy = 'PENDULUM'¶
- evade(origin)¶
Check if enemy is too far
- ray_filter = 'pendulum'¶
- class src.ai.Seeker(ob, controller, actuator)¶
Bases: builtins.object
- getOrientation(frame, callback, user_data=None)¶
Get orientation matrix of the animation at a given frame
Parameters: - frame (int) – animation frame
- callback (function(mathutils.Matrix, user_data)) – callback function
- user_data (Object) – user data passed back to callback function
- getPosition(frame, callback, user_data=None)¶
Get position of the animation at a given frame
Parameters: - frame (int) – animation frame
- callback (function(mathutils.Vector, user_data)) – callback function
- user_data (Object) – user data passed back to callback function
- getTransform(frame, callback, user_data=None)¶
Get position and orientation matrix of the animation at a given frame
Parameters: - frame (int) – animation frame
- callback (function(((mathutils.Vector, mathutils.Matrix), user_data)) – callback function
- user_data (Object) – user data passed back to callback function
- loop()¶
activate the actuator to return any stacked query
- src.ai.attacked(cont)¶
Called from Logic Bricks upon collision with enemy
Only pendulum collides this way, the other objects Use the steering actuator which is incompatible with physics sensors
- src.ai.changeState(cont)¶
Called from Logic Bricks upon change to relevant states (e.g., start chasing, or end object)
- src.ai.trailSeeking(cont)¶
activate trail seeking actuator