Skip to content

Commit 58ecade

Browse files
committed
Ghoul: overall quality
closes #2848
1 parent 00e5b9d commit 58ecade

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

data/images/creatures/ghoul/ghoul.sprite

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(supertux-sprite
22

33
(action
4-
(name "normal-left")
4+
(name "left")
55
(fps 12)
66
(loops 1)
77
(hitbox 8 10 45 45)
@@ -30,11 +30,11 @@
3030
"g5.png"))
3131

3232
(action
33-
(name "normal-right")
33+
(name "right")
3434
(fps 12)
3535
(loops 1)
3636
(hitbox 47 10 45 45)
37-
(mirror-action "normal-left"))
37+
(mirror-action "left"))
3838

3939
(action
4040
(name "fast-left")
@@ -55,7 +55,7 @@
5555

5656
(action
5757
(name "squished")
58-
(hitbox 0 0 1 48)
58+
(hitbox 27.5 0 45 45)
5959
(images "d1.png"))
6060

6161
)

src/badguy/ghoul.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ Ghoul::Ghoul(const ReaderMapping& reader) :
3939
reader.get("speed", m_speed, DEFAULT_SPEED);
4040
reader.get("track-range", m_track_range, DEFAULT_TRACK_RANGE);
4141

42-
m_sprite->set_action(m_dir);
42+
set_action(m_dir);
4343
m_physic.set_gravity_modifier(0.2f);
44+
set_colgroup_active(COLGROUP_TOUCHABLE);
4445

4546
SoundManager::current()->preload("sounds/fall.wav");
4647
}
@@ -55,7 +56,7 @@ Ghoul::active_update(float dt_sec)
5556
if (m_fake_dead && m_respawn_timer.check()) {
5657
initialize();
5758
m_physic.enable_gravity(true);
58-
set_colgroup_active(COLGROUP_MOVING);
59+
set_colgroup_active(COLGROUP_TOUCHABLE);
5960
m_fake_dead = false;
6061
m_respawn_timer.stop();
6162
}
@@ -77,14 +78,14 @@ Ghoul::active_update(float dt_sec)
7778
{
7879
case NORMAL:
7980
m_speed_modifier = std::max(0.f, m_speed_modifier - (dt_sec * 2.f));
80-
m_sprite->set_action(player->get_bbox().get_middle().x < get_bbox().get_middle().x ? "normal-left" : "normal-right", 1);
81+
set_action(player->get_bbox().get_middle().x < get_bbox().get_middle().x ? "left" : "right", 1);
8182
if (m_sprite->animation_done()) {
8283
m_chase_dir = glm::normalize(dist);
8384
m_sprite_state = SpriteState::FAST;
8485
}
8586
break;
8687
case FAST:
87-
m_sprite->set_action(player->get_bbox().get_middle().x < get_bbox().get_middle().x ? "fast-left" : "fast-right", 1);
88+
set_action(player->get_bbox().get_middle().x < get_bbox().get_middle().x ? "fast-left" : "fast-right", 1);
8889
m_speed_modifier = 3.5f;
8990
if (m_sprite->animation_done()) {
9091
m_sprite_state = SpriteState::NORMAL;

0 commit comments

Comments
 (0)