Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Add Levels #65

Merged
merged 2 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/sprites/tree.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions assets/sprites/tree.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://b3ndk1670c72n"
path="res://.godot/imported/tree.png-15cb16b197553088007c6ba3ce2f75b0.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/sprites/tree.png"
dest_files=["res://.godot/imported/tree.png-15cb16b197553088007c6ba3ce2f75b0.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file modified assets/tilesets/map_sprites/overworld_map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/tilesets/map_sprites/overworld_map.png.import
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

importer="texture"
type="CompressedTexture2D"
uid="uid://daeq7tqcv820"
uid="uid://c45d6tubm84m2"
path="res://.godot/imported/overworld_map.png-e162d543f33f888f742bc30311d3dec2.ctex"
metadata={
"vram_texture": false
Expand Down
20 changes: 18 additions & 2 deletions assets/tilesets/tiles.tres
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[gd_resource type="TileSet" load_steps=3 format=3 uid="uid://du4mlit2n1o7c"]

[ext_resource type="Texture2D" uid="uid://daeq7tqcv820" path="res://assets/tilesets/map_sprites/overworld_map.png" id="1_v37tw"]
[ext_resource type="Texture2D" uid="uid://c45d6tubm84m2" path="res://assets/tilesets/map_sprites/overworld_map.png" id="1_t8qnn"]

[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_jrkn6"]
texture = ExtResource("1_v37tw")
texture = ExtResource("1_t8qnn")
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
Expand Down Expand Up @@ -56,6 +56,22 @@ texture = ExtResource("1_v37tw")
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
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(-8, -8, 8, -8, 8, 8, -8, 8, -8, -8)
0:1/0 = 0
0:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:1/0/physics_layer_0/angular_velocity = 0.0
4:1/0 = 0
4:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
4:1/0/physics_layer_0/angular_velocity = 0.0
0:2/0 = 0
0:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:2/0/physics_layer_0/angular_velocity = 0.0
4:2/0 = 0
4:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
4:2/0/physics_layer_0/angular_velocity = 0.0

[resource]
physics_layer_0/collision_layer = 3
Expand Down
11 changes: 11 additions & 0 deletions game/characters/wizard/wizard.gd
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ extends CharacterBody2D
## Slow down, kid!
@export var friction: int = 25

## allows jump without walls or floor
var jump := false

var is_game_over := false

var score := 0:
Expand Down Expand Up @@ -87,6 +90,9 @@ func _physics_process(delta: float) -> void:
self.velocity.y = self.jump_velocity
self.velocity.x = -400 if self.wizard_sprite.flip_h else 400
self.walls -= 1
elif self.jump == true:
self.velocity.y = self.jump_velocity * 1.2
self.jump = false
elif (
Input.is_action_just_released("jump")
and (not self.is_on_floor() and not self.velocity.y > 0)
Expand All @@ -95,6 +101,9 @@ func _physics_process(delta: float) -> void:

if self.is_on_floor():
self.walls = self.max_walls
self.jump = false
if self.is_on_wall_only():
self.jump = false

var direction := Input.get_axis("left", "right")
if direction:
Expand Down Expand Up @@ -158,3 +167,5 @@ func _on_quick_math_ball_teleported(location: Vector2) -> void:
self.position = location
self.walls = self.max_walls
self.velocity.y = 0
await get_tree().create_timer(0.1).timeout
self.jump = true
3 changes: 3 additions & 0 deletions game/characters/wizard/wizard.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ polygon = PackedVector2Array(2, 23, -8, 23, -10, 20, -14, -1, -8, -13, 5, -24, 1
unique_name_in_owner = true
scale = Vector2(0.07, 0.07)
texture = ExtResource("2_nqjmu")

[node name="Timer" type="Timer" parent="."]
wait_time = 0.25
72 changes: 10 additions & 62 deletions game/levels/1.tscn

Large diffs are not rendered by default.

93 changes: 93 additions & 0 deletions game/levels/2.tscn

Large diffs are not rendered by default.

32 changes: 18 additions & 14 deletions game/levels/tutorial.tscn

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions game/scenes/portal/portal.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ extends Area2D


func _on_body_entered(_body: Node2D) -> void:
self.get_tree().call_deferred(
"change_scene_to_file",
self.get_tree().change_scene_to_file.call_deferred(
(
"res://game/levels/tutorial.tscn"
if self.level == 0
Expand Down
9 changes: 8 additions & 1 deletion game/spawnables/quick_math/quick_math.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,24 @@ extends StaticBody2D
@export var question: String = "N/A"

@onready var quick_math_label: Label = %QuickMathLabel
@onready var quick_math_sprite: Sprite2D = %QuickMathSprite
@onready var teleport_position: Marker2D = %TeleportPosition

@onready var wizard: Wizard = self.get_parent().get_node("Wizard")


# Called when the node enters the scene tree for the first time.
func _ready() -> void:
self.quick_math_label.text = question
self.quick_math_label.text = ""
quick_math_sprite.texture = load("res://assets/sprites/number_balls/%s.png" % self.answer)


func teleport(value: int) -> void:
if value == answer:
# gdlint:ignore = private-method-call
wizard._on_quick_math_ball_teleported(self.teleport_position.global_position)
wizard.walls = wizard.max_walls
wizard.jump = true
wizard.mana -= 1
else:
wizard.mana -= 2
10 changes: 5 additions & 5 deletions game/spawnables/quick_math/quick_math.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ question = "1+1"

[node name="QuickMathSprite" type="Sprite2D" parent="."]
unique_name_in_owner = true
scale = Vector2(0.045779, 0.045779)
texture = ExtResource("2_me8m8")

[node name="QuickMathLabel" type="Label" parent="QuickMathSprite"]
Expand All @@ -30,10 +29,11 @@ horizontal_alignment = 1
vertical_alignment = 1
metadata/_edit_use_anchors_ = true

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_q36na")

[node name="TeleportPosition" type="Marker2D" parent="."]
unique_name_in_owner = true
position = Vector2(0, -5.66245)
position = Vector2(0.249148, -62.8954)
gizmo_extents = 3.0

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
scale = Vector2(22, 22)
shape = SubResource("CircleShape2D_q36na")
10 changes: 5 additions & 5 deletions game/spawnables/rock/rock.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[ext_resource type="Texture2D" uid="uid://cwjd2021rogmh" path="res://assets/sprites/rock.png" id="2_dtg15"]

[sub_resource type="LabelSettings" id="LabelSettings_sbncs"]
font_size = 80
font_size = 70

[node name="Rock" type="StaticBody2D"]
collision_layer = 3
Expand All @@ -21,10 +21,10 @@ texture = ExtResource("2_dtg15")

[node name="MathLabel" type="Label" parent="RockSprite"]
unique_name_in_owner = true
offset_left = -116.856
offset_top = -70.1133
offset_right = 124.144
offset_bottom = 69.8867
offset_left = -141.0
offset_top = -94.0
offset_right = 165.0
offset_bottom = 94.0
theme_override_font_sizes/font_size = 100
text = "PLAY"
label_settings = SubResource("LabelSettings_sbncs")
Expand Down
43 changes: 43 additions & 0 deletions game/spawnables/tree/tree.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[gd_scene load_steps=4 format=3 uid="uid://dbbhtn64lle11"]

[ext_resource type="Script" path="res://game/spawnables/rock/rock.gd" id="1_iipfa"]
[ext_resource type="Texture2D" uid="uid://cb1tmbd381e4h" path="res://assets/sprites/tree.png" id="2_yq05d"]

[sub_resource type="LabelSettings" id="LabelSettings_sbncs"]
line_spacing = 0.0
font_size = 50

[node name="Tree" type="StaticBody2D"]
scale = Vector2(1, 1.00363)
collision_layer = 3
script = ExtResource("1_iipfa")

[node name="CollisionPolygon" type="CollisionPolygon2D" parent="."]
position = Vector2(0, -0.5)
scale = Vector2(5.67535, 5.67535)
polygon = PackedVector2Array(4, -14.5, 10, -11.5, 14, -7.5, 15, -2.5, 14, 0.5, 10, 0.5, 7, 1.5, 5, 1.5, 4, 0.5, 1, 3.5, 2, 14.5, 2, 15.5, -3, 15.5, -1, 13.5, -1, 2.5, -4, 0.5, -6, -0.5, -8, 1.5, -14, -1.5, -16, -4.5, -10, -12.5, -4, -12.5, -3, -11.5)

[node name="TreeSprite" type="Sprite2D" parent="."]
unique_name_in_owner = true
position = Vector2(0.499999, 2.98023e-06)
scale = Vector2(0.818267, 0.843082)
texture = ExtResource("2_yq05d")

[node name="MathLabel" type="Label" parent="TreeSprite"]
unique_name_in_owner = true
anchors_preset = -1
anchor_left = 0.3
anchor_top = 0.469
anchor_right = 0.71
anchor_bottom = 0.89
offset_left = -113.606
offset_top = -67.256
offset_right = -108.906
offset_bottom = -63.455
theme_override_font_sizes/font_size = 50
text = "L"
label_settings = SubResource("LabelSettings_sbncs")
horizontal_alignment = 1
vertical_alignment = 1
autowrap_mode = 3
metadata/_edit_use_anchors_ = true
1 change: 0 additions & 1 deletion project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ gdscript/warnings/return_value_discarded=1

window/size/viewport_width=1280
window/size/viewport_height=800
window/size/borderless=true
window/stretch/aspect="ignore"

[dotnet]
Expand Down
Loading