Module MyGameActiveParts :: Class MY_GameCharacter
[hide private]
[frames] | no frames]

Class MY_GameCharacter

source code

MyGameObjects.MY_GameObjectActive --+
                                    |
                                   MY_GameCharacter

class of the main game character, which the user has to play

Instance Methods [hide private]
 
__init__(self, scene, element) source code
 
setView(self, window_metric)
sets the players view.
source code
Vector
jump(self, speed, force)
sets the jump digit of the speed vector with the given force
source code
 
marioJump(self, hurdle_pos)
sets the mario jump, to get out of the way of an enemy after get hurt once
source code
Vector
move(self, fwd, back, left, right, force)
calculates the movement of the object, dependent on given input parameters (direction and force)
source code
 
look(self, mouse_screen_pos, dtime, sensitivity)
sets the players actual camera view dependent on user's mouse input, elapsed time and sensitivity
source code
 
initOneighty(self, turn_duration)
initialize the 'Oneighty' with the right parameters and given duration it sets the used member variables with the right values to know how to rotate and the local rotation of the player afterwards and parents the player to the rotating ground object
source code
 
initWallRun(self, global_collision_side, hit_plane, turn_duration)
initialize the wall turn.
source code
 
planeTurn(self)
do the Oneighty
source code
Boolean
setInventoryItem(self, item_name, add)
sets or removes given item into the inventory
source code
 
setInventoryGauge(self)
refresh the inventory gauge on the screen and in the config parser
source code
Boolean
getItemLifeTime(self, name)
sets the lifetime of an used item
source code
 
setMerchItem(self, merch_name)
adds a given merchandise item into the inventory
source code
 
setWarp(self)
do a space warp
source code
 
reloadAmmo(self)
reloads your ammo
source code
    Inherited from MyGameObjects.MY_GameObjectActive
 
deleteObject(self)
deletes object and removes it from the scene
source code
List [vx, vy, vz]
getLinearVelocity(self, local)
if 'local = True' it gets the local linear velocity otherwise it gets the global linear velocity
source code
Vector
getPosition(self)
gets the world position
source code
Matrix
getWorldOrientation(self)
gets the world orientation
source code
 
setLinearVelocity(self, speed, local=0)
if 'local = True' it sets the local linear velocity otherwise it sets the global linear velocity
source code
 
setLocalOrientation(self, orientation)
sets the local orientation
source code
 
setPosition(self, position)
sets the world position
source code
Instance Variables [hide private]
Boolean aim
True if player aims at a target, otherwise False
Integer ammo
the amount of bullets the player has in his gun
Float angleX
just a temporary variable to leave the angleXTotal variable untouched
Integer angleXTotal
the global rotation about the x-axis of the player (player rotates finally just about x and y)
Float angleY
just a temporary variable to leave the angleYTotal variable untouched
Integer angleYTotal
the global rotation about the y-axis of the player (player rotates finally just about x and y)
Float cosX
the cosinus amount of looking up and down
Float flyTime
the time when you began to leave the ground
Integer globalRotationX
the rotation amount about x-axis when turning
Integer globalRotationY
the rotation amount about y-axis when turning
Boolean godMode
True if player is in godmode; normally after a hurdle hit to stay alive and not to lose all your health
Float godStartTime
the time when the player godmode started
MY_GameObject groundObject
the object that is right under the player's feet
Boolean hasVisor
True if player uses visor, else False
MY_InventoryList inventoryList
a list that contains all amounts of your inventoriy items
Boolean isCrouching
True if player is crouching
Boolean isJumping
True if player is jumping
KX_Camera lookCamera
the camera object the player uses for looking around (for example: first person or third person)
Integer mag
the total amount of the player's mag
Boolean oppositePlane
True if player is on one of the planes which gravity vector goes in th direction of z, -x or -y
KX_GameObject rotationPointObject
the object to set at the center of a rotation object while doing a oneighty
Float shotInterval
the interval of shots
Float shotTime
the time when you shot a bullet
Float sinX
the sinus amount of looking up and down
Integer stepDown
Amount of the time to get the player back to ground
Boolean stepUp
True if payer wants to go upstairs
Boolean superGun
the player has collected the rare super gun in the game
Integer turnDuration
the duration of a turn
Boolean useSuperGun
True if the player is currently using the super gun, else False
Float visorAnimStart
the time when player clicked the v-key to get his visor
KX_GameObject visualInput
the object to set at the screen to let the player know what orientation he/she/it has
KX_GameObject visualInputObject
the actual object the payer will see as visual feedback for his/her orientation
Float wallStartTime
the start time of a wallturn
Boolean wallTurn
True if player makes a ninety or oneighty turn
Boolean wallTurnEnd
True if a turn just ended
Integer (0,1,2) worldPlane
the players current plane
Float zLook
amount of the rotation angle around the z-axis
Float zTurn
the rotation about z-axis; just for calculating the wallturn while turning
    Inherited from MyGameObjects.MY_GameObjectActive
KX_GameObject gObject
a blender game object
String name
the name that represents the object in MY_SingleScene
String type
a name which identifies the object as a specific class in MY_SingleScene
Method Details [hide private]

__init__(self, scene, element)
(Constructor)

source code 
Parameters:
  • scene - the blender scene object which holds all objects
  • element - the name of the light object which shall included into the MY_SingleScene class
Overrides: MyGameObjects.MY_GameObjectActive.__init__
(inherited documentation)

setView(self, window_metric)

source code 

sets the players view. to switch between first person and third persion view

Parameters:
  • window_metric (List [Integer, Integer]) - a list of thw width and height of the game window

jump(self, speed, force)

source code 

sets the jump digit of the speed vector with the given force

Parameters:
  • speed (Vector) - the speed vector of the player
  • force (Integer) - the power of the jump
Returns: Vector
the prepared speed vector

marioJump(self, hurdle_pos)

source code 

sets the mario jump, to get out of the way of an enemy after get hurt once

Parameters:
  • hurdle_pos (Vector) - the global position of the hurdle

move(self, fwd, back, left, right, force)

source code 

calculates the movement of the object, dependent on given input parameters (direction and force)

Parameters:
  • fwd (Boolean) - the power of forward movement
  • back (Boolean) - the power of backward movement
  • left (Boolean) - the power of left movement
  • right (Boolean) - the power of right movement
  • force (Integer) - the speed of the player's total movement
Returns: Vector
the prepared speed vector for the player's character

look(self, mouse_screen_pos, dtime, sensitivity)

source code 

sets the players actual camera view dependent on user's mouse input, elapsed time and sensitivity

Parameters:
  • mouse_screen_pos (List [Integer, Integer]) - the position of the mouse on the screen related to the window metric
  • dtime (Float) - the delta of time between two logical ticks
  • sensitivity (Float) - the speed of turning your eyes around

initOneighty(self, turn_duration)

source code 

initialize the 'Oneighty' with the right parameters and given duration it sets the used member variables with the right values to know how to rotate and the local rotation of the player afterwards and parents the player to the rotating ground object

Parameters:
  • turn_duration (Integer) - how fast/slow the turn shall be

initWallRun(self, global_collision_side, hit_plane, turn_duration)

source code 

initialize the wall turn. it sets the used member variables with the right values

Parameters:
  • global_collision_side (Integer (0,1,2,3)) - where is the wall globally? (at least to know rotation axis)
  • hit_plane (Integer (0,1,2)) - the plane of the hit object, to know the player's world plane after rotation
  • turn_duration (Integer) - time to rotate

setInventoryItem(self, item_name, add)

source code 

sets or removes given item into the inventory

Parameters:
  • item_name (String) - the name of the item that was used/collected
  • add (Boolean) - True if the item was collected, False if it was used
Returns: Boolean
'True' if item is in inventory, else 'False'

getItemLifeTime(self, name)

source code 

sets the lifetime of an used item

Parameters:
  • name (String) - the name of the used item to get its lifetime
Returns: Boolean
'True' if item is still alive, else 'False'

setMerchItem(self, merch_name)

source code 

adds a given merchandise item into the inventory

Parameters:
  • merch_name (String) - the name of the merch item that was collected