.. api:: gma.character .. api:: character gma.character ============= Provides a character object =================== ==================================================== Package gma/entities/character Inheritance chain :api:`gma.shapes.rectangle` >> :api:`gma.moveable` =================== ==================================================== Tags ---- *shape*, *moveable*, *character* Properties ---------- .. admonition:: Inherited from :api:`gma.moveable` :prop:`yState `, :prop:`xState `, :prop:`lastXState `, :prop:`velocity `, :prop:`jumpVelocity ` .. admonition:: Inherited from :api:`gma.shapes.rectangle` :prop:`points `, :prop:`edges `, :prop:`width `, :prop:`height `, :prop:`depth `, :prop:`z `, :prop:`x `, :prop:`y `, :prop:`centre `, :prop:`left `, :prop:`right `, :prop:`top `, :prop:`bottom `, :prop:`yOffset `, :prop:`xOffset `, :prop:`type `, :prop:`alive `, :prop:`solid `, :prop:`tags ` .. _gma.character.score: .. prop:: gma.character.score **score** Holds a score counter +------+--------+ | Type | Number | +------+--------+ Methods ------- .. admonition:: Inherited from :api:`gma.moveable` :metho:`getMovement `, :metho:`animate `, :metho:`findGround `, :metho:`updatePositions `, :metho:`getRotation `, :metho:`kill ` .. admonition:: Inherited from :api:`gma.shapes.rectangle` :metho:`setPointsAndEdges `, :metho:`setCentre `, :metho:`setBottomLeft `, :metho:`xOf `, :metho:`yOf `, :metho:`toString `, :metho:`collided__deathtouch ` .. index:: pair: character; jump() .. _gma.character.jump: .. metho:: gma.character.jump **jump** (e) | Makes character ready for jumping | It will only set character to jumping if it's in the STILL state | It will also set self.targetY to it's current y plus it's jumpHeigt +----------------------------------------------------------------------------------+ | Parameters | +=======+================+=========================================================+ | e | Event | Keyboard event object | +-------+----------------+---------------------------------------------------------+ .. index:: pair: character; move() .. _gma.character.move: .. metho:: gma.character.move **move** (direction, e) Changes character's horizontal state +------------------------------------------------------------------------------------------------------+ | Parameters | +===========+=====================+====================================================================+ | direction | :api:`gma.constant` | gma.constant representing whether character is going left or right | +-----------+---------------------+--------------------------------------------------------------------+ | e | Event | Keyboard event object | +-----------+---------------------+--------------------------------------------------------------------+ .. index:: pair: character; collided() .. _gma.character.collided: .. metho:: gma.character.collided **collided** (where, focus, focusSide, focusVector) | Collided function for character | Determines if we hit a collectable and what to do with it **Overrides** :metho:`gma.shapes.rectangle.collided ` +-------------------------------------------------------------------------------------+ | Parameters | +=============+=====================+=================================================+ | where | :api:`gma.constant` | Side of this object that was collided with | +-------------+---------------------+-------------------------------------------------+ | focus | object | Thing we collided with | +-------------+---------------------+-------------------------------------------------+ | focusSide | :api:`gma.constant` | Side of the focus object that was collided with | +-------------+---------------------+-------------------------------------------------+ | focusVector | [x,y] | Amount focus is trying to move | +-------------+---------------------+-------------------------------------------------+ .. index:: pair: character; collided__pickupCollectable() .. _gma.character.collided__pickupCollectable: .. metho:: gma.character.collided__pickupCollectable **collided__pickupCollectable** (where, focus, focusSide, focusVector) Collision function for hitting a collectable +-------------------------------------------------------------------------------------+ | Parameters | +=============+=====================+=================================================+ | where | :api:`gma.constant` | Side of this object that was collided with | +-------------+---------------------+-------------------------------------------------+ | focus | object | Thing we collided with | +-------------+---------------------+-------------------------------------------------+ | focusSide | :api:`gma.constant` | Side of the focus object that was collided with | +-------------+---------------------+-------------------------------------------------+ | focusVector | [x,y] | Amount focus is trying to move | +-------------+---------------------+-------------------------------------------------+