Untracked Files
This commit is contained in:
16
Scripts/Characters/Player/interact_scanner.gd
Normal file
16
Scripts/Characters/Player/interact_scanner.gd
Normal file
@@ -0,0 +1,16 @@
|
||||
extends Area2D
|
||||
|
||||
@export var parent: Node2D
|
||||
@export var direction_component: FacingDirectionComponent
|
||||
|
||||
# Public Methods
|
||||
func OnDirectionChanged() -> void:
|
||||
var direction := direction_component.GetCurrentDirection()
|
||||
if direction == Enums.Directions.LEFT:
|
||||
parent.rotation = deg_to_rad(90)
|
||||
elif direction == Enums.Directions.RIGHT:
|
||||
parent.rotation = deg_to_rad(-90)
|
||||
elif direction == Enums.Directions.UP:
|
||||
parent.rotation = deg_to_rad(180)
|
||||
else:
|
||||
parent.rotation = deg_to_rad(0)
|
||||
1
Scripts/Characters/Player/interact_scanner.gd.uid
Normal file
1
Scripts/Characters/Player/interact_scanner.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://brlisuoocwehh
|
||||
18
Scripts/Characters/Player/movement_component.gd
Normal file
18
Scripts/Characters/Player/movement_component.gd
Normal file
@@ -0,0 +1,18 @@
|
||||
extends Node
|
||||
|
||||
signal MovementPerformed(movement_vector: Vector2)
|
||||
|
||||
# Constant Exports
|
||||
@export var SPEED := 100.0
|
||||
|
||||
@export var body: CharacterBody2D
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
var direction_vector := Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
|
||||
|
||||
if direction_vector:
|
||||
var movement_vector := direction_vector * SPEED
|
||||
body.velocity = movement_vector
|
||||
body.move_and_slide()
|
||||
|
||||
MovementPerformed.emit(movement_vector)
|
||||
1
Scripts/Characters/Player/movement_component.gd.uid
Normal file
1
Scripts/Characters/Player/movement_component.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dwclkwbig1uii
|
||||
12
Scripts/Characters/Player/player.gd
Normal file
12
Scripts/Characters/Player/player.gd
Normal file
@@ -0,0 +1,12 @@
|
||||
extends CharacterBody2D
|
||||
|
||||
signal InteractScannerAreaEntered(area: Area2D)
|
||||
signal InteractScannerAreaExited(area: Area2D)
|
||||
|
||||
|
||||
func _on_interact_scanner_area_entered(area: Area2D) -> void:
|
||||
InteractScannerAreaEntered.emit(area)
|
||||
|
||||
|
||||
func _on_interact_scanner_area_exited(area: Area2D) -> void:
|
||||
InteractScannerAreaExited.emit(area)
|
||||
1
Scripts/Characters/Player/player.gd.uid
Normal file
1
Scripts/Characters/Player/player.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dacvayqstkvws
|
||||
26
Scripts/Components/facing_direction_component.gd
Normal file
26
Scripts/Components/facing_direction_component.gd
Normal file
@@ -0,0 +1,26 @@
|
||||
extends Node
|
||||
class_name FacingDirectionComponent
|
||||
|
||||
signal DirectionChanged
|
||||
|
||||
@export var current_direction: Enums.Directions = Enums.Directions.DOWN
|
||||
|
||||
# Public Methods
|
||||
func GetCurrentDirection() -> Enums.Directions:
|
||||
return current_direction
|
||||
|
||||
|
||||
func ChangeDirectionUsingMovementVector(movement_vector: Vector2) -> void:
|
||||
var new_direction := _get_direction_from_mov_vec(movement_vector)
|
||||
if current_direction != new_direction:
|
||||
current_direction = new_direction
|
||||
DirectionChanged.emit()
|
||||
|
||||
|
||||
# Private Methods
|
||||
func _get_direction_from_mov_vec(mov_vec: Vector2) -> Enums.Directions:
|
||||
if mov_vec.x < 0: return Enums.Directions.LEFT
|
||||
if mov_vec.x > 0: return Enums.Directions.RIGHT
|
||||
if mov_vec.y < 0: return Enums.Directions.UP
|
||||
if mov_vec.y > 0: return Enums.Directions.DOWN
|
||||
return Enums.Directions.DOWN
|
||||
1
Scripts/Components/facing_direction_component.gd.uid
Normal file
1
Scripts/Components/facing_direction_component.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b0l02v61if6k8
|
||||
12
Scripts/Item Locations/abstract_location_items.gd
Normal file
12
Scripts/Item Locations/abstract_location_items.gd
Normal file
@@ -0,0 +1,12 @@
|
||||
extends Node
|
||||
class_name AbstractLocationItems
|
||||
|
||||
# Public Methods
|
||||
func CheckItemAtLocation(_location: Enums.CheckLocations) -> Enums.Items:
|
||||
push_error("Unimplemented Method")
|
||||
return Enums.Items.RED_POTION
|
||||
|
||||
|
||||
func GetLocationShopPrice(_location: Enums.CheckLocations) -> int:
|
||||
push_error("Unimplemented Method")
|
||||
return 0
|
||||
1
Scripts/Item Locations/abstract_location_items.gd.uid
Normal file
1
Scripts/Item Locations/abstract_location_items.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dhwej0slcry2j
|
||||
24
Scripts/Item Locations/location_items.gd
Normal file
24
Scripts/Item Locations/location_items.gd
Normal file
@@ -0,0 +1,24 @@
|
||||
extends AbstractLocationItems
|
||||
class_name LocationItems
|
||||
|
||||
# Public Methods
|
||||
func CheckItemAtLocation(location: Enums.CheckLocations) -> Enums.Items:
|
||||
match location:
|
||||
Enums.CheckLocations.SHOP_1:
|
||||
return Enums.Items.WOOD_SWORD
|
||||
Enums.CheckLocations.SHOP_2:
|
||||
return Enums.Items.BRONZE_KEY
|
||||
Enums.CheckLocations.SHOP_3:
|
||||
return Enums.Items.RED_POTION
|
||||
return Enums.Items.GOLD_100
|
||||
|
||||
|
||||
func GetLocationShopPrice(location: Enums.CheckLocations) -> int:
|
||||
match location:
|
||||
Enums.CheckLocations.SHOP_1:
|
||||
return 500
|
||||
Enums.CheckLocations.SHOP_2:
|
||||
return 200
|
||||
Enums.CheckLocations.SHOP_3:
|
||||
return 100
|
||||
return 1234
|
||||
1
Scripts/Item Locations/location_items.gd.uid
Normal file
1
Scripts/Item Locations/location_items.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dmtsyb6x5lnco
|
||||
8
Scripts/Managers/game_manager.gd
Normal file
8
Scripts/Managers/game_manager.gd
Normal file
@@ -0,0 +1,8 @@
|
||||
extends Node
|
||||
|
||||
var location_items: AbstractLocationItems
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
# TODO Will have an APLocationItems, select the correct one
|
||||
location_items = LocationItems.new()
|
||||
1
Scripts/Managers/game_manager.gd.uid
Normal file
1
Scripts/Managers/game_manager.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cb4tuxriixfqs
|
||||
27
Scripts/Maps/Connectors/shop_item_label_connector.gd
Normal file
27
Scripts/Maps/Connectors/shop_item_label_connector.gd
Normal file
@@ -0,0 +1,27 @@
|
||||
extends Node
|
||||
|
||||
@onready var item_notification: Label = $"../CanvasLayer/Item Notification"
|
||||
|
||||
var current_shop_item: ShopItem = null
|
||||
|
||||
# Public Methods
|
||||
func OnPlayerInteractScannerAreaEntered(area: Area2D) -> void:
|
||||
if area is not ShopItem:
|
||||
return
|
||||
|
||||
var shop_item := area as ShopItem
|
||||
if shop_item != current_shop_item:
|
||||
current_shop_item = shop_item
|
||||
var check_location := shop_item.check_location
|
||||
var item := GameManager.location_items.CheckItemAtLocation(check_location)
|
||||
var item_name: String = Enums.Items.keys()[item]
|
||||
item_notification.text = item_name
|
||||
|
||||
|
||||
func OnPlayerInteractScannerAreaExited(area: Area2D) -> void:
|
||||
if area is not ShopItem:
|
||||
return
|
||||
|
||||
if area == current_shop_item:
|
||||
item_notification.text = ""
|
||||
current_shop_item = null
|
||||
1
Scripts/Maps/Connectors/shop_item_label_connector.gd.uid
Normal file
1
Scripts/Maps/Connectors/shop_item_label_connector.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cpr710p4wdgx
|
||||
11
Scripts/Maps/shop.gd
Normal file
11
Scripts/Maps/shop.gd
Normal file
@@ -0,0 +1,11 @@
|
||||
extends Node2D
|
||||
|
||||
@onready var item_notification: Label = $"CanvasLayer/Item Notification"
|
||||
|
||||
|
||||
func _on_player_shop_item_scanned(item_name: String) -> void:
|
||||
item_notification.text = item_name
|
||||
|
||||
|
||||
func _on_player_shop_item_unscanned() -> void:
|
||||
item_notification.text = ""
|
||||
1
Scripts/Maps/shop.gd.uid
Normal file
1
Scripts/Maps/shop.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://btg630l3xo16w
|
||||
13
Scripts/Objects/shop_item.gd
Normal file
13
Scripts/Objects/shop_item.gd
Normal file
@@ -0,0 +1,13 @@
|
||||
extends Area2D
|
||||
class_name ShopItem
|
||||
|
||||
@export var check_location: Enums.CheckLocations
|
||||
|
||||
# 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
|
||||
1
Scripts/Objects/shop_item.gd.uid
Normal file
1
Scripts/Objects/shop_item.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cggyjxrk4qqfm
|
||||
11
Scripts/gui.gd
Normal file
11
Scripts/gui.gd
Normal file
@@ -0,0 +1,11 @@
|
||||
extends Control
|
||||
|
||||
|
||||
# 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
|
||||
1
Scripts/gui.gd.uid
Normal file
1
Scripts/gui.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c4w8hney4mesw
|
||||
11
Scripts/main.gd
Normal file
11
Scripts/main.gd
Normal file
@@ -0,0 +1,11 @@
|
||||
extends Node2D
|
||||
|
||||
|
||||
# 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
|
||||
1
Scripts/main.gd.uid
Normal file
1
Scripts/main.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://vv4pj8uhiad8
|
||||
11
Scripts/world.gd
Normal file
11
Scripts/world.gd
Normal file
@@ -0,0 +1,11 @@
|
||||
extends Node2D
|
||||
|
||||
|
||||
# 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
|
||||
1
Scripts/world.gd.uid
Normal file
1
Scripts/world.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ekp7au5wf06q
|
||||
Reference in New Issue
Block a user