Most of prototype! yay

This commit is contained in:
2025-05-01 08:27:30 -05:00
parent 11605c9f17
commit 30bf202118
51 changed files with 1906 additions and 52 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 583 B

11
entities/button/button.gd Normal file
View 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

View File

@@ -0,0 +1 @@
uid://ba287kjc4mtb2

View File

@@ -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"]
radius = 32.0
[sub_resource type="CircleShape2D" id="CircleShape2D_7gf2j"]
radius = 13.0
[node name="Button" type="Node2D"]
script = ExtResource("1_7gf2j")
metadata/_custom_type_script = "uid://csbip0oj1uu0j"
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
sprite_frames = ExtResource("1_4tlb3")
[node name="InteractionArea" type="Area2D" parent="."]
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"
[node name="Area2D" type="Area2D" parent="."]
[node name="StaticBody2D" type="StaticBody2D" parent="."]
script = ExtResource("3_6bgj0")
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource("CircleShape2D_4tlb3")
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
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"]

Binary file not shown.

View 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

View 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

View File

@@ -0,0 +1 @@
uid://ckgd1u5akr3hc

View 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")

Binary file not shown.

View File

@@ -2,16 +2,16 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://m8ophji4p35i"
path="res://.godot/imported/button.aseprite.png-65b0b5c35c3c69ebe0561afd09528d1a.ctex"
uid="uid://cnad2jlo5hr1l"
path="res://.godot/imported/emitter.aseprite-f91716bd71a163efdc85e760a80b8f74.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entities/button/button.aseprite.png"
dest_files=["res://.godot/imported/button.aseprite.png-65b0b5c35c3c69ebe0561afd09528d1a.ctex"]
source_file="res://entities/emitter/emitter.aseprite"
dest_files=["res://.godot/imported/emitter.aseprite-f91716bd71a163efdc85e760a80b8f74.ctex"]
[params]

View 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)

View File

@@ -0,0 +1 @@
uid://cxtlguregjv8m

View 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")

View 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))

View File

@@ -0,0 +1 @@
uid://dtbeaqn2f6anq

View 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

View File

@@ -1,5 +1,7 @@
# This script controls a top-down player character using input and rotates towards the mouse or right stick.
extends CharacterBody2D
class_name Player
@onready var interaction_ray_cast: RayCast2D = %InteractionRayCast
# Player movement speed (pixels per second)
@export var speed = 200
@@ -12,43 +14,39 @@ extends CharacterBody2D
# Use mouse for rotation? If false, uses gamepad right stick.
@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):
# --- 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:
velocity = input_vector * speed
if not interacting_state.restrict_movement():
velocity = input_vector * speed
interacting_state.on_movement_input(input_vector, self)
else:
# If no input, stop the player (optional, you might want friction instead)
velocity = lerp(velocity, Vector2.ZERO, friction * delta)
# Move the player and handle collisions using CharacterBody2D's move_and_slide
move_and_slide()
# --- Rotation Logic ---
var target_rotation_direction = Vector2.ZERO
if rotate_with_mouse:
# Get the mouse position in world coordinates
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)
else:
# Get right analog stick input
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:
# Calculate the target rotation angle in radians
var target_angle = target_rotation_direction.angle()
# Smoothly rotate the player towards the target angle
# Using lerp_angle for smooth interpolation of angles
rotation = lerp_angle(rotation, target_angle, rotation_speed * delta)
# Note: Make sure you have input actions configured in Project Settings -> Input Map:
# - "move_up", "move_down", "move_left", "move_right" for movement.
# - 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.)
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)
# --- Interact Logic ---
if Input.is_action_just_pressed("interact"):
if interaction_ray_cast.is_colliding():
var interaction_target = interaction_ray_cast.get_collider()
if interaction_target is InteractableBody:
interaction_target.interact(self)

View File

@@ -7,6 +7,8 @@
radius = 16.0
[node name="Player" type="CharacterBody2D"]
collision_layer = 17
collision_mask = 17
script = ExtResource("1_symyc")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
@@ -17,3 +19,7 @@ self_modulate = Color(0.223529, 1, 1, 1)
texture = ExtResource("2_abrql")
[node name="Camera2D" type="Camera2D" parent="."]
[node name="InteractionRayCast" type="RayCast2D" parent="."]
unique_name_in_owner = true
target_position = Vector2(32, 0)

Binary file not shown.

View 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

View 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

View File

@@ -0,0 +1 @@
uid://bsmung6fgm53e

View 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")

Binary file not shown.

View 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