forked from 2121578/gai-ca2
More PR review
parent
092203a31e
commit
aee610c7a0
|
@ -1,33 +1,34 @@
|
||||||
## Todo
|
## Todo
|
||||||
|
|
||||||
|
- Sprites (Dome)
|
||||||
|
- camp (multiple textures)
|
||||||
|
- boat
|
||||||
|
- see DC
|
||||||
|
- Design a tilemap for the game (Dome)
|
||||||
|
- Navigation v3 (Yan)
|
||||||
|
- Player: function to walk up to a tile, not onto the tile (trees, etc.)
|
||||||
|
- Visualization: Current navigation path
|
||||||
|
- Interactive and Non-Interactive Items
|
||||||
|
- Add all the items needed to build the game (bushes, trees, etc.)
|
||||||
|
- Add logic regarding the objects, like taking branches, etc.
|
||||||
|
- Camp, chest (inventory slots, array of items, Interactions)
|
||||||
|
- Implement Behaviours
|
||||||
|
- Implement all kinds of Behaviours, see document
|
||||||
|
- UI, Visualization, make the simulation understandable (Luca, Colin)
|
||||||
|
- GraphEdit
|
||||||
|
- GraphEdit toggle (key)
|
||||||
|
- Inventory
|
||||||
|
- Player Stats
|
||||||
|
- Temperature layer toggle (key)
|
||||||
|
- etc.
|
||||||
|
|
||||||
|
## Done
|
||||||
|
|
||||||
- Sprites (Dome)
|
- Sprites (Dome)
|
||||||
- Ground
|
- Ground
|
||||||
- Berry bush (filled, empty)
|
- Berry bush (filled, empty)
|
||||||
- Tree (filled, empty)
|
- Tree (filled, empty)
|
||||||
- Ship parts
|
- Ship parts
|
||||||
- camp (multiple textures)
|
|
||||||
- Design a tilemap for the game (Dome, Colin, Luca)
|
|
||||||
- Navigation v3 (Yan)
|
|
||||||
- Player: function to walk up to a tile, not onto the tile (trees, etc.)
|
|
||||||
- Player v2 (Colin)
|
|
||||||
- TBD
|
|
||||||
- Check player pickup function and inventory system (if inventory already full, etc.)
|
|
||||||
- Check player walking capability
|
|
||||||
- Interactions with camp, etc.
|
|
||||||
- Interactive and Non-Interactive Items (Luca)
|
|
||||||
- Add all the items needed to build the game (bushes, trees, etc.)
|
|
||||||
- Add logic regarding the objects, like picking up berries or taking branches, etc.
|
|
||||||
- Camp, chest (inventory slots, array of items)
|
|
||||||
- Implement Behaviours
|
|
||||||
- Implement all kinds of Behaviours, see document
|
|
||||||
- Visualization, make the simulation understandable
|
|
||||||
- GraphEdit
|
|
||||||
- Distances
|
|
||||||
- Current navigation path
|
|
||||||
- etc.
|
|
||||||
|
|
||||||
## Done
|
|
||||||
|
|
||||||
- Initialize Tilemap (Yan)
|
- Initialize Tilemap (Yan)
|
||||||
- Script --> World (manages access to tilemap)
|
- Script --> World (manages access to tilemap)
|
||||||
- Player is on tilemap
|
- Player is on tilemap
|
||||||
|
@ -53,7 +54,7 @@
|
||||||
- can pick up items from tilemap (Pickup)
|
- can pick up items from tilemap (Pickup)
|
||||||
- can drop items back onto tilemap (Pickup)
|
- can drop items back onto tilemap (Pickup)
|
||||||
- Navigation v2 (Yan)
|
- Navigation v2 (Yan)
|
||||||
- Support walkable attribute on interactive/non-interactive tilemap items (is_walkable)
|
- Support walkable attribute on interactive/non-interactive tilemap items (is_walkable)
|
||||||
- fix pathfinding for unreachable cells
|
- fix pathfinding for unreachable cells
|
||||||
- add search radius (max distance) before canceling
|
- add search radius (max distance) before canceling
|
||||||
- improve performance (or rather, check performance first)
|
- improve performance (or rather, check performance first)
|
||||||
|
|
|
@ -21,8 +21,9 @@ offset_right = 40.0
|
||||||
offset_bottom = 40.0
|
offset_bottom = 40.0
|
||||||
|
|
||||||
[node name="InventoryLabel" type="Label" parent="Camera2D/CanvasLayer/VBoxContainer"]
|
[node name="InventoryLabel" type="Label" parent="Camera2D/CanvasLayer/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "test"
|
text = "INV"
|
||||||
|
|
||||||
[node name="Tileset" type="Node2D" parent="."]
|
[node name="Tileset" type="Node2D" parent="."]
|
||||||
script = ExtResource("1_k0rw8")
|
script = ExtResource("1_k0rw8")
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class_name PlayerManager
|
class_name PlayerManager
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
@onready var inventory_label = $CanvasLayer/VBoxContainer/InventoryLabel
|
@onready var inventory_label: Label = %InventoryLabel
|
||||||
|
|
||||||
@export var food_damage: int = 1
|
@export var food_damage: int = 1
|
||||||
@export var temperature_damage: int = 1
|
@export var temperature_damage: int = 1
|
||||||
|
@ -38,8 +38,9 @@ func _process(delta: float) -> void:
|
||||||
if Input.is_action_just_pressed("key_5"):
|
if Input.is_action_just_pressed("key_5"):
|
||||||
pick_up_item(Vector2i(5, 8))
|
pick_up_item(Vector2i(5, 8))
|
||||||
pick_up_item(Vector2i(9, 9))
|
pick_up_item(Vector2i(9, 9))
|
||||||
|
update_board()
|
||||||
if Input.is_action_just_pressed("key_4"):
|
if Input.is_action_just_pressed("key_4"):
|
||||||
var nearest: Vector2i = find_nearest_object(game_manager.world.tilemap_types.OBJECT_COLLECTION_TREE)
|
var nearest: Vector2i = find_nearest_object([game_manager.world.tilemap_types.OBJECT_I_TREE_1])
|
||||||
# nearest.x = nearest.x - 1
|
# nearest.x = nearest.x - 1
|
||||||
walk_towards(nearest)
|
walk_towards(nearest)
|
||||||
update_board()
|
update_board()
|
||||||
|
@ -50,6 +51,10 @@ func _process(delta: float) -> void:
|
||||||
func update_board() -> void:
|
func update_board() -> void:
|
||||||
game_manager.world.tilemap_player.clear_cells()
|
game_manager.world.tilemap_player.clear_cells()
|
||||||
game_manager.world.tilemap_player.set_cell(board_position, tilemap_types.PLAYER)
|
game_manager.world.tilemap_player.set_cell(board_position, tilemap_types.PLAYER)
|
||||||
|
if inventory_slot and inventory_slot != tilemap_types.EMPTY:
|
||||||
|
inventory_label.text = str(inventory_slot)
|
||||||
|
else:
|
||||||
|
inventory_label.text = "empty"
|
||||||
|
|
||||||
|
|
||||||
# SECTION: inventory system
|
# SECTION: inventory system
|
||||||
|
@ -64,8 +69,11 @@ func pick_up_item(tilemap_pos: Vector2i) -> void:
|
||||||
|
|
||||||
# check if tile will transform into another tile upon pickup
|
# check if tile will transform into another tile upon pickup
|
||||||
var tile_after_pickup_transform = null
|
var tile_after_pickup_transform = null
|
||||||
if tilemap_types.OBJECT_COLLECTION_BERRY_FILLED_BUSH.has(pick_up_item_type):
|
var tile_drop_item: Vector2i = inventory_slot
|
||||||
tile_after_pickup_transform = tilemap_types.OBJECT_COLLECTION_BERRY_EMPTY_BUSH[0]
|
if tilemap_types.OBJECT_I_FILLED_BUSH == pick_up_item_type:
|
||||||
|
tile_after_pickup_transform = tilemap_types.OBJECT_I_EMPTY_BUSH
|
||||||
|
pick_up_item_type = tilemap_types.OBJECT_I_BERRY
|
||||||
|
tile_drop_item = tilemap_types.OBJECT_I_BERRY
|
||||||
|
|
||||||
# check if the inventory slot is empty
|
# check if the inventory slot is empty
|
||||||
if inventory_slot == tilemap_types.EMPTY:
|
if inventory_slot == tilemap_types.EMPTY:
|
||||||
|
@ -82,11 +90,11 @@ func pick_up_item(tilemap_pos: Vector2i) -> void:
|
||||||
game_manager.world.tilemap_interactive.set_cell(tilemap_pos, tile_after_pickup_transform)
|
game_manager.world.tilemap_interactive.set_cell(tilemap_pos, tile_after_pickup_transform)
|
||||||
var drop_location: Vector2i = game_manager.world.find_item_drop_location(tilemap_pos)
|
var drop_location: Vector2i = game_manager.world.find_item_drop_location(tilemap_pos)
|
||||||
if drop_location != tilemap_types.EMPTY:
|
if drop_location != tilemap_types.EMPTY:
|
||||||
game_manager.world.tilemap_interactive.set_cell(drop_location, inventory_slot)
|
game_manager.world.tilemap_interactive.set_cell(drop_location, tile_drop_item)
|
||||||
else:
|
else:
|
||||||
push_warning("Could not find valid drop position for ", inventory_slot)
|
push_warning("Could not find valid drop position for ", inventory_slot)
|
||||||
else:
|
else:
|
||||||
game_manager.world.tilemap_interactive.set_cell(tilemap_pos, inventory_slot)
|
game_manager.world.tilemap_interactive.set_cell(tilemap_pos, tile_drop_item)
|
||||||
inventory_slot = pick_up_item_type
|
inventory_slot = pick_up_item_type
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class_name TileMapTileTypes
|
class_name TileMapTileTypes
|
||||||
|
|
||||||
# global values
|
# global values
|
||||||
const EMPTY: Vector2i = Vector2i(-1, -1)
|
const EMPTY: Vector2i = Vector2i(-1, -1)
|
||||||
const NO_TILE_FOUND: Vector2i = Vector2i(-999999, -999999)
|
const NO_TILE_FOUND: Vector2i = Vector2i(-999999, -999999)
|
||||||
#
|
#
|
||||||
# ground, sid = 0
|
# ground, sid = 0
|
||||||
|
@ -16,22 +16,20 @@ const OBJECT_NI_RANDOM_1: Vector2i = Vector2i(0, 0) # testing only, to be remove
|
||||||
const OBJECT_NI_RANDOM_2: Vector2i = Vector2i(1, 0) # testing only, to be removed
|
const OBJECT_NI_RANDOM_2: Vector2i = Vector2i(1, 0) # testing only, to be removed
|
||||||
const OBJECT_NI_ROCK_1: Vector2i = Vector2i(2, 0)
|
const OBJECT_NI_ROCK_1: Vector2i = Vector2i(2, 0)
|
||||||
# I = interactive
|
# I = interactive
|
||||||
const OBJECT_I_BOAT_ENGINE: Vector2i = Vector2i(0, 1)
|
const OBJECT_I_BOAT_ENGINE: Vector2i = Vector2i(0, 1)
|
||||||
const OBJECT_I_FUEL: Vector2i = Vector2i(1, 1)
|
const OBJECT_I_FUEL: Vector2i = Vector2i(1, 1)
|
||||||
const OBJECT_I_ANCHOR: Vector2i = Vector2i(2, 1)
|
const OBJECT_I_ANCHOR: Vector2i = Vector2i(2, 1)
|
||||||
const OBJECT_I_EMPTY_BUSH: Vector2i = Vector2i(3, 0)
|
const OBJECT_I_EMPTY_BUSH: Vector2i = Vector2i(3, 0)
|
||||||
const OBJECT_I_FILLED_BUSH: Vector2i = Vector2i(3, 1)
|
const OBJECT_I_FILLED_BUSH: Vector2i = Vector2i(3, 1)
|
||||||
const OBJECT_I_TREE_1_TOP: Vector2i = Vector2i(4, 0)
|
const OBJECT_I_BERRY: Vector2i = Vector2i(0, 5)
|
||||||
const OBJECT_I_TREE_1_BOTTOM: Vector2i = Vector2i(4, 1)
|
const OBJECT_I_TREE_1: Vector2i = Vector2i(4, 0)
|
||||||
const OBJECT_I_CHEST: Vector2i = Vector2i(0, 2)
|
const OBJECT_I_CHEST: Vector2i = Vector2i(0, 2)
|
||||||
const OBJECT_I_GEARS: Vector2i = Vector2i(1, 2)
|
const OBJECT_I_GEARS: Vector2i = Vector2i(1, 2)
|
||||||
const OBJECT_I_MEDIKIT: Vector2i = Vector2i(2, 2)
|
const OBJECT_I_MEDIKIT: Vector2i = Vector2i(2, 2)
|
||||||
const OBJECT_I_PADDLE: Vector2i = Vector2i(3, 2)
|
const OBJECT_I_PADDLE: Vector2i = Vector2i(3, 2)
|
||||||
const OBJECT_I_GAS_STOVE: Vector2i = Vector2i(4, 2)
|
const OBJECT_I_GAS_STOVE: Vector2i = Vector2i(4, 2)
|
||||||
# collections
|
# collections
|
||||||
const OBJECT_COLLECTION_TREE: Array[Vector2i] = [OBJECT_I_TREE_1_TOP, OBJECT_I_TREE_1_BOTTOM]
|
const OBJECT_COLLECTION_BERRY_SOURCE: Array[Vector2i] = [OBJECT_I_FILLED_BUSH, OBJECT_I_BERRY]
|
||||||
const OBJECT_COLLECTION_BERRY_FILLED_BUSH: Array[Vector2i] = [OBJECT_I_FILLED_BUSH]
|
|
||||||
const OBJECT_COLLECTION_BERRY_EMPTY_BUSH: Array[Vector2i] = [OBJECT_I_EMPTY_BUSH]
|
|
||||||
#
|
#
|
||||||
# temperature, sid = 2
|
# temperature, sid = 2
|
||||||
const TEMPERATURE_NORMAL: Vector2i = Vector2i(-1, -1)
|
const TEMPERATURE_NORMAL: Vector2i = Vector2i(-1, -1)
|
||||||
|
|
Loading…
Reference in New Issue