diff options
Diffstat (limited to 'entity.ha')
-rw-r--r-- | entity.ha | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/entity.ha b/entity.ha new file mode 100644 index 0000000..07b8b69 --- /dev/null +++ b/entity.ha @@ -0,0 +1,36 @@ +use vt; +use math::random; +use time; +use fmt; +use os; + +type entity = struct { + x: uint, + y: uint, + letter: rune, + color: u8, +}; + +fn entity_draw(ent: *entity, term: *vt::term) void = { + vt::move(term, ent.y+1, ent.x+1)!; + fmt::fprintf(os::stdout_file,"\x1b[3{}m{}",ent.color,ent.letter)!; +}; + +fn entity_tick(ent: *entity, room: *room) void = { + ent.x += 1; + if (ent.x >= 13) ent.x = 1; + ent.y += 1; + if (ent.y >= 11) ent.y = 1; +}; + +fn entity_new(r: rune, col: u8) entity = entity { + x = 1, + y = 1, + letter = r, + color = col, +}; + + + + + |