Module MyGamePassiveParts :: Class MY_GameStair
[hide private]
[frames] | no frames]

Class MY_GameStair

source code

MyGameObjects.MY_GameObjectPassive --+
                                     |
                                    MY_GameStair

class of all stair-like objects to set the right location and orientation etc.

Instance Methods [hide private]
 
__init__(self, scene, name, scale) source code
 
setElement(self, side_location, prev_plane)
initiates the calculation of position, orientation, midpoint, boundingbox and worldplane
source code
List[Integer (0,1,2,3), Vector]
getFreeSidesPositions(self)
gets the positions of the not already connected sides of the object
source code
Vector
getRightPlanePoint(self, point)
gets the right point for a connection after all the creepy rotations of stairs and single steps :)
source code
List
getBoundingBox(self)
gets the bounding box
source code
 
setMidPoint(self)
sets th mid point for rotation (stair objects rotation point is at the first face!)
source code
    Inherited from MyGameObjects.MY_GameObjectPassive
 
delConnectedSide(self, connected_object)
deletes entry out of the connected side list
source code
Boolean
deleteObject(self, now=False, recursive_delete=True)
deletes the object.
source code
List
getChildren(self)
gets the direct children which are connected to the object
source code
Integer (0,1,2)
getPlane(self)
gets the world plane the object is in
source code
Vector
getPosition(self)
gets the world position
source code
 
initPop(self, pop_steps, pop_start, duration)
initialize popping when object is spawned
source code
 
pop(self, do_pop, natal=True)
pops the object with its initialized parameters
source code
 
setAlive(self, alive)
sets the object and its children to dead if necessary or the object to alive
source code
 
setConnectedSide(self, connected_side, connected_object)
sets list for connected sides with the right id at the right position in the array
source code
 
setNewPlaneOnRotation(self, prev_plane, connected_dir)
sets new plane after orthogonal rotation dependent on the plane of connected object and its connected direction
source code
Instance Variables [hide private]
Boolean isUp
True if the stair object goes upwards (will be initialized by a random for the lazy ones)
Vector midPoint
the center of the object (at least the right pivot, because at creation point of some elements the pivot is wrong.
Vector origScale
the original scale factor
    Inherited from MyGameObjects.MY_GameObjectPassive
Boolean alive
True if object is destined for deletion (in the future)
List boundingBox
contains all points of the bounding box which delimitates the object
Dict connectedSides
a dictionary (in form of a quadrupel) which contains the connected objects (otherwise: None) in specific way {north=+y, east=+x, south=-y, west=-x}
Integer curPopStep
the current pop step
Vector curScale
the current scale factor
Integer deleteDelay
the amount of the delay for deleting the object; set to '<0' for no deletion
Integer elementId
a unique identifier
KX_GameObject gObject
a blender game object
Boolean hasItem
True if the object has an item to administrate while deletion, otherwise False
MY_GameObject hurdleObject
the hurdle object that is on THIS object (for oneighty turns), if no hurdle is near this variable is 'None'
Integer (0,1,2) isRotated
three states: 0 = up; 1 = down; 2 = normal (in the xy-plane)
MY_GameObject item
the item object that is on top/bottom of tis object
String name
the name of the object
Integer popDuration
the duration of popping
Float popStart
the start time of popping
Integer popSteps
the number of steps for popping
MY_GameObject rootConnectObject
the connected object that leads to the players ground object
String type
a name which identifies the object as a specific class in MY_SingleScene
Integer (0,1,2,3) worldDirection
the global adjustment of the object (plane 0: 0=+y; 1=+x; 2=-y; 3=+x / plane 1: 0=+z; 1=+x; 2=-z; 3=+x / plane 2: 0=+z; 1=+y; 2=-z; 3=+y)
Integer (0,1,2) worldPlane
the objects plane information (0=xy; 1=xz; 2=yz)
Method Details [hide private]

__init__(self, scene, name, scale)
(Constructor)

source code 
Parameters:
  • scene (KX_Scene) - the blender scene object where all other objects are connected to
  • name (String) - the name the object shall have in MY_SingleScene
  • scale (Integer) - the new scaling factor to increase the variance of the stair objects
Overrides: MyGameObjects.MY_GameObjectPassive.__init__

setElement(self, side_location, prev_plane)

source code 

initiates the calculation of position, orientation, midpoint, boundingbox and worldplane

Parameters:
  • side_location (List[Integer (0,1,2,3), Vector]) - to know exactly where the connection point is; that means what direction and at what position
  • prev_plane (Integer (0,1,2)) - you have to know the previous plane (the plane of the object that this object is connected to) because of ninety degree turns

getFreeSidesPositions(self)

source code 

gets the positions of the not already connected sides of the object

Returns: List[Integer (0,1,2,3), Vector]
returns the free sides (direction and position)

getRightPlanePoint(self, point)

source code 

gets the right point for a connection after all the creepy rotations of stairs and single steps :)

Parameters:
  • point (Vector) - the point that is calculated in the xy-plane before any rotation and translation of the object
Returns: Vector
returns the right free side point

getBoundingBox(self)

source code 

gets the bounding box

Returns: List
returns a list of all the vector points that represents the bounding box

Instance Variable Details [hide private]

midPoint

the center of the object (at least the right pivot, because at creation point of some elements the pivot is wrong. so you have to use this one to get the right rotations)
Type:
Vector