Most of prototype! yay
This commit is contained in:
21
addons/godot-git-plugin/LICENSE
Normal file
21
addons/godot-git-plugin/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2016-2023 The Godot Engine community
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
1349
addons/godot-git-plugin/THIRDPARTY.md
Normal file
1349
addons/godot-git-plugin/THIRDPARTY.md
Normal file
File diff suppressed because it is too large
Load Diff
12
addons/godot-git-plugin/git_plugin.gdextension
Normal file
12
addons/godot-git-plugin/git_plugin.gdextension
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[configuration]
|
||||||
|
|
||||||
|
entry_symbol = "git_plugin_init"
|
||||||
|
compatibility_minimum = "4.1.0"
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
|
||||||
|
macos.editor = "macos/libgit_plugin.macos.editor.universal.dylib"
|
||||||
|
windows.editor.x86_64 = "win64/libgit_plugin.windows.editor.x86_64.dll"
|
||||||
|
linux.editor.x86_64 = "linux/libgit_plugin.linux.editor.x86_64.so"
|
||||||
|
linux.editor.arm64 = "linux/libgit_plugin.linux.editor.arm64.so"
|
||||||
|
linux.editor.rv64 = ""
|
||||||
1
addons/godot-git-plugin/git_plugin.gdextension.uid
Normal file
1
addons/godot-git-plugin/git_plugin.gdextension.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://dgnygvjyvl2h1
|
||||||
Binary file not shown.
Binary file not shown.
7
addons/godot-git-plugin/plugin.cfg
Normal file
7
addons/godot-git-plugin/plugin.cfg
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[plugin]
|
||||||
|
|
||||||
|
name="Godot Git Plugin"
|
||||||
|
description="This plugin lets you interact with Git without leaving the Godot editor. More information can be found at https://github.com/godotengine/godot-git-plugin/wiki"
|
||||||
|
author="twaritwaikar"
|
||||||
|
version="v3.1.1"
|
||||||
|
script="godot-git-plugin.gd"
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -21,19 +21,9 @@ func make_atlas(
|
|||||||
editor_import_plugin: EditorImportPlugin,
|
editor_import_plugin: EditorImportPlugin,
|
||||||
) -> AtlasMakingResult:
|
) -> AtlasMakingResult:
|
||||||
var result: AtlasMakingResult = AtlasMakingResult.new()
|
var result: AtlasMakingResult = AtlasMakingResult.new()
|
||||||
var res_png_path: String = res_source_file_path + ".png"
|
|
||||||
if not (res_png_path.is_absolute_path() and res_png_path.begins_with("res://")):
|
var portableCompressedTexture: PortableCompressedTexture2D = PortableCompressedTexture2D.new()
|
||||||
result.fail(ERR_FILE_BAD_PATH, "Path to PNG-file is not valid: %s" % [res_png_path])
|
portableCompressedTexture.create_from_image(atlas_image, PortableCompressedTexture2D.COMPRESSION_MODE_LOSSLESS)
|
||||||
return result
|
|
||||||
var error: Error
|
result.success(portableCompressedTexture)
|
||||||
error = atlas_image.save_png(res_png_path)
|
|
||||||
if error:
|
|
||||||
result.fail(error, "An error occured while saving atlas-image to png-file: %s" % [res_png_path])
|
|
||||||
return result
|
|
||||||
__editor_file_system.update_file(res_png_path)
|
|
||||||
error = editor_import_plugin.append_import_external_resource(res_png_path)
|
|
||||||
if error:
|
|
||||||
result.fail(error, "An error occured while appending import external resource (atlas texture)")
|
|
||||||
return result
|
|
||||||
result.success(ResourceLoader.load(res_png_path, "Texture2D", ResourceLoader.CACHE_MODE_IGNORE))
|
|
||||||
return result
|
return result
|
||||||
|
|||||||
5
common/interactable.gd
Normal file
5
common/interactable.gd
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
extends Node2D
|
||||||
|
class_name Interactable
|
||||||
|
|
||||||
|
func interact(player: Player):
|
||||||
|
pass
|
||||||
1
common/interactable.gd.uid
Normal file
1
common/interactable.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://csbip0oj1uu0j
|
||||||
10
common/interactable_body.gd
Normal file
10
common/interactable_body.gd
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
extends StaticBody2D
|
||||||
|
class_name InteractableBody
|
||||||
|
|
||||||
|
var parent: Interactable
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
parent = get_parent()
|
||||||
|
|
||||||
|
func interact(player: Player):
|
||||||
|
parent.interact(player)
|
||||||
1
common/interactable_body.gd.uid
Normal file
1
common/interactable_body.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://dryjau28sybgd
|
||||||
14
common/player_states/player_state.gd
Normal file
14
common/player_states/player_state.gd
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
extends Resource
|
||||||
|
class_name Player_State
|
||||||
|
|
||||||
|
func restrict_movement() -> bool:
|
||||||
|
return false
|
||||||
|
|
||||||
|
func on_movement_input(input: Vector2, player: Player):
|
||||||
|
pass
|
||||||
|
|
||||||
|
func restrict_rotation() -> bool:
|
||||||
|
return false
|
||||||
|
|
||||||
|
func on_rotation_input(input: float, player: Player):
|
||||||
|
pass
|
||||||
1
common/player_states/player_state.gd.uid
Normal file
1
common/player_states/player_state.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://tweaybdvlwev
|
||||||
16
common/player_states/player_state_rotation_interaction.gd
Normal file
16
common/player_states/player_state_rotation_interaction.gd
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
extends Player_State
|
||||||
|
class_name Player_State_Rotation_Interaction
|
||||||
|
|
||||||
|
var rotation_target: Node2D
|
||||||
|
|
||||||
|
func _init(target: Node2D) -> void:
|
||||||
|
rotation_target = target
|
||||||
|
|
||||||
|
func restrict_rotation() -> bool:
|
||||||
|
return true
|
||||||
|
|
||||||
|
func on_movement_input(input: Vector2, player: Player):
|
||||||
|
player.interacting_state = Player_State_Standard.new()
|
||||||
|
|
||||||
|
func on_rotation_input(input: float, player: Player):
|
||||||
|
rotation_target.rotation = input
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://wo8hrn7t4s3p
|
||||||
2
common/player_states/player_state_standard.gd
Normal file
2
common/player_states/player_state_standard.gd
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
extends Player_State
|
||||||
|
class_name Player_State_Standard
|
||||||
1
common/player_states/player_state_standard.gd.uid
Normal file
1
common/player_states/player_state_standard.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://bkv1iehq3miwi
|
||||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 583 B |
11
entities/button/button.gd
Normal file
11
entities/button/button.gd
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
extends Interactable
|
||||||
|
@onready var sprite_2d: AnimatedSprite2D = $Sprite2D
|
||||||
|
|
||||||
|
func _on_interaction_area_body_entered(body: Player) -> void:
|
||||||
|
sprite_2d.frame += 1
|
||||||
|
|
||||||
|
func _on_interaction_area_body_exited(body: Player) -> void:
|
||||||
|
sprite_2d.frame -= 1
|
||||||
|
|
||||||
|
func interact(player: Player):
|
||||||
|
sprite_2d.frame += 2
|
||||||
1
entities/button/button.gd.uid
Normal file
1
entities/button/button.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://ba287kjc4mtb2
|
||||||
@@ -1,17 +1,35 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://q3f3j7p3t43w"]
|
[gd_scene load_steps=6 format=3 uid="uid://q3f3j7p3t43w"]
|
||||||
|
|
||||||
[ext_resource type="SpriteFrames" uid="uid://b31mdngbhms7k" path="res://entities/button/button.aseprite" id="1_4tlb3"]
|
[ext_resource type="Script" uid="uid://ba287kjc4mtb2" path="res://entities/button/button.gd" id="1_7gf2j"]
|
||||||
|
[ext_resource type="SpriteFrames" uid="uid://b31mdngbhms7k" path="res://entities/button/button.aseprite" id="2_7gf2j"]
|
||||||
|
[ext_resource type="Script" uid="uid://dryjau28sybgd" path="res://common/interactable_body.gd" id="3_6bgj0"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_4tlb3"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_4tlb3"]
|
||||||
|
radius = 32.0
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_7gf2j"]
|
||||||
radius = 13.0
|
radius = 13.0
|
||||||
|
|
||||||
[node name="Button" type="Node2D"]
|
[node name="Button" type="Node2D"]
|
||||||
|
script = ExtResource("1_7gf2j")
|
||||||
|
metadata/_custom_type_script = "uid://csbip0oj1uu0j"
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
[node name="InteractionArea" type="Area2D" parent="."]
|
||||||
sprite_frames = ExtResource("1_4tlb3")
|
collision_layer = 16
|
||||||
|
collision_mask = 16
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="InteractionArea"]
|
||||||
|
shape = SubResource("CircleShape2D_4tlb3")
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
|
sprite_frames = ExtResource("2_7gf2j")
|
||||||
animation = &"Press"
|
animation = &"Press"
|
||||||
|
|
||||||
[node name="Area2D" type="Area2D" parent="."]
|
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
||||||
|
script = ExtResource("3_6bgj0")
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
|
||||||
shape = SubResource("CircleShape2D_4tlb3")
|
shape = SubResource("CircleShape2D_7gf2j")
|
||||||
|
|
||||||
|
[connection signal="body_entered" from="InteractionArea" to="." method="_on_interaction_area_body_entered"]
|
||||||
|
[connection signal="body_exited" from="InteractionArea" to="." method="_on_interaction_area_body_exited"]
|
||||||
|
|||||||
BIN
entities/deflector/deflector.aseprite
Normal file
BIN
entities/deflector/deflector.aseprite
Normal file
Binary file not shown.
34
entities/deflector/deflector.aseprite.import
Normal file
34
entities/deflector/deflector.aseprite.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dcuqa5saaxapt"
|
||||||
|
path="res://.godot/imported/deflector.aseprite-f7ae4c7ec47c88d68c3b91257e4dbce3.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://entities/deflector/deflector.aseprite"
|
||||||
|
dest_files=["res://.godot/imported/deflector.aseprite-f7ae4c7ec47c88d68c3b91257e4dbce3.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
|
||||||
10
entities/deflector/deflector.gd
Normal file
10
entities/deflector/deflector.gd
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
extends Interactable
|
||||||
|
|
||||||
|
func _on_interaction_area_body_entered(body: Player) -> void:
|
||||||
|
body.interaction_target = self
|
||||||
|
|
||||||
|
func _on_interaction_area_body_exited(body: Player) -> void:
|
||||||
|
body.interaction_target = null
|
||||||
|
|
||||||
|
func interact():
|
||||||
|
pass
|
||||||
1
entities/deflector/deflector.gd.uid
Normal file
1
entities/deflector/deflector.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://ckgd1u5akr3hc
|
||||||
11
entities/deflector/deflector.tscn
Normal file
11
entities/deflector/deflector.tscn
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[gd_scene load_steps=3 format=3 uid="uid://docbcbiad4ghy"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://csbip0oj1uu0j" path="res://common/interactable.gd" id="1_rbxiy"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dcuqa5saaxapt" path="res://entities/deflector/deflector.aseprite" id="2_es2xh"]
|
||||||
|
|
||||||
|
[node name="Deflector" type="Node2D"]
|
||||||
|
script = ExtResource("1_rbxiy")
|
||||||
|
metadata/_custom_type_script = "uid://csbip0oj1uu0j"
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
texture = ExtResource("2_es2xh")
|
||||||
BIN
entities/emitter/emitter.aseprite
Normal file
BIN
entities/emitter/emitter.aseprite
Normal file
Binary file not shown.
@@ -2,16 +2,16 @@
|
|||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://m8ophji4p35i"
|
uid="uid://cnad2jlo5hr1l"
|
||||||
path="res://.godot/imported/button.aseprite.png-65b0b5c35c3c69ebe0561afd09528d1a.ctex"
|
path="res://.godot/imported/emitter.aseprite-f91716bd71a163efdc85e760a80b8f74.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://entities/button/button.aseprite.png"
|
source_file="res://entities/emitter/emitter.aseprite"
|
||||||
dest_files=["res://.godot/imported/button.aseprite.png-65b0b5c35c3c69ebe0561afd09528d1a.ctex"]
|
dest_files=["res://.godot/imported/emitter.aseprite-f91716bd71a163efdc85e760a80b8f74.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
10
entities/emitter/emitter.gd
Normal file
10
entities/emitter/emitter.gd
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
extends Interactable
|
||||||
|
|
||||||
|
func _on_interaction_area_body_entered(body: Player) -> void:
|
||||||
|
body.interaction_target = self
|
||||||
|
|
||||||
|
func _on_interaction_area_body_exited(body: Player) -> void:
|
||||||
|
body.interaction_target = null
|
||||||
|
|
||||||
|
func interact(player: Player):
|
||||||
|
player.interacting_state = Player_State_Rotation_Interaction.new(self)
|
||||||
1
entities/emitter/emitter.gd.uid
Normal file
1
entities/emitter/emitter.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://cxtlguregjv8m
|
||||||
50
entities/emitter/emitter.tscn
Normal file
50
entities/emitter/emitter.tscn
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
[gd_scene load_steps=8 format=3 uid="uid://cayxfaqxv0irg"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://cxtlguregjv8m" path="res://entities/emitter/emitter.gd" id="1_n2sjg"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cnad2jlo5hr1l" path="res://entities/emitter/emitter.aseprite" id="2_m4shj"]
|
||||||
|
[ext_resource type="Script" uid="uid://dryjau28sybgd" path="res://common/interactable_body.gd" id="3_n2sjg"]
|
||||||
|
|
||||||
|
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_n2sjg"]
|
||||||
|
size = Vector2(4, 3)
|
||||||
|
|
||||||
|
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_6vwrl"]
|
||||||
|
particle_flag_disable_z = true
|
||||||
|
spread = 1.0
|
||||||
|
initial_velocity_min = 275.86
|
||||||
|
initial_velocity_max = 325.0
|
||||||
|
gravity = Vector3(0, 0, 0)
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_m4shj"]
|
||||||
|
radius = 32.0
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_n2sjg"]
|
||||||
|
radius = 14.0
|
||||||
|
|
||||||
|
[node name="Emitter" type="Node2D"]
|
||||||
|
script = ExtResource("1_n2sjg")
|
||||||
|
metadata/_custom_type_script = "uid://csbip0oj1uu0j"
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
texture = ExtResource("2_m4shj")
|
||||||
|
|
||||||
|
[node name="GPUParticles2D" type="GPUParticles2D" parent="."]
|
||||||
|
position = Vector2(13, 0)
|
||||||
|
texture = SubResource("PlaceholderTexture2D_n2sjg")
|
||||||
|
process_material = SubResource("ParticleProcessMaterial_6vwrl")
|
||||||
|
|
||||||
|
[node name="Line2D" type="Line2D" parent="."]
|
||||||
|
points = PackedVector2Array(0, 0, 300, 0)
|
||||||
|
width = 3.0
|
||||||
|
default_color = Color(1, 0.180392, 1, 1)
|
||||||
|
|
||||||
|
[node name="Area2D" type="Area2D" parent="."]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||||
|
shape = SubResource("CircleShape2D_m4shj")
|
||||||
|
|
||||||
|
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
||||||
|
script = ExtResource("3_n2sjg")
|
||||||
|
metadata/_custom_type_script = "uid://dryjau28sybgd"
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
|
||||||
|
shape = SubResource("CircleShape2D_n2sjg")
|
||||||
23
entities/energy_flow/energy_flow_line.gd
Normal file
23
entities/energy_flow/energy_flow_line.gd
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
extends Node2D
|
||||||
|
|
||||||
|
@onready var energy_line: Line2D = %EnergyLine
|
||||||
|
@onready var ray_cast: RayCast2D = %RayCast
|
||||||
|
|
||||||
|
@export_range(1,999,8) var maximum_flow_distance: float
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
var target_position := Vector2(maximum_flow_distance, 0)
|
||||||
|
|
||||||
|
energy_line.add_point(Vector2.ZERO)
|
||||||
|
energy_line.add_point(target_position)
|
||||||
|
|
||||||
|
ray_cast.target_position = target_position
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
energy_line.clear_points()
|
||||||
|
if ray_cast.is_colliding():
|
||||||
|
energy_line.add_point(Vector2.ZERO)
|
||||||
|
energy_line.add_point(ray_cast.get_collision_point() - global_position)
|
||||||
|
else :
|
||||||
|
energy_line.add_point(Vector2.ZERO)
|
||||||
|
energy_line.add_point(Vector2(maximum_flow_distance, 0))
|
||||||
1
entities/energy_flow/energy_flow_line.gd.uid
Normal file
1
entities/energy_flow/energy_flow_line.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://dtbeaqn2f6anq
|
||||||
15
entities/energy_flow/energy_flow_line.tscn
Normal file
15
entities/energy_flow/energy_flow_line.tscn
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://dpgncxhv41apt"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://dtbeaqn2f6anq" path="res://entities/energy_flow/energy_flow_line.gd" id="1_fx3ax"]
|
||||||
|
|
||||||
|
[node name="EnergyFlowLine" type="Node2D"]
|
||||||
|
script = ExtResource("1_fx3ax")
|
||||||
|
maximum_flow_distance = 305.0
|
||||||
|
|
||||||
|
[node name="EnergyLine" type="Line2D" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
width = 3.0
|
||||||
|
default_color = Color(0.705901, 0.0965751, 0.690904, 1)
|
||||||
|
|
||||||
|
[node name="RayCast" type="RayCast2D" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
# This script controls a top-down player character using input and rotates towards the mouse or right stick.
|
|
||||||
extends CharacterBody2D
|
extends CharacterBody2D
|
||||||
|
class_name Player
|
||||||
|
|
||||||
|
@onready var interaction_ray_cast: RayCast2D = %InteractionRayCast
|
||||||
|
|
||||||
# Player movement speed (pixels per second)
|
# Player movement speed (pixels per second)
|
||||||
@export var speed = 200
|
@export var speed = 200
|
||||||
@@ -12,43 +14,39 @@ extends CharacterBody2D
|
|||||||
# Use mouse for rotation? If false, uses gamepad right stick.
|
# Use mouse for rotation? If false, uses gamepad right stick.
|
||||||
@export var rotate_with_mouse = true
|
@export var rotate_with_mouse = true
|
||||||
|
|
||||||
# Called every physics frame. 'delta' is the elapsed time since the previous frame.
|
@export var interacting_state: Player_State = Player_State_Standard.new()
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
# --- Movement Logic ---
|
# --- Movement Logic ---
|
||||||
var input_vector = Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
var input_vector := Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
||||||
|
|
||||||
# Set the velocity based on input
|
|
||||||
if input_vector != Vector2.ZERO:
|
if input_vector != Vector2.ZERO:
|
||||||
velocity = input_vector * speed
|
if not interacting_state.restrict_movement():
|
||||||
|
velocity = input_vector * speed
|
||||||
|
interacting_state.on_movement_input(input_vector, self)
|
||||||
else:
|
else:
|
||||||
# If no input, stop the player (optional, you might want friction instead)
|
|
||||||
velocity = lerp(velocity, Vector2.ZERO, friction * delta)
|
velocity = lerp(velocity, Vector2.ZERO, friction * delta)
|
||||||
|
|
||||||
# Move the player and handle collisions using CharacterBody2D's move_and_slide
|
|
||||||
move_and_slide()
|
move_and_slide()
|
||||||
|
|
||||||
# --- Rotation Logic ---
|
# --- Rotation Logic ---
|
||||||
var target_rotation_direction = Vector2.ZERO
|
var target_rotation_direction = Vector2.ZERO
|
||||||
|
|
||||||
if rotate_with_mouse:
|
if rotate_with_mouse:
|
||||||
# Get the mouse position in world coordinates
|
|
||||||
var mouse_position = get_global_mouse_position()
|
var mouse_position = get_global_mouse_position()
|
||||||
# Calculate the direction vector from the player to the mouse
|
|
||||||
target_rotation_direction = global_position.direction_to(mouse_position)
|
target_rotation_direction = global_position.direction_to(mouse_position)
|
||||||
else:
|
else:
|
||||||
# Get right analog stick input
|
|
||||||
target_rotation_direction = Input.get_vector("rotate_left", "rotate_right", "rotate_up", "rotate_down")
|
target_rotation_direction = Input.get_vector("rotate_left", "rotate_right", "rotate_up", "rotate_down")
|
||||||
|
|
||||||
# If there is a valid rotation direction (either from mouse or stick input)
|
|
||||||
if target_rotation_direction != Vector2.ZERO:
|
if target_rotation_direction != Vector2.ZERO:
|
||||||
# Calculate the target rotation angle in radians
|
var target_angle := target_rotation_direction.angle()
|
||||||
var target_angle = target_rotation_direction.angle()
|
if not interacting_state.restrict_rotation():
|
||||||
|
rotation = lerp_angle(rotation, target_angle, rotation_speed * delta)
|
||||||
|
interacting_state.on_rotation_input(target_angle, self)
|
||||||
|
|
||||||
# Smoothly rotate the player towards the target angle
|
# --- Interact Logic ---
|
||||||
# Using lerp_angle for smooth interpolation of angles
|
if Input.is_action_just_pressed("interact"):
|
||||||
rotation = lerp_angle(rotation, target_angle, rotation_speed * delta)
|
if interaction_ray_cast.is_colliding():
|
||||||
|
var interaction_target = interaction_ray_cast.get_collider()
|
||||||
# Note: Make sure you have input actions configured in Project Settings -> Input Map:
|
if interaction_target is InteractableBody:
|
||||||
# - "move_up", "move_down", "move_left", "move_right" for movement.
|
interaction_target.interact(self)
|
||||||
# - If not using mouse rotation, add "rotate_up", "rotate_down", "rotate_left", "rotate_right"
|
|
||||||
# and map them to the right analog stick axes (e.g., Joy Axis 4- for left, Joy Axis 4+ for right, etc.)
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
radius = 16.0
|
radius = 16.0
|
||||||
|
|
||||||
[node name="Player" type="CharacterBody2D"]
|
[node name="Player" type="CharacterBody2D"]
|
||||||
|
collision_layer = 17
|
||||||
|
collision_mask = 17
|
||||||
script = ExtResource("1_symyc")
|
script = ExtResource("1_symyc")
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
@@ -17,3 +19,7 @@ self_modulate = Color(0.223529, 1, 1, 1)
|
|||||||
texture = ExtResource("2_abrql")
|
texture = ExtResource("2_abrql")
|
||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="."]
|
[node name="Camera2D" type="Camera2D" parent="."]
|
||||||
|
|
||||||
|
[node name="InteractionRayCast" type="RayCast2D" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
target_position = Vector2(32, 0)
|
||||||
|
|||||||
BIN
entities/receiver/receiver.aseprite
Normal file
BIN
entities/receiver/receiver.aseprite
Normal file
Binary file not shown.
34
entities/receiver/receiver.aseprite.import
Normal file
34
entities/receiver/receiver.aseprite.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bpp73e14xkavd"
|
||||||
|
path="res://.godot/imported/receiver.aseprite-28c5d8cd1bd4d02e4c4885b4c9390a3c.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://entities/receiver/receiver.aseprite"
|
||||||
|
dest_files=["res://.godot/imported/receiver.aseprite-28c5d8cd1bd4d02e4c4885b4c9390a3c.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
|
||||||
7
entities/receiver/receiver.gd
Normal file
7
entities/receiver/receiver.gd
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
extends Interactable
|
||||||
|
|
||||||
|
func _on_interaction_area_body_entered(body: Player) -> void:
|
||||||
|
body.interaction_target = self
|
||||||
|
|
||||||
|
func _on_interaction_area_body_exited(body: Player) -> void:
|
||||||
|
body.interaction_target = null
|
||||||
1
entities/receiver/receiver.gd.uid
Normal file
1
entities/receiver/receiver.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://bsmung6fgm53e
|
||||||
11
entities/receiver/receiver.tscn
Normal file
11
entities/receiver/receiver.tscn
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[gd_scene load_steps=3 format=3 uid="uid://fo3xwyve7i5p"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://csbip0oj1uu0j" path="res://common/interactable.gd" id="1_iliiv"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bpp73e14xkavd" path="res://entities/receiver/receiver.aseprite" id="2_iyevf"]
|
||||||
|
|
||||||
|
[node name="Receiver" type="Node2D"]
|
||||||
|
script = ExtResource("1_iliiv")
|
||||||
|
metadata/_custom_type_script = "uid://csbip0oj1uu0j"
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
texture = ExtResource("2_iyevf")
|
||||||
BIN
entities/terrain/fog/fog.aseprite
Normal file
BIN
entities/terrain/fog/fog.aseprite
Normal file
Binary file not shown.
34
entities/terrain/fog/fog.aseprite.import
Normal file
34
entities/terrain/fog/fog.aseprite.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://b16ui0wwwtfq8"
|
||||||
|
path="res://.godot/imported/fog.aseprite-86527b7098109b17875078c4ed3ed204.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://entities/terrain/fog/fog.aseprite"
|
||||||
|
dest_files=["res://.godot/imported/fog.aseprite-86527b7098109b17875078c4ed3ed204.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
|
||||||
@@ -11,9 +11,15 @@ config_version=5
|
|||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="Ephemeral Echoes"
|
config/name="Ephemeral Echoes"
|
||||||
|
run/main_scene="uid://bopet83k23n7t"
|
||||||
config/features=PackedStringArray("4.4", "GL Compatibility")
|
config/features=PackedStringArray("4.4", "GL Compatibility")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[editor]
|
||||||
|
|
||||||
|
version_control/plugin_name="GitPlugin"
|
||||||
|
version_control/autoload_on_startup=true
|
||||||
|
|
||||||
[editor_plugins]
|
[editor_plugins]
|
||||||
|
|
||||||
enabled=PackedStringArray("res://addons/nklbdev.importality/plugin.cfg")
|
enabled=PackedStringArray("res://addons/nklbdev.importality/plugin.cfg")
|
||||||
@@ -64,6 +70,12 @@ rotate_down={
|
|||||||
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":1.0,"script":null)
|
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":1.0,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
interact={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user