add generic move support for enemies
This commit is contained in:
parent
4e4224dc59
commit
c3d7827b7c
2 changed files with 11 additions and 1 deletions
|
@ -64,6 +64,11 @@ static inline int enemy_call_logic_rule(Enemy *e, int t) {
|
|||
|
||||
if(e->logic_rule) {
|
||||
return e->logic_rule(e, t);
|
||||
} else {
|
||||
// TODO: backport unified left/right move animations from the obsolete `newart` branch
|
||||
e->moving = cabs(e->move.velocity) >= 1;
|
||||
e->dir = creal(e->move.velocity) < 0;
|
||||
e->pos += move_update(&e->move);
|
||||
}
|
||||
|
||||
return ACTION_NONE;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "objectpool.h"
|
||||
#include "entity.h"
|
||||
#include "coroutine.h"
|
||||
#include "move.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#define ENEMY_DEBUG
|
||||
|
@ -40,7 +41,11 @@ struct Enemy {
|
|||
cmplx pos;
|
||||
cmplx pos0;
|
||||
cmplx pos0_visual;
|
||||
cmplx args[RULE_ARGC];
|
||||
|
||||
union {
|
||||
cmplx args[RULE_ARGC];
|
||||
MoveParams move;
|
||||
};
|
||||
|
||||
EnemyLogicRule logic_rule;
|
||||
EnemyVisualRule visual_rule;
|
||||
|
|
Loading…
Reference in a new issue