diff --git a/Player/Player.tscn b/Player/Player.tscn index 9b371ef..7f4166e 100644 --- a/Player/Player.tscn +++ b/Player/Player.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=16 format=2] -[ext_resource path="res://script/player.gd" type="Script" id=1] +[ext_resource path="res://Player/player.gd" type="Script" id=1] [ext_resource path="res://ui/PlayerStats.tscn" type="PackedScene" id=2] [ext_resource path="res://meta/BoundedCamera.tscn" type="PackedScene" id=3] [ext_resource path="res://script/PlayerStateMachine.gd" type="Script" id=4] @@ -11,7 +11,7 @@ [ext_resource path="res://Sound Effects/Enemy Hit.wav" type="AudioStream" id=9] [sub_resource type="OccluderPolygon2D" id=1] -polygon = PoolVector2Array( -7, 0, -7, -2, -6, -2, -6, -3, -5, -3, -5, -5, -6, -5, -6, -10, -7, -10, -7, -12, -6, -12, -6, -19, -4, -19, -4, -18, -3, -18, -3, -17, 1, -17, 1, -16, 3, -16, 3, -15, 4, -15, 4, -14, 5, -14, 5, -13, 6, -13, 6, -12, 7, -12, 7, -10, 6, -10, 6, -9, 5, -9, 5, -8, 6, -8, 6, -4, 5, -4, 5, 0, -7, 0 ) +polygon = PoolVector2Array( -5, 4, -5, -3, -7, -3, -7, -5, -6, -5, -6, -8, -7, -8, -7, -9, -7, -9, -6, -9, -6, -12, -5, -12, -5, -13, -4, -13, -4, -14, 5, -14, 5, -13, 6, -13, 6, -12, 7, -12, 7, -11, 8, -11, 8, -9, 7, -9, 7, -9, 7, -8, 6, -8, 6, -10, 5, -10, 5, -5, 6, -5, 6, -3, 5, -3, 5, 3, 4, 3, 4, 4, 1, 4, 1, 3, -2, 3, -2, 4, -5, 4 ) [sub_resource type="CapsuleShape2D" id=2] radius = 6.0 @@ -92,7 +92,7 @@ script = ExtResource( 1 ) [node name="Stats" parent="." instance=ExtResource( 2 )] [node name="Camera" parent="." instance=ExtResource( 3 )] -position = Vector2( 0, -7 ) +position = Vector2( 0, -9 ) current = true smoothing_enabled = true drag_margin_left = 0.0 @@ -150,7 +150,7 @@ polygon = PoolVector2Array( -6, -12, -6, -5, -7, -5, -7, -3, -6, -3, -6, 2, -5, [node name="ParallaxBackground" type="ParallaxBackground" parent="."] [node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"] -motion_mirroring = Vector2( 32, 32 ) +motion_mirroring = Vector2( 64, 64 ) [node name="Paralax Dungeon" type="Sprite" parent="ParallaxBackground/ParallaxLayer"] position = Vector2( 192, 90 ) diff --git a/ui/PlayerStats.gd b/Player/PlayerStats.gd similarity index 100% rename from ui/PlayerStats.gd rename to Player/PlayerStats.gd diff --git a/script/player.gd b/Player/player.gd similarity index 98% rename from script/player.gd rename to Player/player.gd index 27cd9e4..bc82dca 100644 --- a/script/player.gd +++ b/Player/player.gd @@ -16,7 +16,7 @@ var min_jump_height = 0.6 * 16 var walljump_height = 2.25 * 16 var jump_duration = 0.35 var is_grounded -var touching_wall = 0 +var touching_wall = 0 onready var Spr: Sprite = $Sprite onready var Occluder: LightOccluder2D = $Sprite/LightOccluder2D @@ -28,6 +28,7 @@ onready var WandPosition: Node2D = $WandPosition onready var ProjectileSpawn: Node2D = $HoldPosition/ProjectileSpawn onready var Inventory: CanvasLayer = $Inventory onready var Stats = $Stats +onready var Cam: Camera2D = $Camera onready var HitSound: AudioStreamPlayer2D = $"Enemy Hit" @@ -73,6 +74,8 @@ func _physics_process(delta): if get_health() <= 0: get_tree().change_scene("res://Title/Death Screen'.tscn") + + func handle_move_input(): input_direction = int(Input.is_action_pressed("right")) - int(Input.is_action_pressed("left")) velocity.x = lerp(velocity.x, speed * input_direction, get_movement_weight()) diff --git a/art/Ladder.png b/art/Ladder.png new file mode 100644 index 0000000..6724f25 Binary files /dev/null and b/art/Ladder.png differ diff --git a/levels/test.tscn b/levels/test.tscn index e99fcea..e9bba81 100644 --- a/levels/test.tscn +++ b/levels/test.tscn @@ -2,18 +2,15 @@ [ext_resource path="res://Player/Player.tscn" type="PackedScene" id=1] [ext_resource path="res://meta/DungeonTilemap.tscn" type="PackedScene" id=2] -[ext_resource path="res://ai/Scenes/ogre.tscn" type="PackedScene" id=3] +[ext_resource path="res://Items/Wand Pickups/ChargeWandPickup.tscn" type="PackedScene" id=4] [node name="Node2D" type="Node2D"] [node name="TileMap" parent="." instance=ExtResource( 2 )] -tile_data = PoolIntArray( 65536, 0, 8, 65537, 0, 10, 65538, 0, 10, 65539, 0, 10, 65540, 0, 10, 65541, 0, 10, 65542, 0, 10, 65543, 0, 10, 65544, 0, 10, 65545, 0, 10, 65546, 0, 10, 65547, 0, 10, 65548, 0, 10, 65549, 0, 10, 65550, 0, 10, 65551, 0, 10, 65552, 0, 10, 65553, 0, 10, 65554, 0, 10, 65555, 0, 10, 65556, 0, 10, 65557, 0, 10, 65558, 0, 10, 65559, 0, 10, 65560, 0, 10, 65561, 0, 10, 65562, 0, 10, 65563, 0, 10, 65564, 0, 10, 65565, 0, 10, 65566, 0, 10, 65567, 0, 10, 65568, 0, 10, 65569, 0, 11, 131072, 0, 65544, 131073, 0, 131078, 131074, 0, 196617, 131075, 0, 196617, 131076, 0, 196617, 131077, 0, 196617, 131078, 0, 196617, 131079, 0, 196617, 131080, 0, 196617, 131081, 0, 196617, 131082, 0, 196617, 131083, 0, 196617, 131084, 0, 196617, 131085, 0, 196617, 131086, 0, 196617, 131087, 0, 196617, 131088, 0, 196617, 131089, 0, 196617, 131090, 0, 196617, 131091, 0, 196617, 131092, 0, 196617, 131093, 0, 196617, 131094, 0, 196617, 131095, 0, 196617, 131096, 0, 196617, 131097, 0, 196617, 131098, 0, 196617, 131099, 0, 196617, 131100, 0, 196617, 131101, 0, 196617, 131102, 0, 196617, 131103, 0, 196617, 131104, 0, 196617, 131105, 0, 196619, 196608, 0, 65544, 196609, 0, 131083, 262144, 0, 65544, 262145, 0, 131083, 327680, 0, 65544, 327681, 0, 131083, 393216, 0, 65544, 393217, 0, 131083, 458752, 0, 65544, 458753, 0, 131083, 524288, 0, 65544, 524289, 0, 131083, 589824, 0, 65544, 589825, 0, 131083, 589838, 0, 0, 589858, 0, 8, 589859, 0, 11, 655360, 0, 65544, 655361, 0, 131083, 655374, 0, 65540, 655375, 0, 11, 655394, 0, 65544, 655395, 0, 131083, 720896, 0, 65544, 720897, 0, 65542, 720898, 0, 10, 720899, 0, 10, 720900, 0, 10, 720901, 0, 10, 720902, 0, 10, 720903, 0, 10, 720904, 0, 10, 720905, 0, 10, 720906, 0, 10, 720907, 0, 10, 720908, 0, 10, 720909, 0, 10, 720910, 0, 65541, 720911, 0, 65542, 720912, 0, 10, 720913, 0, 10, 720914, 0, 10, 720915, 0, 10, 720916, 0, 10, 720917, 0, 10, 720918, 0, 10, 720919, 0, 10, 720920, 0, 10, 720921, 0, 10, 720922, 0, 10, 720923, 0, 10, 720924, 0, 10, 720925, 0, 10, 720926, 0, 10, 720927, 0, 10, 720928, 0, 10, 720929, 0, 10, 720930, 0, 65541, 720931, 0, 131083, 786432, 0, 196616, 786433, 0, 196617, 786434, 0, 196617, 786435, 0, 196617, 786436, 0, 196617, 786437, 0, 196617, 786438, 0, 196617, 786439, 0, 196617, 786440, 0, 196617, 786441, 0, 196617, 786442, 0, 196617, 786443, 0, 196617, 786444, 0, 196617, 786445, 0, 196617, 786446, 0, 196617, 786447, 0, 196617, 786448, 0, 196617, 786449, 0, 196617, 786450, 0, 196617, 786451, 0, 196617, 786452, 0, 196617, 786453, 0, 196617, 786454, 0, 196617, 786455, 0, 196617, 786456, 0, 196617, 786457, 0, 196617, 786458, 0, 196617, 786459, 0, 196617, 786460, 0, 196617, 786461, 0, 196617, 786462, 0, 196617, 786463, 0, 196617, 786464, 0, 196617, 786465, 0, 196617, 786466, 0, 196617, 786467, 0, 196619 ) +tile_data = PoolIntArray( 65536, 0, 8, 65537, 0, 10, 65538, 0, 10, 65539, 0, 10, 65540, 0, 10, 65541, 0, 10, 65542, 0, 10, 65543, 0, 10, 65544, 0, 10, 65545, 0, 10, 65546, 0, 10, 65547, 0, 10, 65548, 0, 10, 65549, 0, 10, 65550, 0, 10, 65551, 0, 10, 65552, 0, 10, 65553, 0, 10, 65554, 0, 10, 65555, 0, 10, 65556, 0, 10, 65557, 0, 10, 65558, 0, 10, 65559, 0, 10, 65560, 0, 10, 65561, 0, 10, 65562, 0, 10, 65563, 0, 10, 65564, 0, 10, 65565, 0, 10, 65566, 0, 10, 65567, 0, 10, 65568, 0, 10, 65569, 0, 10, 65570, 0, 10, 65571, 0, 11, 131072, 0, 65544, 131073, 0, 131078, 131074, 0, 196617, 131075, 0, 196617, 131076, 0, 196617, 131077, 0, 196617, 131078, 0, 196617, 131079, 0, 196617, 131080, 0, 196617, 131081, 0, 196617, 131082, 0, 196617, 131083, 0, 196617, 131084, 0, 196617, 131085, 0, 196617, 131086, 0, 196617, 131087, 0, 196617, 131088, 0, 196617, 131089, 0, 196617, 131090, 0, 196617, 131091, 0, 196617, 131092, 0, 196617, 131093, 0, 196617, 131094, 0, 196617, 131095, 0, 196617, 131096, 0, 196617, 131097, 0, 196617, 131098, 0, 196617, 131099, 0, 196617, 131100, 0, 196617, 131101, 0, 196617, 131102, 0, 196617, 131103, 0, 196617, 131104, 0, 196617, 131105, 0, 196617, 131106, 0, 131077, 131107, 0, 131083, 196608, 0, 65544, 196609, 0, 131083, 196642, 0, 65544, 196643, 0, 131083, 262144, 0, 65544, 262145, 0, 131083, 262178, 0, 65544, 262179, 0, 131083, 327680, 0, 65544, 327681, 0, 131083, 327714, 0, 65544, 327715, 0, 131083, 393216, 0, 65544, 393217, 0, 131083, 393250, 0, 65544, 393251, 0, 131083, 458752, 0, 65544, 458753, 0, 131083, 458786, 0, 65544, 458787, 0, 131083, 524288, 0, 65544, 524289, 0, 131083, 524322, 0, 65544, 524323, 0, 131083, 589824, 0, 65544, 589825, 0, 131083, 589838, 0, 0, 589858, 0, 65544, 589859, 0, 131083, 655360, 0, 65544, 655361, 0, 131083, 655374, 0, 65540, 655375, 0, 11, 655394, 0, 65544, 655395, 0, 131083, 720896, 0, 65544, 720897, 0, 65542, 720898, 0, 10, 720899, 0, 10, 720900, 0, 10, 720901, 0, 10, 720902, 0, 10, 720903, 0, 10, 720904, 0, 10, 720905, 0, 10, 720906, 0, 10, 720907, 0, 10, 720908, 0, 10, 720909, 0, 10, 720910, 0, 65541, 720911, 0, 65542, 720912, 0, 10, 720913, 0, 10, 720914, 0, 10, 720915, 0, 10, 720916, 0, 10, 720917, 0, 10, 720918, 0, 10, 720919, 0, 10, 720920, 0, 10, 720921, 0, 10, 720922, 0, 10, 720923, 0, 10, 720924, 0, 11, 720930, 0, 65544, 720931, 0, 131083, 786432, 0, 196616, 786433, 0, 196617, 786434, 0, 196617, 786435, 0, 196617, 786436, 0, 196617, 786437, 0, 196617, 786438, 0, 196617, 786439, 0, 196617, 786440, 0, 196617, 786441, 0, 196617, 786442, 0, 196617, 786443, 0, 196617, 786444, 0, 196617, 786445, 0, 196617, 786446, 0, 196617, 786447, 0, 196617, 786448, 0, 196617, 786449, 0, 196617, 786450, 0, 196617, 786451, 0, 196617, 786452, 0, 196617, 786453, 0, 196617, 786454, 0, 196617, 786455, 0, 196617, 786456, 0, 196617, 786457, 0, 196617, 786458, 0, 196617, 786459, 0, 131077, 786460, 0, 131083, 786466, 0, 65544, 786467, 0, 131083, 851995, 0, 65544, 851996, 0, 131083, 852002, 0, 65544, 852003, 0, 131083, 917531, 0, 65544, 917532, 0, 131083, 917538, 0, 65544, 917539, 0, 131083, 983067, 0, 65544, 983068, 0, 131083, 983074, 0, 65544, 983075, 0, 131083, 1048603, 0, 65544, 1048604, 0, 131083, 1048610, 0, 65544, 1048611, 0, 131083, 1114139, 0, 196616, 1114140, 0, 196614, 1114141, 0, 196610, 1114142, 0, 196610, 1114143, 0, 196610, 1114144, 0, 196610, 1114145, 0, 196610, 1114146, 0, 196613, 1114147, 0, 196619 ) [node name="Player" parent="." instance=ExtResource( 1 )] -position = Vector2( 60, 176 ) +position = Vector2( 67, 169 ) -[node name="Ogre" parent="." instance=ExtResource( 3 )] -position = Vector2( 286, 170 ) - -[node name="Ogre2" parent="." instance=ExtResource( 3 )] -position = Vector2( 347, 159 ) +[node name="ChargeWandPickup" parent="." instance=ExtResource( 4 )] +position = Vector2( 59, 162 ) diff --git a/magic/Wands/ChargedWand.gd b/magic/Wands/ChargedWand.gd index cfeb33a..59c7243 100644 --- a/magic/Wands/ChargedWand.gd +++ b/magic/Wands/ChargedWand.gd @@ -14,15 +14,14 @@ func fire(p): var temp = p.instance() get_tree().current_scene.add_child(temp) var energy = temp.energy_cost - print(energy) temp.queue_free() return energy * 2 func _process(delta): - scale = Vector2(charge_level / 2 + 1, charge_level / 2 + 1) + scale = Vector2(charge_level / 2.0 + 1.0, charge_level / 2.0 + 1.0) func _on_ChargeTimer_timeout(): - charge_level = clamp(charge_level + 0.5, 0, max_charge) + charge_level = clamp(charge_level + 1, 0, max_charge) func _input(event): if event.is_action_released("shoot"): @@ -30,6 +29,7 @@ func _input(event): if charge_level <= 0: charge_level = 0 return + print(charge_level) var temp = projectile.instance() get_tree().current_scene.add_child(temp) temp.global_transform = $ProjectileSpawn.global_transform diff --git a/meta/CameraArea.gd b/meta/CameraArea.gd new file mode 100644 index 0000000..4163b61 --- /dev/null +++ b/meta/CameraArea.gd @@ -0,0 +1,26 @@ +extends Area2D + +var x +var y +var w +var h + +export var limit_x = false +export var limit_y = true + +onready var Collision = $CollisionShape2D + +func _ready(): + x = Collision.global_position.x + y = Collision.global_position.y + w = Collision.shape.extents.x + h = Collision.shape.extents.y + x -= w + y -= h + w *= 2 + h *= 2 + +func _physics_process(delta): + for b in get_overlapping_bodies(): + if b.has_method("get_type") and b.get_type() == "player": + b.Cam.set_custom_limits(x, y, w, h, true, true) diff --git a/meta/CameraArea.tscn b/meta/CameraArea.tscn new file mode 100644 index 0000000..c196003 --- /dev/null +++ b/meta/CameraArea.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://meta/CameraArea.gd" type="Script" id=1] + +[node name="CameraArea" type="Area2D"] +script = ExtResource( 1 ) diff --git a/script/player camera.gd b/script/player camera.gd index 83b5d4b..9ac37d6 100644 --- a/script/player camera.gd +++ b/script/player camera.gd @@ -26,6 +26,14 @@ func set_limits(): limit_top = (map_limits.position.y + 0.5) * map_cellsize.y limit_bottom = (map_limits.end.y - 0.5) * map_cellsize.y +func set_custom_limits(x, y, w, h, dox = true, doy = true): + print(y + h) + if dox: + limit_left = x + 0.5 + limit_right = w - 0.5 + if doy: + limit_top = y + 0.5 + limit_right = h - 0.5 func _process(delta): if facing != 0: diff --git a/ui/PlayerStats.tscn b/ui/PlayerStats.tscn index 8d0da9d..1ade1cb 100644 --- a/ui/PlayerStats.tscn +++ b/ui/PlayerStats.tscn @@ -1,11 +1,12 @@ [gd_scene load_steps=6 format=2] -[ext_resource path="res://ui/PlayerStats.gd" type="Script" id=1] +[ext_resource path="res://Player/PlayerStats.gd" type="Script" id=1] [ext_resource path="res://ui/Player UI Frame 2.png" type="Texture" id=2] [ext_resource path="res://ui/Hearts.png" type="Texture" id=3] [ext_resource path="res://ui/Energy.png" type="Texture" id=4] [ext_resource path="res://ui/Energy Burnout.png" type="Texture" id=5] + [node name="Stats" type="CanvasLayer"] script = ExtResource( 1 )