Balance radius now draws!

This commit is contained in:
Zergling_man 2025-07-25 19:09:50 +10:00
parent 11355db87a
commit 27c877d586
14 changed files with 171 additions and 13 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
import os
import sys
try: perth=open("godot-cpp-path").read()
try: perth=open("godot-cpp-path").readline()[:-1] # FUCK OFF \n
except FileNotFoundError: perth="godot-cpp"
env = SConscript(os.path.join(perth,"SConstruct"))

BIN
design/combat.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

34
design/combat.png.import Executable file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cudn5uokwl2jg"
path="res://.godot/imported/combat.png-c5cf3baca5735140ed0e3445ac8ca5bd.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://design/combat.png"
dest_files=["res://.godot/imported/combat.png-c5cf3baca5735140ed0e3445ac8ca5bd.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
design/health.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

34
design/health.png.import Executable file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://na231etds2kt"
path="res://.godot/imported/health.png-030c0b15c61f0ff5d3580ea196571946.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://design/health.png"
dest_files=["res://.godot/imported/health.png-030c0b15c61f0ff5d3580ea196571946.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
design/light.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

34
design/light.png.import Executable file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dp1ovkq0nkf4u"
path="res://.godot/imported/light.png-2da93a35c5fb8526220cf8913d297456.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://design/light.png"
dest_files=["res://.godot/imported/light.png-2da93a35c5fb8526220cf8913d297456.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
design/movement.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

34
design/movement.png.import Executable file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://3iafuab3ke05"
path="res://.godot/imported/movement.png-8a512b68614ccb5f910db6adae450766.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://design/movement.png"
dest_files=["res://.godot/imported/movement.png-8a512b68614ccb5f910db6adae450766.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@ -1,7 +1,8 @@
[gd_scene load_steps=6 format=3 uid="uid://b25q27admm4le"]
[gd_scene load_steps=7 format=3 uid="uid://b25q27admm4le"]
[ext_resource type="Texture2D" uid="uid://c3ne4aeu2p0ac" path="res://design/combat.svg" id="1_hqtel"]
[ext_resource type="Texture2D" uid="uid://dddg5cy8d16e3" path="res://design/light.svg" id="2_sweqy"]
[ext_resource type="Texture2D" uid="uid://cudn5uokwl2jg" path="res://design/combat.png" id="1_sweqy"]
[ext_resource type="Texture2D" uid="uid://na231etds2kt" path="res://design/health.png" id="2_2hs0m"]
[ext_resource type="Texture2D" uid="uid://dp1ovkq0nkf4u" path="res://design/light.png" id="3_1jxqw"]
[ext_resource type="Texture2D" uid="uid://jh1ukfckc2dv" path="res://design/movement.svg" id="3_2hs0m"]
[ext_resource type="Texture2D" uid="uid://d1r6x3d1cu61d" path="res://design/health.svg" id="4_1jxqw"]
@ -28,13 +29,13 @@ layout_mode = 2
layout_mode = 2
item_count = 6
popup/item_0/text = "Pyromancer"
popup/item_0/icon = ExtResource("1_hqtel")
popup/item_0/icon = ExtResource("1_sweqy")
popup/item_0/id = 0
popup/item_1/text = "Rogue"
popup/item_1/icon = ExtResource("1_hqtel")
popup/item_1/icon = ExtResource("2_2hs0m")
popup/item_1/id = 1
popup/item_2/text = "Spelunker"
popup/item_2/icon = ExtResource("2_sweqy")
popup/item_2/icon = ExtResource("3_1jxqw")
popup/item_2/id = 2
popup/item_3/text = "Acrobat"
popup/item_3/icon = ExtResource("3_2hs0m")

View File

@ -41,6 +41,7 @@ Node* Game::kyaraspawn(const Variant &data)
kya->set_name(dat["name"]);
kya->multiplayerowner=dat["pid"];
kya->set_position(Vector2(50,50));
kya->mummy=this;
if (multiplayer_type&2) kya->set_texture(ResourceLoader::get_singleton()->load("res://design/char_top.svg")); // displaying
return kya;
}

View File

@ -14,7 +14,6 @@ class Game : public Node2D
{
GDCLASS(Game, Node2D)
private:
int multiplayer_type;
MultiplayerSpawner *spawn;
protected:
static void _bind_methods();
@ -23,6 +22,7 @@ public:
~Game();
void start(const Dictionary &players, const int p_multiplayer_type);
Node* kyaraspawn(const Variant &data);
int multiplayer_type;
};
}

View File

@ -1,6 +1,9 @@
#include "kyara.h"
#include <godot_cpp/core/class_db.hpp>
//INVALID USE OF INCOMPLETE TYPE STRIKES AGAIN, BUT DIFFERENT
#include "game.h"
using namespace godot;
void Character::_bind_methods()
@ -26,6 +29,7 @@ Character::Character()
balance_radius_cur=8.0;
face=memnew(Sprite2D);
face->set_name("_face");
face->set_draw_behind_parent(true);
add_child(face,false,INTERNAL_MODE_BACK);
input=memnew(Controller);
input->set_name("_input");
@ -37,16 +41,18 @@ Character::Character()
shape=memnew(CollisionShape2D);
shape->set_name("_shape");
add_child(shape,false,INTERNAL_MODE_BACK);
br_col=memnew(Color);
br_col->r=1.0;
}
Character::~Character(){}
void Character::_process(double delta)
{
// これも嫌い
balance_radius_cur-=3.0;
balance_radius_cur=godot::Math::max(balance_radius_cur,8.0);
move(input->flags);
look_at(input->target);
queue_redraw();
// Not sure if I should do this. Issues could occur if I'm wrong either side.
//CharacterBody2D::_process(delta);
}
@ -65,6 +71,14 @@ void Character::_enter_tree()
input->set_multiplayer_authority(multiplayerowner);
}
void Character::_draw()
{
// これ嫌い: *obj
if (!(mummy->multiplayer_type&2)) return;
if (multiplayerowner!=get_multiplayer()->get_unique_id()) return;
draw_circle(Vector2(0,0),balance_radius_cur,*br_col,false);
}
void Character::move(int flags)
{
if (!flags) return;

View File

@ -12,9 +12,12 @@
#include <godot_cpp/classes/circle_shape2d.hpp>
// YOU MAY GET MYSTERIOUS "INVALID USE OF INCOMPLETE TYPE" ERRORS IF YOU DO NOT INCLUDE THE THINGS YOU NEED, BECAUSE THEY MIGHT BE BRIEFLY DEFINED IN OTHER THINGS.
#include <godot_cpp/classes/scene_replication_config.hpp>
#include <godot_cpp/variant/color.hpp>
namespace godot
{
class Game;
class Character : public CharacterBody2D
{
GDCLASS(Character, CharacterBody2D)
@ -27,6 +30,7 @@ private:
Controller* input;
MultiplayerSynchronizer* sync;
CollisionShape2D* shape;
Color* br_col;
protected:
static void _bind_methods();
public:
@ -35,7 +39,9 @@ public:
void _process(double delta) override;
void _ready() override;
void _enter_tree() override;
void _draw() override;
int multiplayerowner;
Game* mummy;
// Garbage
void set_balance_radius(const double p_balance_radius);
double get_balance_radius() const;