Package pygsear :: Module Path :: Class PathNG |
[show private | hide private]
[frames | no frames]

## Class PathNG

    Path --+
           |
          PathNG

Next-generation Path

This one will integrate all of these disparate Path subclasses in to one uberclass. I think this will make it more usable.

Method Summary
| `__init__(self, startLocation, vx, vy, ax, ay, gx, gy, duration)`
| ``accelerate`(self, acc)` Accelerate in the direction currently moving.
| ``bounce_x`(self)` reverse travel in x-direction
| ``bounce_y`(self)` reverse travel in y-direction
| ``decelerate`(self, dec)` Decelerate according to the direction currently moving.
| ``direction`(self, point)` return direction to a point
| ``distance`(self, point)` return distance to a point
| ``get_acceleration`(self)` return acceleration
| ``get_direction`(self)` return direction of travel
| ``get_speed`(self)` return speed
| ``get_velocity`(self)` return velocity
| ``next`(self, t)` return next position along path
| ``reset`(self)` Go back to initial position, velocity and acceleration
| ``set_acceleration`(self, ax, ay)` Set acceleration.
| ``set_deceleration`(self, dex, dey)` Set deceleration.
| ``set_direction`(self, direction)` set direction of travel
| ``set_gravity`(self, gx, gy)` Set constant portion of acceleration (ie gravity)
| ``set_restriction`(self, onscreen, **kw)` Set a constraint on the path.
| ``set_speed`(self, speed, change)` Change speed while keeping the same direction of movement.
| ``set_startAcceleration`(self, accel)` Set acceleration to back go to on reset()
| ``set_startLocation`(self, location)` Set location to go back to on reset()
| ``set_startVelocity`(self, vel)` Set velocity to go back to on reset()
| ``set_turnRate`(self, turnRate)` set turn rate in rad/s
| ``set_velocity`(self, special, vx, vy)` Set velocity
| `show_restrictions(self)`
| ``turn`(self, rad)` turn to the left by radians
| `turn_left(self)`
| `turn_right(self)`
| `turn_straight(self)`
| ``turn_towards`(self, point)` turn as quickly as possible towards a point
| `_set_velocity(self, vx, vy)`
Inherited from Path
| ``__iter__`(self)`
| ``get_position`(self)` Return position along Path
| ``get_x`(self)` return x component of position
| ``get_y`(self)` return y component of position
| ``onscreen`(self, slack)` true if path position is on main window
| ``pause`(self)` stop moving along path
| ``set_endTime`(self, duration)` Path will raise StopIteration after self.duration seconds
| ``set_position`(self, position)` Set position and update positionOld
| ``unpause`(self)` resume moving along path

Method Details

### accelerate(self, acc) Accelerate in the direction currently moving. Accelerates toward 0 (right side of screen) if not moving.

### bounce_x(self) reverse travel in x-direction

### bounce_y(self) reverse travel in y-direction

### decelerate(self, dec) Decelerate according to the direction currently moving.

### direction(self, point) return direction to a point

### distance(self, point) return distance to a point

### get_acceleration(self) return acceleration Note that the acceleration may actually be a deceleration.

### get_direction(self) return direction of travel Direction is given in radians. 0 radians is towards the right edge of the screen. Overrides: `pygsear.Path.Path.get_direction`

### get_speed(self) return speed

### get_velocity(self) return velocity

### next(self, t=None) return next position along path Overrides: `pygsear.Path.Path.next`

### reset(self) Go back to initial position, velocity and acceleration #Also updates self.ticks to current time Overrides: `pygsear.Path.Path.reset`

### set_acceleration(self, ax=None, ay=None) Set acceleration. Change in speed depends on the acceleration and the time between frames. Parameters: `ax` - horizontal acceleration component `ay` - vertical acceleration component

### set_deceleration(self, dex=None, dey=None) Set deceleration. Like acceleration, but acts to oppose the current velocity and will not change a 0 velocity. Can only accelerate or decelerate in a particular direction. Note that when using deceleration, the ax or ay value is always kept as an absolute value and a deceleration flag. There is no way to do "negative acceleration". Parameters: `dex` - horizontal acceleration component `dey` - vertical acceleration component

### set_direction(self, direction) set direction of travel Maintains current speed.

### set_gravity(self, gx=None, gy=None) Set constant portion of acceleration (ie gravity) Parameters: `gx` - horizontal acceleration component `gy` - vertical acceleration component

### set_restriction(self, onscreen=None, **kw) Set a constraint on the path. Restrictions are set as keyword arguments. So far these are the contraints that work: speed: maximum speed xMin: minimum x-value yMin: minimum y-value xMax: maximum x-value yMax: maximum y-value vxMin: minimum x-velocity (remember negative values) vyMin: minimum y-velocity vxMax: maximum x-velocity vyMax: maximum y-velocity Parameters: `onscreen` - set to nonzero value if the object should be limited to staying on the screen.

### set_speed(self, speed=None, change=None) Change speed while keeping the same direction of movement. Parameters: `speed` - New speed (must set speed OR change) `change` - Change in speed (must set speed OR change)

### set_startAcceleration(self, accel=None) Set acceleration to back go to on reset() Parameters: `accel` - (ax, ay) horizontal and vertical acceleration components

### set_startLocation(self, location=None) Set location to go back to on reset() Parameters: `location` - (x, y) position If location is not given (or None), sets startLocation to current location.

### set_startVelocity(self, vel=None) Set velocity to go back to on reset() Parameters: `vel` - (vx, vy) horizontal and vertical velocity components

### set_turnRate(self, turnRate=0) set turn rate in rad/s

### set_velocity(self, special=None, vx=None, vy=None) Set velocity Parameters: `special` - Set to 'random' for a random velocity `vx` - horizontal velocity component `vy` - vertical velocity component

### turn(self, rad=None) turn to the left by radians

### turn_towards(self, point) turn as quickly as possible towards a point

Generated by Epydoc 2.0 on Fri Nov 11 14:26:38 2005 | http://epydoc.sf.net