feat: started work on pinboard mechanics

This commit is contained in:
Sara Gerretsen 2025-10-29 23:14:11 +01:00
parent 7e5a39fc52
commit ac70e60dc2
4 changed files with 56 additions and 0 deletions

View file

@ -0,0 +1,14 @@
#include "pinboard.h"
#include "pinned_photo.h"
void Pinboard::_bind_methods() {
}
void Pinboard::enter_tree() {
connect("body_entered", callable_mp(this, &self_type::on_body_entered));
}
void Pinboard::on_body_entered(Node2D *node) {
if (PinnedPhoto * photo{ cast_to<PinnedPhoto>(node) }) {
}
}

View file

@ -0,0 +1,13 @@
#pragma once
#include "scene/2d/physics/area_2d.h"
class Pinboard : public Area2D {
GDCLASS(Pinboard, Area2D);
static void _bind_methods();
void enter_tree();
void on_body_entered(Node2D *node);
protected:
void _notification(int what);
};

View file

@ -0,0 +1,14 @@
#include "pinned_photo.h"
#include "macros.h"
void PinnedPhoto::_bind_methods() {
BIND_PROPERTY(Variant::BOOL, can_drop);
}
void PinnedPhoto::set_can_drop(bool value) {
this->can_drop = value;
}
bool PinnedPhoto::get_can_drop() const {
return this->can_drop;
}

View file

@ -0,0 +1,15 @@
#pragma once
#include "scene/2d/physics/animatable_body_2d.h"
class PinnedPhoto : public AnimatableBody2D {
GDCLASS(PinnedPhoto, AnimatableBody2D);
static void _bind_methods();
public:
void set_can_drop(bool value);
bool get_can_drop() const;
private:
bool can_drop{ false };
};