From 8d22203f66f565cf2140b439a3fa1b0b468505c0 Mon Sep 17 00:00:00 2001 From: Logan Date: Fri, 17 Jul 2020 13:37:48 -0500 Subject: [PATCH] Wand follows player --- Title/Tilte.tscn | 20 +++++++++++-- characters/Player.tscn | 39 +++++++++++++++++++----- levels/Tilte.tscn | 41 ++++++++++++++++++++++++++ levels/test.tscn | 8 ++--- magic/projectiles/WhiteProjectile.tscn | 3 +- meta/DungeonTilemap.tres | 5 ---- meta/DungeonTilemap.tscn | 2 ++ project.godot | 5 +++- script/player.gd | 5 +++- 9 files changed, 103 insertions(+), 25 deletions(-) create mode 100644 levels/Tilte.tscn diff --git a/Title/Tilte.tscn b/Title/Tilte.tscn index 387afce..fa0d9e7 100644 --- a/Title/Tilte.tscn +++ b/Title/Tilte.tscn @@ -1,14 +1,23 @@ [gd_scene load_steps=7 format=2] +<<<<<<< Updated upstream:Title/Tilte.tscn [ext_resource path="res://Title/Quit 1.png" type="Texture" id=1] [ext_resource path="res://Title/Wizard Background.png" type="Texture" id=2] [ext_resource path="res://Title/Quit 2.png" type="Texture" id=3] [ext_resource path="res://Title/Play 1.png" type="Texture" id=4] [ext_resource path="res://Title/Play 2.png" type="Texture" id=5] [ext_resource path="res://Title/Tilte.gd" type="Script" id=6] +======= +[ext_resource path="res://levels/Tilte.gd" type="Script" id=1] +[ext_resource path="res://levels/Wizard Background.png" type="Texture" id=2] +[ext_resource path="res://levels/Play 1.png" type="Texture" id=3] +[ext_resource path="res://levels/Play 2.png" type="Texture" id=4] +[ext_resource path="res://levels/Quit 1.png" type="Texture" id=5] +[ext_resource path="res://levels/Quit 2.png" type="Texture" id=6] +>>>>>>> Stashed changes:levels/Tilte.tscn [node name="Title" type="Node"] -script = ExtResource( 6 ) +script = ExtResource( 1 ) [node name="Sprite" type="Sprite" parent="."] texture = ExtResource( 2 ) @@ -19,8 +28,8 @@ margin_left = 0.989594 margin_top = 73.7678 margin_right = 120.99 margin_bottom = 124.768 -texture_normal = ExtResource( 4 ) -texture_hover = ExtResource( 5 ) +texture_normal = ExtResource( 3 ) +texture_hover = ExtResource( 4 ) expand = true __meta__ = { "_edit_use_anchors_": false @@ -31,8 +40,13 @@ margin_left = 1.0 margin_top = 128.0 margin_right = 125.0 margin_bottom = 179.0 +<<<<<<< Updated upstream:Title/Tilte.tscn texture_normal = ExtResource( 1 ) texture_hover = ExtResource( 3 ) +======= +texture_normal = ExtResource( 5 ) +texture_hover = ExtResource( 6 ) +>>>>>>> Stashed changes:levels/Tilte.tscn expand = true __meta__ = { "_edit_use_anchors_": false diff --git a/characters/Player.tscn b/characters/Player.tscn index 2f9ef45..90d8cbd 100644 --- a/characters/Player.tscn +++ b/characters/Player.tscn @@ -1,15 +1,17 @@ -[gd_scene load_steps=10 format=2] +[gd_scene load_steps=11 format=2] [ext_resource path="res://script/player.gd" type="Script" id=1] [ext_resource path="res://meta/BoundedCamera.tscn" type="PackedScene" id=2] [ext_resource path="res://script/PlayerStateMachine.gd" type="Script" id=3] -[ext_resource path="res://art/WizardM.png" type="Texture" id=4] +[ext_resource path="res://art/Wand.png" type="Texture" id=4] +[ext_resource path="res://art/WizardM.png" type="Texture" id=5] [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 ) -[sub_resource type="RectangleShape2D" id=2] -extents = Vector2( 6, 6 ) +[sub_resource type="CapsuleShape2D" id=6] +radius = 6.0 +height = 2.0 [sub_resource type="Animation" id=3] resource_name = "Idle" @@ -61,6 +63,7 @@ tracks/0/keys = { } [node name="Player" type="KinematicBody2D"] +collision_mask = 2 script = ExtResource( 1 ) [node name="Node2D" parent="." instance=ExtResource( 2 )] @@ -74,9 +77,20 @@ drag_margin_bottom = 0.0 [node name="PlayerStateMachine" type="Node" parent="."] script = ExtResource( 3 ) +[node name="HoldPosition" type="Position2D" parent="."] +position = Vector2( 0, -6 ) +rotation = 1.57079 + +[node name="Wand" type="Sprite" parent="HoldPosition"] +position = Vector2( 2.86102e-005, -13 ) +texture = ExtResource( 4 ) + +[node name="ProjectileSpawn" type="Position2D" parent="HoldPosition/Wand"] +position = Vector2( 1.52588e-005, -7 ) + [node name="Sprite" type="Sprite" parent="."] position = Vector2( 0, -12 ) -texture = ExtResource( 4 ) +texture = ExtResource( 5 ) vframes = 3 hframes = 4 @@ -85,9 +99,10 @@ visible = false position = Vector2( 0, 12 ) occluder = SubResource( 1 ) -[node name="CollisionShape2D" type="CollisionShape2D" parent="."] -position = Vector2( 0, -6 ) -shape = SubResource( 2 ) +[node name="WorldCollision" type="CollisionShape2D" parent="."] +visible = false +position = Vector2( 0, -7 ) +shape = SubResource( 6 ) [node name="AnimationPlayer" type="AnimationPlayer" parent="."] anims/Idle = SubResource( 3 ) @@ -97,4 +112,12 @@ anims/Running = SubResource( 5 ) [node name="CoyoteTimer" type="Timer" parent="."] wait_time = 0.1 one_shot = true + +[node name="Hitbox" type="Area2D" parent="."] +visible = false +position = Vector2( 0, -7 ) + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hitbox"] +visible = false +polygon = PoolVector2Array( -6, -12, -6, -5, -7, -5, -7, -3, -6, -3, -6, 2, -5, 2, -5, 4, -6, 4, -6, 5, -7, 5, -7, 7, 5, 7, 5, 3, 6, 3, 6, -1, 5, -1, 5, -2, 6, -2, 6, -3, 7, -3, 7, -5, 6, -5, 6, -6, 5, -6, 5, -7, 4, -7, 4, -8, 3, -8, 3, -9, 1, -9, 1, -10, -3, -10, -3, -11, -4, -11, -4, -12, -6, -12 ) [connection signal="grounded_updated" from="." to="Node2D" method="_on_grounded_updated"] diff --git a/levels/Tilte.tscn b/levels/Tilte.tscn new file mode 100644 index 0000000..3468b81 --- /dev/null +++ b/levels/Tilte.tscn @@ -0,0 +1,41 @@ +[gd_scene load_steps=7 format=2] + +[ext_resource path="res://levels/Tilte.gd" type="Script" id=1] +[ext_resource path="res://levels/Wizard Background.png" type="Texture" id=2] +[ext_resource path="res://levels/Play 1.png" type="Texture" id=3] +[ext_resource path="res://levels/Play 2.png" type="Texture" id=4] +[ext_resource path="res://levels/Quit 1.png" type="Texture" id=5] +[ext_resource path="res://levels/Quit 2.png" type="Texture" id=6] + +[node name="Title" type="Node"] +script = ExtResource( 1 ) + +[node name="Sprite" type="Sprite" parent="."] +texture = ExtResource( 2 ) +centered = false + +[node name="TextureButton" type="TextureButton" parent="."] +margin_left = 0.989594 +margin_top = 73.7678 +margin_right = 120.99 +margin_bottom = 124.768 +texture_normal = ExtResource( 3 ) +texture_hover = ExtResource( 4 ) +expand = true +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="TextureButton2" type="TextureButton" parent="."] +margin_left = 1.0 +margin_top = 128.0 +margin_right = 125.0 +margin_bottom = 179.0 +texture_normal = ExtResource( 5 ) +texture_hover = ExtResource( 6 ) +expand = true +__meta__ = { +"_edit_use_anchors_": false +} +[connection signal="pressed" from="TextureButton" to="." method="_on_TextureButton_pressed"] +[connection signal="pressed" from="TextureButton2" to="." method="_on_TextureButton2_pressed"] diff --git a/levels/test.tscn b/levels/test.tscn index 9997a31..3c79e74 100644 --- a/levels/test.tscn +++ b/levels/test.tscn @@ -1,8 +1,7 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=3 format=2] [ext_resource path="res://characters/Player.tscn" type="PackedScene" id=1] [ext_resource path="res://meta/DungeonTilemap.tscn" type="PackedScene" id=2] -[ext_resource path="res://magic/projectiles/WhiteProjectile.tscn" type="PackedScene" id=3] [node name="Node2D" type="Node2D"] position = Vector2( -14, 0 ) @@ -11,7 +10,4 @@ position = Vector2( -14, 0 ) position = Vector2( 169, 166 ) [node name="TileMap" parent="." instance=ExtResource( 2 )] -tile_data = PoolIntArray( 0, 0, 8, 1, 0, 10, 2, 0, 10, 3, 0, 10, 4, 0, 10, 5, 0, 10, 6, 0, 10, 7, 0, 10, 8, 0, 10, 9, 0, 10, 10, 0, 10, 11, 0, 10, 12, 0, 10, 13, 0, 10, 14, 0, 10, 15, 0, 10, 16, 0, 10, 17, 0, 10, 18, 0, 10, 19, 0, 10, 20, 0, 11, 65536, 0, 65544, 65537, 0, 131078, 65538, 0, 196617, 65539, 0, 196617, 65540, 0, 196617, 65541, 0, 196617, 65542, 0, 196617, 65543, 0, 196617, 65544, 0, 196617, 65545, 0, 196617, 65546, 0, 196617, 65547, 0, 196617, 65548, 0, 196617, 65549, 0, 196617, 65550, 0, 196617, 65551, 0, 196617, 65552, 0, 196617, 65553, 0, 196617, 65554, 0, 196617, 65555, 0, 131077, 65556, 0, 131083, 131072, 0, 65544, 131073, 0, 131083, 131091, 0, 65544, 131092, 0, 131083, 196608, 0, 65544, 196609, 0, 131083, 196627, 0, 65544, 196628, 0, 131083, 262144, 0, 65544, 262145, 0, 131083, 262163, 0, 65544, 262164, 0, 131083, 327680, 0, 65544, 327681, 0, 131083, 327699, 0, 65544, 327700, 0, 131083, 393216, 0, 65544, 393217, 0, 131083, 393235, 0, 65544, 393236, 0, 131083, 458752, 0, 65544, 458753, 0, 131083, 458771, 0, 65544, 458772, 0, 131083, 524288, 0, 65544, 524289, 0, 131083, 524307, 0, 65544, 524308, 0, 131083, 589824, 0, 65544, 589825, 0, 131083, 589830, 0, 0, 589843, 0, 65544, 589844, 0, 131083, 655360, 0, 65544, 655361, 0, 131083, 655366, 0, 65536, 655379, 0, 65544, 655380, 0, 131083, 720896, 0, 65544, 720897, 0, 65542, 720898, 0, 10, 720899, 0, 10, 720900, 0, 10, 720901, 0, 10, 720902, 0, 9, 720903, 0, 10, 720904, 0, 10, 720905, 0, 10, 720906, 0, 10, 720907, 0, 10, 720908, 0, 10, 720909, 0, 10, 720910, 0, 10, 720911, 0, 10, 720912, 0, 10, 720913, 0, 10, 720914, 0, 10, 720915, 0, 65541, 720916, 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, 196619 ) - -[node name="WhiteProjectile" parent="." instance=ExtResource( 3 )] -position = Vector2( 195, 158 ) +tile_data = PoolIntArray( 0, 0, 8, 1, 0, 10, 2, 0, 10, 3, 0, 10, 4, 0, 10, 5, 0, 10, 6, 0, 10, 7, 0, 10, 8, 0, 10, 9, 0, 10, 10, 0, 10, 11, 0, 10, 12, 0, 10, 13, 0, 10, 14, 0, 10, 15, 0, 10, 16, 0, 10, 17, 0, 10, 18, 0, 10, 19, 0, 10, 20, 0, 11, 65536, 0, 65544, 65537, 0, 131078, 65538, 0, 196617, 65539, 0, 196617, 65540, 0, 196617, 65541, 0, 196617, 65542, 0, 196617, 65543, 0, 196617, 65544, 0, 196617, 65545, 0, 196617, 65546, 0, 196617, 65547, 0, 196617, 65548, 0, 196617, 65549, 0, 196617, 65550, 0, 196617, 65551, 0, 196617, 65552, 0, 196617, 65553, 0, 196617, 65554, 0, 196617, 65555, 0, 131077, 65556, 0, 131083, 131072, 0, 65544, 131073, 0, 131083, 131091, 0, 65544, 131092, 0, 131083, 196608, 0, 65544, 196609, 0, 131083, 196627, 0, 65544, 196628, 0, 131083, 262144, 0, 65544, 262145, 0, 131083, 262163, 0, 65544, 262164, 0, 131083, 327680, 0, 65544, 327681, 0, 131083, 327699, 0, 65544, 327700, 0, 131083, 393216, 0, 65544, 393217, 0, 131083, 393235, 0, 65544, 393236, 0, 131083, 458752, 0, 65544, 458753, 0, 131083, 458771, 0, 65544, 458772, 0, 131083, 524288, 0, 65544, 524289, 0, 131083, 524307, 0, 65544, 524308, 0, 131083, 589824, 0, 65544, 589825, 0, 131083, 589843, 0, 65544, 589844, 0, 131083, 655360, 0, 65544, 655361, 0, 131083, 655379, 0, 65544, 655380, 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, 10, 720911, 0, 10, 720912, 0, 10, 720913, 0, 10, 720914, 0, 10, 720915, 0, 65541, 720916, 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, 196619 ) diff --git a/magic/projectiles/WhiteProjectile.tscn b/magic/projectiles/WhiteProjectile.tscn index 7601c60..f89b9a5 100644 --- a/magic/projectiles/WhiteProjectile.tscn +++ b/magic/projectiles/WhiteProjectile.tscn @@ -7,7 +7,8 @@ radius = 7.0 [node name="WhiteProjectile" type="KinematicBody2D"] -scale = Vector2( 0.5, 0.5 ) +collision_layer = 8 +collision_mask = 0 script = ExtResource( 1 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] diff --git a/meta/DungeonTilemap.tres b/meta/DungeonTilemap.tres index 3c172d8..c0e7ee5 100644 --- a/meta/DungeonTilemap.tres +++ b/meta/DungeonTilemap.tres @@ -302,11 +302,6 @@ points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) 0/autotile/z_index_map = [ ] 0/occluder_offset = Vector2( 0, 0 ) 0/navigation_offset = Vector2( 0, 0 ) -0/shape_offset = Vector2( 0, 0 ) -0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) -0/shape = SubResource( 48 ) -0/shape_one_way = false -0/shape_one_way_margin = 1.0 0/shapes = [ { "autotile_coord": Vector2( 0, 0 ), "one_way": false, diff --git a/meta/DungeonTilemap.tscn b/meta/DungeonTilemap.tscn index d38d75a..1ade854 100644 --- a/meta/DungeonTilemap.tscn +++ b/meta/DungeonTilemap.tscn @@ -7,5 +7,7 @@ ]] tile_set = ExtResource( 1 ) cell_size = Vector2( 16, 16 ) +collision_layer = 2 +collision_mask = 0 format = 1 tile_data = PoolIntArray( 0, 0, 8, 1, 0, 10, 2, 0, 10, 3, 0, 10, 4, 0, 10, 5, 0, 10, 6, 0, 10, 7, 0, 10, 8, 0, 10, 9, 0, 10, 10, 0, 10, 11, 0, 10, 12, 0, 10, 13, 0, 10, 14, 0, 10, 15, 0, 10, 16, 0, 10, 17, 0, 10, 18, 0, 10, 19, 0, 10, 20, 0, 11, 65536, 0, 65544, 65537, 0, 131078, 65538, 0, 196617, 65539, 0, 196617, 65540, 0, 196617, 65541, 0, 196617, 65542, 0, 196617, 65543, 0, 196617, 65544, 0, 196617, 65545, 0, 196617, 65546, 0, 196617, 65547, 0, 196617, 65548, 0, 196617, 65549, 0, 196617, 65550, 0, 196617, 65551, 0, 196617, 65552, 0, 196617, 65553, 0, 196617, 65554, 0, 196617, 65555, 0, 131077, 65556, 0, 131083, 131072, 0, 65544, 131073, 0, 131083, 131091, 0, 65544, 131092, 0, 131083, 196608, 0, 65544, 196609, 0, 131083, 196627, 0, 65544, 196628, 0, 131083, 262144, 0, 65544, 262145, 0, 131083, 262163, 0, 65544, 262164, 0, 131083, 327680, 0, 65544, 327681, 0, 131083, 327699, 0, 65544, 327700, 0, 131083, 393216, 0, 65544, 393217, 0, 131083, 393235, 0, 65544, 393236, 0, 131083, 458752, 0, 65544, 458753, 0, 131083, 458771, 0, 65544, 458772, 0, 131083, 524288, 0, 65544, 524289, 0, 131083, 524307, 0, 65544, 524308, 0, 131083, 589824, 0, 65544, 589825, 0, 131083, 589843, 0, 65544, 589844, 0, 131083, 655360, 0, 65544, 655361, 0, 65542, 655362, 0, 10, 655363, 0, 10, 655364, 0, 10, 655365, 0, 10, 655366, 0, 10, 655367, 0, 10, 655368, 0, 10, 655369, 0, 10, 655370, 0, 10, 655371, 0, 10, 655372, 0, 10, 655373, 0, 10, 655374, 0, 10, 655375, 0, 10, 655376, 0, 10, 655377, 0, 10, 655378, 0, 10, 655379, 0, 65541, 655380, 0, 131083, 720896, 0, 196616, 720897, 0, 196617, 720898, 0, 196617, 720899, 0, 196617, 720900, 0, 196617, 720901, 0, 196617, 720902, 0, 196617, 720903, 0, 196617, 720904, 0, 196617, 720905, 0, 196617, 720906, 0, 196617, 720907, 0, 196617, 720908, 0, 196617, 720909, 0, 196617, 720910, 0, 196617, 720911, 0, 196617, 720912, 0, 196617, 720913, 0, 196617, 720914, 0, 196617, 720915, 0, 196617, 720916, 0, 196619 ) diff --git a/project.godot b/project.godot index dd2979d..e09cf8e 100644 --- a/project.godot +++ b/project.godot @@ -27,7 +27,11 @@ _global_script_class_icons={ [application] config/name="Gamejam" +<<<<<<< Updated upstream run/main_scene="res://Title/Tilte.tscn" +======= +run/main_scene="res://levels/test.tscn" +>>>>>>> Stashed changes config/icon="res://icon.png" [autoload] @@ -77,7 +81,6 @@ texture={ up={ "deadzone": 0.5, "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null) -, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null) ] } down={ diff --git a/script/player.gd b/script/player.gd index db8ebd7..ae409b9 100644 --- a/script/player.gd +++ b/script/player.gd @@ -21,6 +21,8 @@ onready var Occluder: LightOccluder2D = $Sprite/LightOccluder2D onready var Anim: AnimationPlayer = $AnimationPlayer onready var CoyoteTimer: Timer = $CoyoteTimer onready var StateMachine: Node = $PlayerStateMachine +onready var HoldPosition: Node2D = $HoldPosition +onready var ProjectileSpawn: Node2D = $HoldPosition/Wand/ProjectileSpawn func _ready(): @@ -41,11 +43,12 @@ func handle_move_input(): if input_direction > 0: Spr.flip_h = false Occluder.scale.x = 1 + HoldPosition.rotation_degrees = 90 if input_direction < 0: Spr.flip_h = true Occluder.scale.x = -1 - + HoldPosition.rotation_degrees = -90 func jump(): velocity.y = max_jump_velocity