blob: d5bc1a770c2bc898a22aba3e747cf1c845329cc6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
Entities will have an ActionQueue component. The ActionQueue is a set of actions and durations within which those
actions may be applied. This will solve the issue of buffering inputs as well as having multiple systems control which
actions an entity might take (for a future AI system, perhaps?).
Let's introduce the jumping mechanics of this game as an example of the system interaction with entities.
When the player presses a key mapped to a Jumping action, a Jump action is queued and expires in 80 milliseconds.
The JumpSystem consumes the action if the entity is able to "physically" jump:
- it is in contact with a solid underneath and has zero velocity on the y axis (?) and there is no current Jump component
- or, there is a Jump component but the "availableJump" counter is greater than zero (it is decremented on consumption
of the Jump action), to account for the future of a double jump being possible.
If the JumpSystem does not consume() the action within the allotted 80 milliseconds, the action expires and is removed
from the queue.
The queue is an action-singleton queue. Meaning, enqueueing an action has the effect of replacing any action of the same
type whose expiration is earlier than the enqueued action.
|