- When acceleration results in a velocity vector in the opposite direction
of the current velocity, zero out velocity
- Moved maxVelocity from VelocityComponent to AccelerationComponent
-
- Remove requirement of an Engine instance in ComponentMapper instances,
as the Engine from the entity passed to get() can be used. Allows for
static initialization of ComponentMappers.
- Store instances of ComponentMapper in a static Map within the
ComponentMapper class itself, rather that inside of Engine.
- Name bit/bits consistently. Some cases of bits were renamed to bit,
such as ComponentType getBits() is now getBit(). Change usage of Mask to
just Bits for consistency.
- Modify access modifiers and field finality where appropriate
- Add comments to public methods in Engine
Let's just call them meters.
Get rid of Viewport and handle world scaling based on screen height:
- Keep world height at a constant 10 meters and scale width according
to screen dimensions.
Add uiSpriteBatch used for rendering UI elements at appropriate scale
Now more like an actual game. Score, lives, and when you die, you get
respawned. If you die rnough times, you Game Over, and your lives and
score are reset. Each time you get 10000 points, you gain a life!
Add GameMode enum
Add GameDataSystem which manipulates the current game data based on events.
Add GameDataRenderSystem which renders the current game data.
Add AsteroidHitEvent and PlayerDeathEvent which are are fired when an
asteroid is destroyed or the player is killed, respectively.
Add SpriteBatch to Graphics
Rename createPlayerDebris -> createDebris to make it clear it's not only
for the player entity.
Add Constants.ASTEROID_SPAWN_COUNT
Slow down asteroids, tweak sizing
Reduced explosion direction variation and max angular velocity so it's
more apparent that the lines were from the original ship.
Removed subtraction then adding back of player position from getLineModels
Formatting + comments.
When rotation was < 0, we were subtracting it from 360, which was
producing a number larger than 360. We should have been adding it to 360,
not subtracting.
Moved angle wrapping math to a separate function.
* Add AsteroidSpawningSystem which adds asteroids to the game at a regular
interval up to a set limit.
* Add EventFactory for generating entity-specific Collision events
* Detect asteroids being shot with BulletAsteroidCollisionEvent
* Add DEBUG output to creating entities
* New getPointAlongPolygon utils function
Consolidate toRemove, toEnable toDisable into toRefresh, move logic of
whether an entity should be added or removed to an EntitySystem into
EntitySystem.
Entities now have a systemBits member which represents which
systems they're currently a part of and is used by the refresh() logic
in EntitySystem.
Adding or removing components from an entity after it has been created
and activated will now add or remote the entity from relevant systems.
Some other minor changes:
* Made ComponentType final + package-private
* Made Entity and ComponentType id protected to allow direct access from
Engine
* Made ComponentType bits protected to allow direct access from Entity
* Made Entity componentBIts protected to allow direct access from
ComponentMapper and EntitySystem
Store cache of interested entities in each system.
Perform entity activation, deactivation and removal outside of the update
loop.
Instead of throwing an exception when trying to get a Component from
ComponentBag that is out of range, just return null. This is to allow
systems to try getting a Component it isn't registered for.
Fixed ComponentType.isTypeInMask
Rather than place entities directly on the screen edge boundary, add the
distance they were beyond the screen edge.
Store aabb in ModelComponent for use by multiple systems.