Exemplo n.º 1
0
void gameTick(Tank& tan) {
	if (upPressed) {
		tan.accel(1);
	}
	if (downPressed) {
		tan.accel(-1);
	}
	if (leftPressed) {
		tan.rot(1);
	}
	if (rightPressed) {
		tan.rot(-1);
	}
	tan.state.x -= tan.state.v*sin(tan.state.h*(PI/180.0f));
	tan.state.y += tan.state.v*cos(tan.state.h*(PI/180.0f));
}