Panda3D

Loading...
Searching...
No Matches
Public Member Functions | List of all members
TwoDWalker Class Reference
Inheritance diagram for TwoDWalker:

## Public Member Functions
| __init__ (self, gravity=-32.1740, standableGround=0.707, hardLandingForce=16.0)
| handleAvatarControls (self, task)
| jumpPressed (self)
Public Member Functions inherited from GravityWalker
| __init__ (self, gravity=64.348, standableGround=0.707, hardLandingForce=16.0, legacyLifter=False)
| addBlastForce (self, vector)
| debugPrint (self, message)
| deleteCollisions (self)
| disableAvatarControls (self)
| displayDebugInfo (self)
| doDeltaPos (self)
| enableAvatarControls (self)
| flushEventHandlers (self)
| getAirborneHeight (self)
| getCollisionsActive (self)
| getGravity (self, gravity)
| getIsAirborne (self)
| getSpeeds (self)
| getVelocity (self)
| initializeCollisions (self, collisionTraverser, avatarNodePath, avatarRadius=1.4, floorOffset=1.0, reach=1.0)
| oneTimeCollide (self)
| placeOnFloor (self)
| reset (self)
| setAirborneHeightFunc (self, unused_parameter)
| setAvatar (self, avatar)
| setAvatarPhysicsIndicator (self, indicator)
| setCollisionRayHeight (self, height)
| setCollisionsActive (self, active=1)
| setFloorBitMask (self, bitMask)
| setGravity (self, gravity)
| setMayJump (self, task)
| setPriorParentVector (self)
| setTag (self, key, value)
| setupEventSphere (self, bitmask, avatarRadius)
| setupFloorSphere (self, bitmask, avatarRadius)
| setupRay (self, bitmask, floorOffset, reach)
| setupWallSphere (self, bitmask, avatarRadius)
| setWalkSpeed (self, forward, jump, reverse, rotate)
| setWallBitMask (self, bitMask)
| startJumpDelay (self, delay)
| swapFloorBitMask (self, oldMask, newMask)
Public Member Functions inherited from DirectObject
| __init__ (self)
| accept (self, event, method, extraArgs=[])
| acceptOnce (self, event, method, extraArgs=[])
| addTask (self, *args, **kwargs)
| detectLeaks (self)
| doMethodLater (self, *args, **kwargs)
| getAllAccepting (self)
| ignore (self, event)
| ignoreAll (self)
| isAccepting (self, event)
| isIgnoring (self, event)
| removeAllTasks (self)
| removeTask (self, taskOrName)

## Additional Inherited Members
Public Attributes inherited from GravityWalker
| avatar = avatar
int | avatarControlForwardSpeed = 0
int | avatarControlJumpForce = 0
int | avatarControlReverseSpeed = 0
int | avatarControlRotateSpeed = 0
| avatarNodePath = CollisionHandlerPusher()
| avatarRadius = avatarRadius
| cEventSphereNodePath = cSphereNodePath
| cFloorSphereNodePath = cSphereNodePath
int | collisionsActive = 0
| controlsTask = None
| cRay = CollisionRay(0.0, 0.0, CollisionHandlerRayStart, 0.0, 0.0, -1.0)
| cRayNodePath = self.avatarNodePath.attachNewNode(cRayNode)
| cTrav = collisionTraverser
| cWallSphereNodePath = cSphereNodePath
| event = CollisionHandlerEvent()
int | falling = 0
| floorBitmask = bitMask
| getAirborneHeight = None
int | highMark = 0
| indicatorTask = None
int | isAirborne = 0
| jumpDelayTask = None
| lifter = CollisionHandlerGravity()
int | mayJump = 1
int | moving = 0
int | needToDeltaPos = 0
| physVelocityIndicator = None
| priorParent = Vec3(0)
| pusher = CollisionHandlerFluidPusher()
| pusherFloor
| pusherFloorhandler = CollisionHandlerPusher()
float | rotationSpeed = 0.0
float | slideSpeed = 0.0
float | speed = 0.0
| vel = Vec3(0.0)
| wallBitmask = bitMask
Static Public Attributes inherited from GravityWalker
int | DiagonalFactor = math.sqrt(2.) / 2.
| earlyEventSphere = ConfigVariableBool('early-event-sphere', False)
| notify = directNotify.newCategory("GravityWalker")
| wantDebugIndicator = ConfigVariableBool('want-avatar-physics-indicator', False)
| wantFloorSphere = ConfigVariableBool('want-floor-sphere', False)
Static Public Attributes inherited from DirectObject
| accept_once = acceptOnce
| add_task = addTask
| detect_leaks = detectLeaks
| do_method_later = doMethodLater
| get_all_accepting = getAllAccepting
| ignore_all = ignoreAll
| is_accepting = isAccepting
| is_ignoring = isIgnoring
| remove_all_tasks = removeAllTasks
| remove_task = removeTask
Protected Member Functions inherited from DirectObject
| _addTask (self, task)
| _clearTask (self, task)
Protected Attributes inherited from GravityWalker
| _legacyLifter = legacyLifter
Protected Attributes inherited from DirectObject
dict | _taskList = {}

## Detailed Description

    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.

## Constructor & Destructor Documentation

## ◆ __init__()

__init__ | ( |  | self,
|  |  | gravity = -32.1740,
|  |  | standableGround = 0.707,
|  |  | hardLandingForce = 16.0 )

## Member Function Documentation

## ◆ handleAvatarControls()

handleAvatarControls | ( |  | self,
|  |  | task )

    Check on the arrow keys and update the avatar.

Reimplemented from GravityWalker.

## ◆ jumpPressed()

jumpPressed | ( |  | self | ) |

    This function should be called from TwoDDrive when the jump key is pressed.