-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcEnemy.cpp
42 lines (32 loc) · 1.21 KB
/
cEnemy.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2015 Kelvin Chandra, Software Laboratory Center, Binus University. All Rights Reserved.
#include "cEnemy.h"
#include "cGame.h"
cEnemy::cEnemy()
{
}
cEnemy::~cEnemy()
{
}
void cEnemy::Render()
{
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, enemySheet->at(animControl->Index())->Texture());
glBegin(GL_QUADS);
glTexCoord2f(enemySheet->at(animControl->Index())->X0(), enemySheet->at(animControl->Index())->Y1()); glVertex3i(x, y, 49);
glTexCoord2f(enemySheet->at(animControl->Index())->X1(), enemySheet->at(animControl->Index())->Y1()); glVertex3i(x + Width(), y, 49);
glTexCoord2f(enemySheet->at(animControl->Index())->X1(), enemySheet->at(animControl->Index())->Y0()); glVertex3i(x + Width(), y + Height(), 49);
glTexCoord2f(enemySheet->at(animControl->Index())->X0(), enemySheet->at(animControl->Index())->Y0()); glVertex3i(x, y + Height(), 49);
glEnd();
glDisable(GL_TEXTURE_2D);
}
void cEnemy::Init()
{
animControl = new cAnimControl();
animControl->AddAnim("NoLoop", "idle", 23, 23, 0.2f);
}
void cEnemy::Update(float tpf /*= 0.0333*/)
{
animControl->UpdateAnim(tpf);
if (animControl->ActiveName() != "idle")
animControl->SetActiveAnim("idle");
}