feat: started work on pinboard mechanics
This commit is contained in:
parent
7e5a39fc52
commit
ac70e60dc2
4 changed files with 56 additions and 0 deletions
14
modules/you_done_it/pinboard.cpp
Normal file
14
modules/you_done_it/pinboard.cpp
Normal 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) }) {
|
||||
}
|
||||
}
|
||||
13
modules/you_done_it/pinboard.h
Normal file
13
modules/you_done_it/pinboard.h
Normal 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);
|
||||
};
|
||||
14
modules/you_done_it/pinned_photo.cpp
Normal file
14
modules/you_done_it/pinned_photo.cpp
Normal 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;
|
||||
}
|
||||
15
modules/you_done_it/pinned_photo.h
Normal file
15
modules/you_done_it/pinned_photo.h
Normal 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 };
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue