Added Bow
Fixed Ghost Knockback being all over the place
This commit is contained in:
parent
40217226b9
commit
26b7bee6fc
8 changed files with 78 additions and 4 deletions
|
|
@ -25,7 +25,7 @@ func _physics_process(delta: float) -> void:
|
|||
self.position += motion * delta * min(1, dist/(motion.length()*delta))
|
||||
|
||||
|
||||
self.position += earth_aligner.global_from_local(current_knockback) * delta
|
||||
self.position += current_knockback * delta
|
||||
current_knockback = current_knockback/pow(1.3, 60*delta)
|
||||
|
||||
if(self.overlaps_body(player)):
|
||||
|
|
|
|||
10
items/arrow.gd
Normal file
10
items/arrow.gd
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
extends Area2D
|
||||
|
||||
var damage = 10
|
||||
var direction = Vector2(1,0)
|
||||
@export var speed = 2000
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
self.position += delta * speed * direction
|
||||
for area in get_overlapping_areas():
|
||||
area.hurt(damage, direction)
|
||||
1
items/arrow.gd.uid
Normal file
1
items/arrow.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bglrm0bb4nla
|
||||
20
items/arrow.tscn
Normal file
20
items/arrow.tscn
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://dfva4dhflxglr"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bglrm0bb4nla" path="res://items/arrow.gd" id="1_lxthq"]
|
||||
[ext_resource type="Texture2D" uid="uid://cy70quh6k3s1j" path="res://icon.svg" id="1_tl37p"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_tfcgf"]
|
||||
size = Vector2(20, 5)
|
||||
|
||||
[node name="Arrow" type="Area2D"]
|
||||
collision_layer = 0
|
||||
collision_mask = 2
|
||||
script = ExtResource("1_lxthq")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
scale = Vector2(2, 2)
|
||||
shape = SubResource("RectangleShape2D_tfcgf")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
scale = Vector2(0.31, 0.078)
|
||||
texture = ExtResource("1_tl37p")
|
||||
12
items/bow.gd
Normal file
12
items/bow.gd
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
extends ActiveItem
|
||||
@export var cooldown = 1
|
||||
@export var arrow_scene : PackedScene
|
||||
|
||||
|
||||
func activate():
|
||||
player.item_cooldown = cooldown
|
||||
var arrow : Area2D = arrow_scene.instantiate()
|
||||
get_tree().get_root().add_child(arrow)
|
||||
arrow.position = player.position
|
||||
arrow.rotation = player.rotation
|
||||
arrow.direction = player.earth_aligner.global_from_local(Vector2(player.facing, 0))
|
||||
1
items/bow.gd.uid
Normal file
1
items/bow.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bkcip66at5sug
|
||||
22
items/bow.tscn
Normal file
22
items/bow.tscn
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://ddn025xnjngko"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bkcip66at5sug" path="res://items/bow.gd" id="1_xppub"]
|
||||
[ext_resource type="PackedScene" uid="uid://dfva4dhflxglr" path="res://items/arrow.tscn" id="2_0id2q"]
|
||||
[ext_resource type="Texture2D" uid="uid://cy70quh6k3s1j" path="res://icon.svg" id="2_gllxn"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_gllxn"]
|
||||
|
||||
[node name="Bow" type="Area2D"]
|
||||
collision_layer = 0
|
||||
collision_mask = 4
|
||||
script = ExtResource("1_xppub")
|
||||
arrow_scene = ExtResource("2_0id2q")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
scale = Vector2(3.1, 3.1)
|
||||
shape = SubResource("CircleShape2D_gllxn")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
modulate = Color(1, 0, 1, 1)
|
||||
scale = Vector2(0.45, 0.45)
|
||||
texture = ExtResource("2_gllxn")
|
||||
14
main.tscn
14
main.tscn
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=10 format=3 uid="uid://cxo6bq26huau7"]
|
||||
[gd_scene load_steps=12 format=3 uid="uid://cxo6bq26huau7"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cmaovvr15b3qk" path="res://player/player.tscn" id="2_1bvp3"]
|
||||
[ext_resource type="Script" uid="uid://vgxh2xdevat7" path="res://world/earth.gd" id="2_lquwl"]
|
||||
|
|
@ -7,8 +7,10 @@
|
|||
[ext_resource type="PackedScene" uid="uid://cjsrtswk4vgf2" path="res://healthbar/healthbar.tscn" id="6_7mycd"]
|
||||
[ext_resource type="PackedScene" uid="uid://dpdn2php3ydsv" path="res://death_screen/death_screen.tscn" id="7_5vw27"]
|
||||
[ext_resource type="PackedScene" uid="uid://4l3elvxpghw8" path="res://utils/platform.tscn" id="7_272bh"]
|
||||
[ext_resource type="PackedScene" uid="uid://gwctb2xqsbj" path="res://items/healthup.tscn" id="9_4c57u"]
|
||||
[ext_resource type="PackedScene" uid="uid://ddn025xnjngko" path="res://items/bow.tscn" id="9_4c57u"]
|
||||
[ext_resource type="PackedScene" uid="uid://chu67ci7sl488" path="res://enemies/ghost.tscn" id="9_kek77"]
|
||||
[ext_resource type="PackedScene" uid="uid://dfva4dhflxglr" path="res://items/arrow.tscn" id="10_4c57u"]
|
||||
[ext_resource type="PackedScene" uid="uid://gwctb2xqsbj" path="res://items/healthup.tscn" id="11_efxa6"]
|
||||
|
||||
[node name="main" type="Node2D"]
|
||||
|
||||
|
|
@ -52,7 +54,13 @@ scale = Vector2(5, 3.1)
|
|||
[node name="Ghost" parent="." instance=ExtResource("9_kek77")]
|
||||
position = Vector2(0, -3000)
|
||||
|
||||
[node name="HealthUp" parent="." instance=ExtResource("9_4c57u")]
|
||||
[node name="Arrow" parent="." instance=ExtResource("10_4c57u")]
|
||||
position = Vector2(0, -3150)
|
||||
|
||||
[node name="HealthUp" parent="." instance=ExtResource("11_efxa6")]
|
||||
position = Vector2(200, -3100)
|
||||
|
||||
[node name="Bow" parent="." instance=ExtResource("9_4c57u")]
|
||||
position = Vector2(0, -3100)
|
||||
|
||||
[connection signal="health_changed" from="Player" to="CanvasLayer/Healthbar" method="_on_player_health_changed"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue