-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcEnemy.cpp
More file actions
50 lines (46 loc) · 1.29 KB
/
cEnemy.cpp
File metadata and controls
50 lines (46 loc) · 1.29 KB
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
43
44
45
46
47
48
49
50
/*
=================
cEnemy.cpp
- Header file for class definition - IMPLEMENTATION
=================
*/
#include "cEnemy.h"
/*
=================================================================
Defualt Constructor
=================================================================
*/
cEnemy::cEnemy() : cSprite()
{
this->enemyVelocity = 0;
}
/*
=================================================================
Update the sprite position
=================================================================
*/
void cEnemy::update(double deltaTime)
{
SDL_Rect currentSpritePos = this->getSpritePos();
currentSpritePos.x += (int)(this->getSpriteTranslation().x * deltaTime * 10);
this->setSpritePos({ currentSpritePos.x, currentSpritePos.y });
this->setBoundingRect(this->getSpritePos());
}
/*
=================================================================
Sets the velocity for the Asteroid
=================================================================
*/
void cEnemy::setEnemyVelocity(int EnemyVel)
{
enemyVelocity = EnemyVel;
}
/*
=================================================================
Gets the Asteroid velocity
=================================================================
*/
int cEnemy::getEnemyVelocity()
{
return enemyVelocity;
}