Mario: add turtle enemy

This commit is contained in:
2023-03-10 16:45:26 +01:00
parent fd96a1c2cc
commit f0182cf4d4
10 changed files with 35 additions and 1 deletions
+10 -1
View File
@@ -3,6 +3,7 @@
#include "../objectids.hpp"
#include "../sprites.hpp"
#include "../mario.hpp"
#include "../blocks/turtleblock.hpp"
void GoombaVisitor::visit(const SDLPP::RenderObject &obj) {
auto id = obj.getId();
@@ -47,7 +48,15 @@ void GoombaVisitor::visit(const SDLPP::RenderObject &obj) {
}
break;
case DEATH_ID:
death = true;
instant_death = true;
break;
case TURTLE_ID:
{
auto &turtle = dynamic_cast<const TurtleBlock &>(obj);
if(turtle.isShell() && turtle.getMovement().getX() != 0) {
death = true;
}
}
break;
case MARIO_ID:
{