added some functions

This commit is contained in:
2023-03-13 21:39:55 +01:00
parent aa816fc5f8
commit d9f6b04a23
3 changed files with 12 additions and 9 deletions

View File

@@ -1,5 +1,6 @@
#include "main.h" #include "main.h"
#include <godot_cpp/core/class_db.hpp> #include <godot_cpp/core/class_db.hpp>
#include <godot_cpp/variant/utility_functions.hpp>
using namespace godot; using namespace godot;
@@ -15,10 +16,10 @@ DiscordRPC::~DiscordRPC() {
// add your cleanup here // add your cleanup here
} }
void DiscordRPC::_ready() {
UtilityFunctions::print("Hello mom");
}
void DiscordRPC::_process(float delta) { void DiscordRPC::_process(float delta) {
time_passed += delta;
Vector2 new_position = Vector2(10.0 + (10.0 * sin(time_passed * 2.0)), 10.0 + (10.0 * cos(time_passed * 1.5)));
set_position(new_position);
} }

View File

@@ -1,12 +1,13 @@
#ifndef DISCORDRPC_H #ifndef DISCORDRPC_H
#define DISCORDRPC_H #define DISCORDRPC_H
#include <godot_cpp/classes/sprite2d.hpp>
#include <godot_cpp/classes/node.hpp>
namespace godot { namespace godot {
class DiscordRPC : public Sprite2D { class DiscordRPC : public Node {
GDCLASS(DiscordRPC, Sprite2D) GDCLASS(DiscordRPC, Node)
private: private:
float time_passed; float time_passed;
@@ -18,9 +19,10 @@ public:
DiscordRPC(); DiscordRPC();
~DiscordRPC(); ~DiscordRPC();
void _ready();
void _process(float delta); void _process(float delta);
}; };
} }
#endif #endif