-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStrongGoblin.cpp
More file actions
61 lines (45 loc) · 1.24 KB
/
StrongGoblin.cpp
File metadata and controls
61 lines (45 loc) · 1.24 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
51
52
53
54
55
56
57
58
59
60
61
//
// Created by segalle on 11/22/21.
//
#include "StrongGoblin.h"
namespace entities{
namespace characters{
StrongGoblin::StrongGoblin() : Enemy(),
attack_counter(0){
sprite = assets->getSprite("strongGoblin");
setId(strong_goblin_id);
health = 75;
speed.x = 1;
}
StrongGoblin::~StrongGoblin(){}
void StrongGoblin::run() {
walk();
attack_counter++;
}
void StrongGoblin::walk() {
p_position = player->getPosition();
if(p_position.x + 50 > position.x){
position.x += speed.x;
}
else{
position.x -= speed.x;
}
fall();
position.y += speed.y;
}
int StrongGoblin::getCollisionDamage() {
if(attack_counter > attack_speed) {
attack_counter = 0;
return collision_damage;
}
return 0;
}
void StrongGoblin::attack() {
}
Entity *StrongGoblin::getProjectile() {
return nullptr;
}
int StrongGoblin::attack_speed = 72;
int StrongGoblin::collision_damage = 10;
}
}