diff options
Diffstat (limited to 'sprite_system.c')
-rw-r--r-- | sprite_system.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sprite_system.c b/sprite_system.c index 526c097..b94886e 100644 --- a/sprite_system.c +++ b/sprite_system.c @@ -5,7 +5,7 @@ #include "world.h" void sprite_system(const World* world) { - int i; + int i, x, y; unsigned bits; const CSprite* sprite; const CPosition* pos; @@ -17,8 +17,11 @@ void sprite_system(const World* world) { pos = &world->positions[i]; sprite = &world->sprites[i]; + x = pos->x - world->cam_x; + y = pos->y - world->cam_y; + b = get_bitmap(sprite->id); - render_bitmap(b, pos->x >> fbits, pos->y >> fbits, &sprite->rect); + render_bitmap(b, x >> fbits, y >> fbits, &sprite->rect); } } } |