From 38c6091befed3448432e1679f3fdd51d84478a11 Mon Sep 17 00:00:00 2001 From: Yehoshua Sandler Date: Mon, 10 Mar 2025 19:59:24 -0500 Subject: [PATCH] update gitignore --- .gitignore | 20 ++++++++++++++++++++ entities/CameraFollow.gd | 17 +++++++++++++++++ entities/player/CharacterController.gd | 24 ++++++++++++++++++++++++ modules/weapons/Weapon.gd | 12 ++++++++++++ modules/weapons/WeaponSystem.gd | 11 +++++++++++ 5 files changed, 84 insertions(+) create mode 100644 entities/CameraFollow.gd create mode 100644 entities/player/CharacterController.gd create mode 100644 modules/weapons/Weapon.gd create mode 100644 modules/weapons/WeaponSystem.gd diff --git a/.gitignore b/.gitignore index 0af181c..d1a31e1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,23 @@ # Godot 4+ specific ignores .godot/ /android/ + +.import/ +export.cfg +export_presets.cfg +# Dummy HTML5 export presets file for continuous integration +!.github/dist/export_presets.cfg + +# Imported translations (automatically generated from CSV files) +*.translation + +# Mono-specific ignores +.mono/ +data_*/ +mono_crash.*.json + +# System/tool-specific ignores +.directory +.DS_Store +*~ +*.blend1 diff --git a/entities/CameraFollow.gd b/entities/CameraFollow.gd new file mode 100644 index 0000000..046ecce --- /dev/null +++ b/entities/CameraFollow.gd @@ -0,0 +1,17 @@ +extends Camera2D +@onready var global = $"/root/Player" +var targetPosition = Vector2(0,0) +var moving = true +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + pass + global.connect("playerPosition",setTargetPosition) + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + if moving == true: + self.set_position(targetPosition) + +func setTargetPosition(pos): + targetPosition = pos diff --git a/entities/player/CharacterController.gd b/entities/player/CharacterController.gd new file mode 100644 index 0000000..4a1b85e --- /dev/null +++ b/entities/player/CharacterController.gd @@ -0,0 +1,24 @@ +extends CharacterBody2D +@onready var global = $"/root/Player" + +const SPEED = 350.0 + + +func _physics_process(delta: float) -> void: + global.emit_signal("playerPosition",self.global_position) + movement() + +func animation(): + pass + +func movement(): + var vertical = Input.get_axis("up","down") + var horizontal = Input.get_axis("left","right") + if is_equal_approx(abs(vertical),1.0) and is_equal_approx(abs(horizontal),1.0): + velocity.y = SPEED*vertical/2 + velocity.x = SPEED*horizontal/2 + else: + velocity.y = SPEED * vertical + velocity.x = SPEED * horizontal + move_and_slide() + $"../Camera2D/Label".text = (str(self.global_position)) diff --git a/modules/weapons/Weapon.gd b/modules/weapons/Weapon.gd new file mode 100644 index 0000000..3da5d5e --- /dev/null +++ b/modules/weapons/Weapon.gd @@ -0,0 +1,12 @@ +class_name Weapon extends Node + +export(String) var type + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + pass diff --git a/modules/weapons/WeaponSystem.gd b/modules/weapons/WeaponSystem.gd new file mode 100644 index 0000000..fae2c76 --- /dev/null +++ b/modules/weapons/WeaponSystem.gd @@ -0,0 +1,11 @@ +extends Node + + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + pass