basic skill
This commit is contained in:
parent
36583be9db
commit
24e5cbfea9
11 changed files with 88 additions and 15 deletions
26
sprites/common/bullet/fireball.gd
Normal file
26
sprites/common/bullet/fireball.gd
Normal file
|
@ -0,0 +1,26 @@
|
|||
extends Area2D
|
||||
var velocity: Vector2 = Vector2()
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
|
||||
func _physics_process(delta):
|
||||
position += velocity * delta
|
||||
|
||||
|
||||
func _on_body_entered(body):
|
||||
#if body.is_in_group("players"):
|
||||
# Global.live = 2
|
||||
#elif body.is_in_group("enemies"):
|
||||
# Global.live = 3
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_screen_exited():
|
||||
queue_free()
|
|
@ -1,15 +1,21 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://b2gxwerkgrbp7"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://dibpmnnxefgi2"]
|
||||
|
||||
[ext_resource type="Script" path="res://sprites/common/bullet/fireball.gd" id="1_o7kcl"]
|
||||
[ext_resource type="Texture2D" uid="uid://cfqxhmvjstwcd" path="res://sprites/common/bullet/fireball.png" id="1_ues2l"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_tqfch"]
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_g125y"]
|
||||
size = Vector2(47, 60)
|
||||
|
||||
[node name="Fireball" type="RigidBody2D"]
|
||||
[node name="Fireball" type="Area2D"]
|
||||
script = ExtResource("1_o7kcl")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("1_ues2l")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0.5, 0)
|
||||
shape = SubResource("RectangleShape2D_tqfch")
|
||||
shape = SubResource("RectangleShape2D_g125y")
|
||||
|
||||
[node name="VisibleOnScreenEnabler2D" type="VisibleOnScreenEnabler2D" parent="."]
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue