Skip to content

Commit

Permalink
iteration 2, difficulties, bigger map
Browse files Browse the repository at this point in the history
  • Loading branch information
Firsttryy committed Nov 26, 2023
1 parent 5539736 commit bd0e8cf
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 908 deletions.
37 changes: 37 additions & 0 deletions Player.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[gd_scene load_steps=6 format=3 uid="uid://dtrwuixcjkych"]

[ext_resource type="Script" path="res://addons/pronto/behaviors/PlaceholderBehavior.gd" id="1_5o3sf"]
[ext_resource type="Script" path="res://addons/pronto/behaviors/PlatformerControllerBehavior.gd" id="2_tgqdo"]
[ext_resource type="Script" path="res://addons/pronto/behaviors/CollisionBehavior.gd" id="3_7fttg"]

[sub_resource type="Image" id="Image_xwmie"]
data = {
"data": PackedByteArray(249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 255, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0, 249, 250, 251, 0),
"format": "RGBA8",
"height": 16,
"mipmaps": false,
"width": 16
}

[sub_resource type="ImageTexture" id="ImageTexture_kmp6q"]
image = SubResource("Image_xwmie")

[node name="CharacterBody2D" type="CharacterBody2D"]

[node name="PlaceholderBehavior" type="Node2D" parent="."]
script = ExtResource("1_5o3sf")
use_sprite = true
sprite_texture = SubResource("ImageTexture_kmp6q")
placeholder_size = Vector2(51, 65)

[node name="PlatformerControllerBehavior" type="Node2D" parent="."]
position = Vector2(54, -84)
script = ExtResource("2_tgqdo")

[node name="Camera2D" type="Camera2D" parent="."]

[node name="CollisionBehavior" type="Node2D" parent="."]
position = Vector2(-76, -57)
script = ExtResource("3_7fttg")
limit_to_group = "enemy"
metadata/pronto_connections = []
3 changes: 0 additions & 3 deletions addons/pronto/behaviors/HealthBarBehavior.gd
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,3 @@ func handles():
"healthbar_size",
func (coord): return (floor(coord * 2) * transform.translated(-position)).clamp(Vector2(1, 1), Vector2(10000, 10000)))
]

func wrong_key_damage():
damage(25)
16 changes: 16 additions & 0 deletions prototypes/game-test/DifficultyButton.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
extends Button


# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass



func _on_node_changed_difficulty(to):
text = "Difficulty: " + to
15 changes: 8 additions & 7 deletions prototypes/game-test/GrassDirtGenericTileSet.tres
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ texture = ExtResource("1_djwyt")
0:0/0 = 0
0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:0/0/physics_layer_0/angular_velocity = 0.0
0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-6.62164, -6.53336, -4.32614, -8, 8, -8, 8, 8, -8, 8, -8, -5.20903)
0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
1:0/0 = 0
1:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
1:0/0/physics_layer_0/angular_velocity = 0.0
1:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
2:0/0 = 0
2:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
2:0/0/physics_layer_0/angular_velocity = 0.0
2:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, -4.32614, -8, 4.06128, -8, 6.88651, -6.53336, 8, -5.12074, 8, 8, -8, 8, -8, -5.20903)
2:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
4:0/0 = 0
4:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
4:0/0/physics_layer_0/angular_velocity = 0.0
4:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-6.70993, -6.62164, -4.32614, -8, 4.06128, -8, 6.88651, -6.53336, 8, -5.12074, 8, 8, -8, 8, -8, -5.20903)
4:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
6:0/0 = 0
6:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
6:0/0/physics_layer_0/angular_velocity = 0.0
Expand Down Expand Up @@ -147,18 +147,19 @@ texture = ExtResource("1_djwyt")
0:4/0 = 0
0:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:4/0/physics_layer_0/angular_velocity = 0.0
0:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
1:4/0 = 0
1:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
1:4/0/physics_layer_0/angular_velocity = 0.0
1:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
2:4/0 = 0
2:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
2:4/0/physics_layer_0/angular_velocity = 0.0
2:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-6.53336, -7.06309, -4.32614, -8, 4.06128, -8, 6.44507, -6.62164, 8, -5.12074, 8, 8, -8, 8, -8, -5.20903)
2:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
4:4/0 = 0
4:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
4:4/0/physics_layer_0/angular_velocity = 0.0
4:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-6.53336, -7.06309, -4.32614, -8, 4.06128, -8, 6.44507, -6.62164, 8, -5.12074, 8, 8, -8, 8, -8, -5.20903)
4:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
6:4/0 = 0
6:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
6:4/0/physics_layer_0/angular_velocity = 0.0
Expand Down Expand Up @@ -186,11 +187,11 @@ texture = ExtResource("1_djwyt")
15:4/0 = 0
15:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
15:4/0/physics_layer_0/angular_velocity = 0.0
15:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-6.70993, -6.62164, -4.32614, -8, 4.06128, -8, 8, -8, 8, -5.12074, 8, 8, -8, 8, -8, -5.20903)
15:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
16:4/0 = 0
16:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
16:4/0/physics_layer_0/angular_velocity = 0.0
16:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, -4.32614, -8, 4.06128, -8, 6.44507, -6.62164, 8, -5.12074, 8, 8, -8, 8, -8, -5.20903)
16:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)

[resource]
physics_layer_0/collision_layer = 1
Expand Down
11 changes: 10 additions & 1 deletion prototypes/game-test/Label4.gd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,16 @@ func key_code_to_char(key_code):
return char(key_code - KEY_A + 65) # 97 is ASCII for 'a'

func set_text_key_code(current_key_code: Variant):
change_text("Press: " + key_code_to_char(current_key_code))
if current_key_code == KEY_UP:
change_text("Press: UP")
elif current_key_code == KEY_DOWN:
change_text("Press: DOWN")
elif current_key_code == KEY_LEFT:
change_text("Press: LEFT")
elif current_key_code == KEY_RIGHT:
change_text("Press: RIGHT")
else:
change_text("Press: " + key_code_to_char(current_key_code))

func set_text_key_pressed():
change_text("")
Expand Down
34 changes: 31 additions & 3 deletions prototypes/game-test/Node.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,34 @@ var current_key_code = 0

# Called when the node enters the scene tree for the first time.
func _ready():
randomize() # Initialize the random number generator
randomize()
changed_difficulty.emit(currentDifficulty_to_string())
# Initialize the random number generator
# current_key_code = get_random_key_code()
# print("Press the key: ", key_code_to_char(current_key_code))

signal key_pressed()
signal change_text(current_key_code: Variant)
signal wrong_key_pressed()
signal changed_difficulty(to: String)

var fluteKeysEasy = [KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT]
var fluteKeysMedium = [KEY_U, KEY_I, KEY_O, KEY_J, KEY_K, KEY_L]

enum Difficulty {
easy = 0,
medium = 1,
hard = 2
}

var currentDifficulty = Difficulty.easy

func get_random_key_code():
return KEY_A + randi() % 26
if currentDifficulty == Difficulty.easy:
return fluteKeysEasy[randi() % 4]
elif currentDifficulty == Difficulty.medium:
return fluteKeysMedium[randi() % 6]
elif currentDifficulty == Difficulty.hard:
return KEY_A + randi() % 26

# Called every frame
func _process(delta):
Expand All @@ -26,3 +44,13 @@ func _process(delta):
func get_new_key():
current_key_code = get_random_key_code()
change_text.emit(current_key_code)

func change_difficulty():
currentDifficulty = (currentDifficulty + 1) % 3
changed_difficulty.emit(currentDifficulty_to_string())

func currentDifficulty_to_string():
return Difficulty.keys()[currentDifficulty]

func _on_difficulty_pressed():
change_difficulty()
Loading

0 comments on commit bd0e8cf

Please sign in to comment.