Mario: add basic big mario logic

This commit is contained in:
2022-09-25 19:44:28 +02:00
parent 09cb13195c
commit 4109cfe1af
12 changed files with 156 additions and 57 deletions
+6 -2
View File
@@ -2,6 +2,7 @@
#include "../../sdlpp/sdlpp_renderobject.hpp"
#include "../objectids.hpp"
#include "../sprites.hpp"
#include "../mario.hpp"
void GoombaVisitor::visit(const SDLPP::RenderObject &obj) {
auto id = obj.getId();
@@ -49,8 +50,11 @@ void GoombaVisitor::visit(const SDLPP::RenderObject &obj) {
death = true;
break;
case MARIO_ID:
if (from == NPC_TOP_DETECT) {
death = true;
{
auto &mario = dynamic_cast<const Mario &>(obj);
if (from == NPC_TOP_DETECT && obj.getPos().getY() <= goomba_pos.getY() - BLOCK_SIZE && !mario.isJumping()) {
death = true;
}
}
break;
default: