HoverSim Design
From Hovercraft
(Difference between revisions)
Line 2: | Line 2: | ||
This design refers to the core classes of the HoverSim API. | This design refers to the core classes of the HoverSim API. | ||
+ | |||
+ | =TimeKeeper= | ||
+ | Keeps track of navigation time score. | ||
+ | |||
+ | * float time | ||
+ | * update(elapsed) | ||
+ | |||
+ | Adds 60 seconds to time | ||
+ | * bumpedIntoWall() | ||
=CraftComponent= | =CraftComponent= | ||
Line 8: | Line 17: | ||
* CraftComponent parent | * CraftComponent parent | ||
- | Relative properties | + | Relative properties: |
* Vector2 position | * Vector2 position | ||
* float orientation | * float orientation | ||
* Vector2 velocity | * Vector2 velocity | ||
- | Absolute properties | + | Absolute properties: |
* Vector2 absPosition | * Vector2 absPosition | ||
* float absOrientation | * float absOrientation | ||
* Vector2 absVelocity | * Vector2 absVelocity | ||
- | Recalculate absolute properties using the parent as a reference | + | Recalculate absolute properties using the parent as a reference. |
* recalcAbsoluteProperties() | * recalcAbsoluteProperties() | ||
Line 29: | Line 38: | ||
* float radius | * float radius | ||
* __init__(weight, radius) | * __init__(weight, radius) | ||
+ | |||
+ | Calculates new position, velocity and orientation. Performs collision detection. | ||
+ | * update(elapsed) | ||
==Sensor(CraftComponent)== | ==Sensor(CraftComponent)== | ||
Line 35: | Line 47: | ||
===LightSensor(Sensor)=== | ===LightSensor(Sensor)=== | ||
- | Implements a light sensor with the specified range | + | Implements a light sensor with the specified range. |
* __init__(range) | * __init__(range) | ||
* read() | * read() | ||
Line 41: | Line 53: | ||
==Fan(CraftComponent)== | ==Fan(CraftComponent)== | ||
* thrust() | * thrust() | ||
+ | |||
+ | =Controller= | ||
+ | Called each frame to control the hovercraft. This should be overriden. | ||
+ | * update(craft, elapsed) |
Current revision as of 14:44, 26 September 2006
Contents |
Introduction
This design refers to the core classes of the HoverSim API.
TimeKeeper
Keeps track of navigation time score.
- float time
- update(elapsed)
Adds 60 seconds to time
- bumpedIntoWall()
CraftComponent
Base class for all craft components.
- CraftComponent parent
Relative properties:
- Vector2 position
- float orientation
- Vector2 velocity
Absolute properties:
- Vector2 absPosition
- float absOrientation
- Vector2 absVelocity
Recalculate absolute properties using the parent as a reference.
- recalcAbsoluteProperties()
HoverCraft(CraftComponent)
Base class for hovercraft vehicles. Assumes a circular shape.
- Vector2 thrust
- float weight
- float radius
- __init__(weight, radius)
Calculates new position, velocity and orientation. Performs collision detection.
- update(elapsed)
Sensor(CraftComponent)
Base class for sensor components
- read()
LightSensor(Sensor)
Implements a light sensor with the specified range.
- __init__(range)
- read()
Fan(CraftComponent)
- thrust()
Controller
Called each frame to control the hovercraft. This should be overriden.
- update(craft, elapsed)