diff options
author | Henrique Alves <henriquelalves@gmail.com> | 2022-07-16 16:17:07 -0300 |
---|---|---|
committer | Henrique Alves <henriquelalves@gmail.com> | 2022-07-16 16:17:07 -0300 |
commit | c34e0dcdb890130a52e6be8d250591cf4ba48357 (patch) | |
tree | 1541141efa426c88b0df0445e23f943070479a46 | |
parent | fda99f4220dd9394b5f377991c76aecc00553443 (diff) | |
parent | 123c6f3db50f5fbb2160d65f2d36f8c6238125ee (diff) | |
download | gamejam-gmtk-2022-c34e0dcdb890130a52e6be8d250591cf4ba48357.tar.gz gamejam-gmtk-2022-c34e0dcdb890130a52e6be8d250591cf4ba48357.tar.bz2 gamejam-gmtk-2022-c34e0dcdb890130a52e6be8d250591cf4ba48357.zip |
Merge remote-tracking branch 'origin/main'
-rw-r--r-- | Assets/arrow.png | bin | 0 -> 2436 bytes | |||
-rw-r--r-- | Assets/arrow.png.import | 37 | ||||
-rw-r--r-- | Scenes/Dungeon.gd | 22 | ||||
-rw-r--r-- | Scenes/Entity.gd | 3 | ||||
-rw-r--r-- | Scenes/Plate.gd | 8 | ||||
-rw-r--r-- | Scenes/PlateBounce.gd | 24 | ||||
-rw-r--r-- | Scenes/PlateBounce.tscn | 21 | ||||
-rw-r--r-- | Scenes/PlateKey.gd | 2 |
8 files changed, 105 insertions, 12 deletions
diff --git a/Assets/arrow.png b/Assets/arrow.png Binary files differnew file mode 100644 index 0000000..b7b01e5 --- /dev/null +++ b/Assets/arrow.png diff --git a/Assets/arrow.png.import b/Assets/arrow.png.import new file mode 100644 index 0000000..6f995ca --- /dev/null +++ b/Assets/arrow.png.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="StreamTexture" +path.s3tc="res://.import/arrow.png-57f8c059c3343415ea6369e587d21c52.s3tc.stex" +path.etc="res://.import/arrow.png-57f8c059c3343415ea6369e587d21c52.etc.stex" +metadata={ +"imported_formats": [ "s3tc", "etc" ], +"vram_texture": true +} + +[deps] + +source_file="res://Assets/arrow.png" +dest_files=[ "res://.import/arrow.png-57f8c059c3343415ea6369e587d21c52.s3tc.stex", "res://.import/arrow.png-57f8c059c3343415ea6369e587d21c52.etc.stex" ] + +[params] + +compress/mode=2 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=true +flags/filter=true +flags/mipmaps=true +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/Scenes/Dungeon.gd b/Scenes/Dungeon.gd index bd3e63f..84d954f 100644 --- a/Scenes/Dungeon.gd +++ b/Scenes/Dungeon.gd @@ -3,6 +3,7 @@ extends Spatial const Player = preload("res://Scenes/Player.tscn") const Obstacle = preload("res://Scenes/Obstacle.tscn") const MonsterScene = preload("res://Scenes/MonsterRandCardinal.tscn") +const PlateBounce = preload("res://Scenes/PlateBounce.tscn") const PlateKey = preload("res://Scenes/PlateKey.tscn") const Crystal = preload("res://Scenes/Crystal.tscn") @@ -58,7 +59,7 @@ func build_floor(): set_tile(monster, rand_pos) add_child(monster) - var number_crystals = floor(Global.current_stage / 10.0) + 1 + var number_crystals = floor(Global.current_stage / 2.0) + 1 for i in range(number_crystals): rand_pos = Vector2(randi()%8 - 4, randi()%8 - 4) while tiles_entities.has(rand_pos): @@ -68,13 +69,22 @@ func build_floor(): add_child(crystal) rand_pos = Vector2(randi()%8 - 4, randi()%8 - 4) - while tiles_entities.has(rand_pos): + while tiles_floor.has(rand_pos): rand_pos = Vector2(randi()%8 - 4, randi()%8 - 4) var plate_key = PlateKey.instance() plate_key.set_crystal(crystal) tiles_floor[rand_pos] = plate_key add_child(plate_key) + for i in range(4): + rand_pos = Vector2(randi()%8 - 4, randi()%8 - 4) + while tiles_floor.has(rand_pos): + rand_pos = Vector2(randi()%8 - 4, randi()%8 - 4) + var plate_bounce = PlateBounce.instance() + plate_bounce.set_cardinal(randi() % 4) + tiles_floor[rand_pos] = plate_bounce + add_child(plate_bounce) + for key in tiles_entities: tiles_entities[key].translation = tile_to_pos(key) @@ -135,12 +145,11 @@ func process_turn_logic(): player.roll(-input) # player move - if move_entity(player, input): - player.roll(input) + move_entity(player, input) var player_tile = entities_tiles[player] if tiles_floor.has(player_tile): - tiles_floor[player_tile].step(player.get_top()) + tiles_floor[player_tile].step(player, self) input = Vector2.ZERO # check tile player @@ -201,8 +210,7 @@ func move_entity(entity : Entity, dir : Vector2): set_tile(entity, new_tile) entity.add_action("cor_move", [tile_to_pos(new_tile), 0.2]) - - return true + entity.roll(dir) func tile_to_pos(tile : Vector2): return Vector3(tile.x, 0, -tile.y) diff --git a/Scenes/Entity.gd b/Scenes/Entity.gd index 880f904..a13c23b 100644 --- a/Scenes/Entity.gd +++ b/Scenes/Entity.gd @@ -13,6 +13,9 @@ func _ready(): func get_top() -> String: return '' +func roll(direction : Vector2): + pass + func add_action(name : String, args : Array): actions_queue.append([name, args]) diff --git a/Scenes/Plate.gd b/Scenes/Plate.gd index c819cf1..f569072 100644 --- a/Scenes/Plate.gd +++ b/Scenes/Plate.gd @@ -4,9 +4,9 @@ class_name Plate export(Array, String) var valid_symbols -func step(symbol : String): - if valid_symbols.empty() or valid_symbols.has(symbol): - activate() +func step(entity : Entity, dungeon): + if valid_symbols == null or valid_symbols.empty() or valid_symbols.has(entity.get_top()): + activate(entity, dungeon) -func activate(): +func activate(entity : Entity, dungeon): pass diff --git a/Scenes/PlateBounce.gd b/Scenes/PlateBounce.gd new file mode 100644 index 0000000..b3b0ec4 --- /dev/null +++ b/Scenes/PlateBounce.gd @@ -0,0 +1,24 @@ +extends Plate + +export(int) var cardinal setget set_cardinal + +onready var mesh : MeshInstance = $Mesh +onready var is_ready : bool = true + +func _ready(): + set_cardinal(cardinal) + +func activate(entity : Entity, dungeon): + var direction : Vector2 + match cardinal: + 0: direction = Vector2(0, +1) + 1: direction = Vector2(-1, 0) + 2: direction = Vector2(0, -1) + 3: direction = Vector2(+1, 0) + + dungeon.move_entity(entity, direction) + +func set_cardinal(value : int): + if is_ready: + mesh.transform.basis = Basis(Vector3.UP, value * PI / 2) + cardinal = value diff --git a/Scenes/PlateBounce.tscn b/Scenes/PlateBounce.tscn new file mode 100644 index 0000000..d5b2d07 --- /dev/null +++ b/Scenes/PlateBounce.tscn @@ -0,0 +1,21 @@ +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://Scenes/PlateBounce.gd" type="Script" id=1] +[ext_resource path="res://Assets/arrow.png" type="Texture" id=2] + +[sub_resource type="PlaneMesh" id=1] +size = Vector2( 1, 1 ) + +[sub_resource type="SpatialMaterial" id=2] +flags_transparent = true +albedo_texture = ExtResource( 2 ) + +[node name="PlateBounce" type="Spatial"] +script = ExtResource( 1 ) +valid_symbols = [ "2", "3", "4", "5", "6" ] +cardinal = null + +[node name="Mesh" type="MeshInstance" parent="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.05, 0 ) +mesh = SubResource( 1 ) +material/0 = SubResource( 2 ) diff --git a/Scenes/PlateKey.gd b/Scenes/PlateKey.gd index e43d664..1342469 100644 --- a/Scenes/PlateKey.gd +++ b/Scenes/PlateKey.gd @@ -4,7 +4,7 @@ export(NodePath) var crystal_path onready var crystal : Crystal = get_node(crystal_path) setget set_crystal -func activate(): +func activate(entity : Entity, dungeon): if crystal == null or crystal.is_active: return |