- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEnemy.cpp
More file actions
Latest commit
34 lines (26 loc) · 522 Bytes
/
Copy pathEnemy.cpp
File metadata and controls
34 lines (26 loc) · 522 Bytes
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
#include"Enemy.h"
Enemy::Enemy(const LoaderParams* pParams) : SDLGameObject(pParams)
{
m_velocity.setY(2);
m_velocity.setX(0.001);
}
voidEnemy::draw()
{
SDLGameObject::draw(); //example inherance call
}
voidEnemy::update()
{
m_currentFrame = int((SDL_GetTicks() / 100) % m_numFrames);
if(m_position.getY() < 0)
{
m_velocity.setY(2);
}
elseif (m_position.getY() > 400)
{
m_velocity.setY(-2);
}
SDLGameObject::update();
}
voidEnemy::clean()
{
}