Initial commit

This commit is contained in:
2026-01-21 23:51:53 +01:00
commit 60b208fee0
1703 changed files with 100223 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
extends Node
class_name EnemyStateMachiene
@export var initial_state: EnemyState
@export var enemy_ref: BaseEnemy
var current_state: EnemyState
var states: Dictionary = {}
func _ready() -> void:
for child in get_children():
if child is EnemyState:
states[child.name.to_lower()] = child
child.Transitioned.connect(on_child_transition)
child.enemy_ref = enemy_ref
if initial_state:
initial_state.Enter()
current_state = initial_state
func _process(delta: float) -> void:
if not is_multiplayer_authority(): return
if current_state:
current_state.Update(delta)
func _physics_process(delta: float) -> void:
if not is_multiplayer_authority(): return
if current_state:
current_state.Physics_Update(delta)
func on_child_transition(state: EnemyState, new_state_name: String):
if state != current_state:
return
var new_state = states.get(new_state_name.to_lower())
if !new_state:
return
if current_state:
current_state.Exit()
new_state.Enter()
current_state = new_state

View File

@@ -0,0 +1,44 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bew2tk4aobc2e"
path.s3tc="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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=0
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View File

@@ -0,0 +1,41 @@
extends Object
class_name RoomImageLoader
signal finishedLoading
func loadRoomData(image: Image) -> Array[Array]:
var imageSize: Vector2i = image.get_size()
var returnArray: Array[Array]
for x in imageSize.x:
var yArray: Array[GridCell]
returnArray.push_back(yArray)
for y in imageSize.y:
var gridCell: GridCell = GridCell.new()
var pixel: Color = image.get_pixel(x,y)
gridCell.spaceTaken = isColorTakingSpace(pixel)
if pixel == Color(1,0,0,1):
gridCell.door = true
gridCell.doorOrientation = getDoorOrientation(image,Vector2i(x,y))
yArray.push_back(gridCell)
finishedLoading.emit()
return returnArray
func isColorTakingSpace(pixel: Color) -> bool:
var returnBool: bool = true
if pixel == Color(1,1,1,1) or pixel == Color(1,0,0,1):
returnBool = false
return returnBool
func getDoorOrientation(image: Image,pos: Vector2i) -> int:
if image.get_pixelv(pos + Vector2i(0,-1)) == Color(0,0,1,1): return GridCell.doorOrientations.north
if image.get_pixelv(pos + Vector2i(1,-1)) == Color(0,0,1,1): return GridCell.doorOrientations.north_west
if image.get_pixelv(pos + Vector2i(1,0)) == Color(0,0,1,1): return GridCell.doorOrientations.west
if image.get_pixelv(pos + Vector2i(1,1)) == Color(0,0,1,1): return GridCell.doorOrientations.south_west
if image.get_pixelv(pos + Vector2i(0,1)) == Color(0,0,1,1): return GridCell.doorOrientations.south
if image.get_pixelv(pos + Vector2i(-1,1)) == Color(0,0,1,1): return GridCell.doorOrientations.south_east
if image.get_pixelv(pos + Vector2i(-1,0)) == Color(0,0,1,1): return GridCell.doorOrientations.east
if image.get_pixelv(pos + Vector2i(-1,-1)) == Color(0,0,1,1): return GridCell.doorOrientations.north_east
return 0

View File

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