# TwoDWalker

from direct.controls.TwoDWalker import TwoDWalker

The TwoDWalker is primarily for a 2D Scroller game environment. Eg - Toon Blitz minigame. TODO: This class is still work in progress. Currently Toon Blitz is using this only for jumping. Moving the Toon left to right is handled by toontown/src/minigame/TwoDDrive.py. I eventually want this class to control all the 2 D movements, possibly with a customizable input list.

## Inheritance:

TwoDWalker: GravityWalker
GravityWalker:

## Methods of TwoDWalker:

__init__
handleAvatarControls
jumpPressed

## Methods of GravityWalker:

__init__
addBlastForce
deleteCollisions
disableAvatarControls
displayDebugInfo
doDeltaPos
enableAvatarControls
flushEventHandlers
getAirborneHeight
getCollisionsActive
getGravity
getIsAirborne
getSpeeds
getVelocity
handleAvatarControls
initializeCollisions
oneTimeCollide
placeOnFloor
reset
setAirborneHeightFunc
setAvatar
setAvatarPhysicsIndicator
setCollisionsActive
setFloorBitMask
setGravity
setMayJump
setPriorParentVector
setTag
setupEventSphere
setupFloorSphere
setupRay
setupWallSphere
setWalkSpeed
setWallBitMask
startJumpDelay
swapFloorBitMask

__init__ def __init__(self, gravity=-32.1740, standableGround=0.707, hardLandingForce=16.0) Undocumented function.

handleAvatarControls def handleAvatarControls(self, task) Check on the arrow keys and update the avatar.

jumpPressed def jumpPressed(self) This function should be called from TwoDDrive when the jump key is pressed.

__init__ def __init__(self, gravity=64.348, standableGround=0.707, hardLandingForce=16.0) Undocumented function.

addBlastForce def addBlastForce(self, vector) Undocumented function.

deleteCollisions def deleteCollisions(self) Undocumented function.

disableAvatarControls def disableAvatarControls(self) Ignore the arrow keys, etc.

displayDebugInfo def displayDebugInfo(self) For debug use.

doDeltaPos def doDeltaPos(self) Undocumented function.

enableAvatarControls def enableAvatarControls(self) Activate the arrow keys, etc.

flushEventHandlers def flushEventHandlers(self) Undocumented function.

getAirborneHeight def getAirborneHeight(self) Undocumented function.

getCollisionsActive def getCollisionsActive(self) Undocumented function.

getGravity def getGravity(self, gravity) Undocumented function.

getIsAirborne def getIsAirborne(self) Undocumented function.

getSpeeds def getSpeeds(self) Undocumented function.

getVelocity def getVelocity(self) Undocumented function.

handleAvatarControls def handleAvatarControls(self, task) Check on the arrow keys and update the avatar.

initializeCollisions def initializeCollisions(self, collisionTraverser, avatarNodePath, avatarRadius=1.4, floorOffset=1.0, reach=1.0) floorOffset is how high the avatar can reach. I.e. if the avatar walks under a ledge that is <= floorOffset above the ground (a double floor situation), the avatar will step up on to the ledge (instantly). Set up the avatar collisions

oneTimeCollide def oneTimeCollide(self) Makes one quick collision pass for the avatar, for instance as a one-time straighten-things-up operation after collisions have been disabled.

placeOnFloor def placeOnFloor(self) Make a reasonable effor to place the avatar on the ground. For example, this is useful when switching away from the current walker.

reset def reset(self) Undocumented function.

setAirborneHeightFunc def setAirborneHeightFunc(self, unused_parameter) Undocumented function.

setAvatar def setAvatar(self, avatar) Undocumented function.

setAvatarPhysicsIndicator def setAvatarPhysicsIndicator(self, indicator) indicator is a NodePath

setCollisionsActive def setCollisionsActive(self, active=1) Undocumented function.

setFloorBitMask def setFloorBitMask(self, bitMask) Undocumented function.

setGravity def setGravity(self, gravity) Undocumented function.

setMayJump def setMayJump(self, task) This function's use is internal to this class (maybe I'll add the __ someday). Anyway, if you want to enable or disable jumping in a general way see the ControlManager (don't use this).

setPriorParentVector def setPriorParentVector(self) Undocumented function.

setTag def setTag(self, key, value) Undocumented function.

setupEventSphere def setupEventSphere(self, bitmask, avatarRadius) Set up the collision sphere

setupFloorSphere def setupFloorSphere(self, bitmask, avatarRadius) Set up the collision sphere

setupRay def setupRay(self, bitmask, floorOffset, reach) Undocumented function.

setupWallSphere def setupWallSphere(self, bitmask, avatarRadius) Set up the collision sphere

setWalkSpeed def setWalkSpeed(self, forward, jump, reverse, rotate) Undocumented function.

setWallBitMask def setWallBitMask(self, bitMask) Undocumented function.

startJumpDelay def startJumpDelay(self, delay) Undocumented function.

swapFloorBitMask def swapFloorBitMask(self, oldMask, newMask) Undocumented function.