summaryrefslogtreecommitdiff
path: root/src/player.c
blob: 1871944011185cfa21d85713c7812d75e4f3d1e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "entityimpl.h"

IMPL(draw) {
	TZR_DrawSetColor(1, 1, 1, 1);
	TZR_DrawRectangle(true, this->pos[0] - this->width / 2,
	                  this->pos[1] - this->height / 2,
	                  this->width, this->height);
}

IMPL(update) {
	this->vel[0] = TZR_IsKeyDown(SDL_SCANCODE_RIGHT)
	             - TZR_IsKeyDown(SDL_SCANCODE_LEFT);
	entity_move(this, g);
}

IMPL_INIT(player) {
	this->height = this->width = 12;
}