From 8e22dd66710c8dcf726e493b49583c67ceca9285 Mon Sep 17 00:00:00 2001 From: Diego Date: Mon, 20 Jul 2020 14:14:34 -0500 Subject: [PATCH] stuffffffff --- ai/SpinningBone.gd | 14 ++- ai/SpinningBone.tscn | 1 - art/Mana.png | Bin 0 -> 177 bytes art/Mana.png.import | 34 ++++++ levels/World.tscn | 230 +++++++++++++++++++++++++++++---------- levels/test.tscn | 19 +--- project.godot | 8 +- script/Skeleton Enemy.gd | 18 +-- 8 files changed, 237 insertions(+), 87 deletions(-) create mode 100644 art/Mana.png create mode 100644 art/Mana.png.import diff --git a/ai/SpinningBone.gd b/ai/SpinningBone.gd index a1ebcfa..5c86699 100644 --- a/ai/SpinningBone.gd +++ b/ai/SpinningBone.gd @@ -1,4 +1,12 @@ -extends Projectile +extends KinematicBody2D + +var velocity = Vector2.ZERO +var speed = 100 + +func _physics_process(delta): + var c = move_and_collide(velocity) + if c != null: + on_impact(c) func launch_right(): velocity = (Vector2.RIGHT * speed) @@ -8,7 +16,9 @@ func launch_upleft(): velocity = (Vector2(-1, -1).normalized() * speed) func launch_upright(): velocity = (Vector2(1, -1).normalized() * speed) + func on_impact(collision): + print(collision.collider) if collision.collider.has_method("get_type"): - collision.collider.set_health(collision.collider.get_health() - 1) + collision.collider.health -= 1 queue_free() diff --git a/ai/SpinningBone.tscn b/ai/SpinningBone.tscn index 30a92ac..048e6b1 100644 --- a/ai/SpinningBone.tscn +++ b/ai/SpinningBone.tscn @@ -31,7 +31,6 @@ script = ExtResource( 2 ) __meta__ = { "_edit_group_": true } -speed = 245 [node name="SpinningBone" type="Sprite" parent="."] texture = ExtResource( 1 ) diff --git a/art/Mana.png b/art/Mana.png new file mode 100644 index 0000000000000000000000000000000000000000..271075213d9a86b94f9423805f6404e57f9bd54d GIT binary patch literal 177 zcmeAS@N?(olHy`uVBq!ia0vp^Y(UJ(0U`xw#m)s%jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCf`#@Q5sCVBk9p!i>lBSEK+1-8@|!LnOkJ9oXvk@BhnxC_s;;f#u)-LWblW zDrSyq0?nPK5^EmZf4? 0: $Skeleton.flip_h = false elif velocity.x < 0: @@ -64,9 +58,9 @@ func _physics_process(_delta): if is_on_wall() and is_on_floor(): velocity.y = -150 + func on_impact(collision): if collision.collider.has_method("get_type"): collision.collider.set_health(collision.collider.get_health() - 1) - queue_free() if health == 0: queue_free()