2021-02-07 21:56:19 +00:00
|
|
|
(local util (require :lib.util))
|
2021-03-07 16:55:50 +00:00
|
|
|
(local {: vec* : vec+ : dir-from-key} (util.require :game.helpers))
|
2021-02-07 21:56:19 +00:00
|
|
|
(local rules (require :game.rules))
|
2021-03-07 16:55:50 +00:00
|
|
|
(local dim (require :game.dim))
|
2021-02-07 21:56:19 +00:00
|
|
|
|
2021-03-07 16:55:50 +00:00
|
|
|
(local entity {})
|
|
|
|
(fn entity.move [pos vel dt]
|
|
|
|
(vec+ pos (vec* vel dt)))
|
|
|
|
|
|
|
|
(fn entity.direct [keymap speed]
|
|
|
|
(vec* (dir-from-key keymap) speed))
|
|
|
|
|
|
|
|
entity
|
2021-02-07 21:56:19 +00:00
|
|
|
|