mirror of
https://github.com/RYGhub/the-cold-night.git
synced 2024-11-25 14:14:19 +00:00
🔧 Make BulletSpawn
a simple Node
This commit is contained in:
parent
9bc6b04dab
commit
40add5cda5
3 changed files with 5 additions and 6 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[ext_resource path="res://src/mechanics/White.png" type="Texture" id=1]
|
[ext_resource path="res://src/mechanics/White.png" type="Texture" id=1]
|
||||||
[ext_resource path="res://src/entities/behaviours/PlayerMovement.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://src/entities/behaviours/PlayerMovement.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://src/entities/behaviours/BulletSpawn.gd" type="Script" id=3]
|
[ext_resource path="res://src/entities/behaviours/BulletSpawn.tscn" type="PackedScene" id=3]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=1]
|
[sub_resource type="RectangleShape2D" id=1]
|
||||||
extents = Vector2( 16, 16 )
|
extents = Vector2( 16, 16 )
|
||||||
|
@ -17,5 +17,4 @@ texture = ExtResource( 1 )
|
||||||
[node name="Shape" type="CollisionShape2D" parent="."]
|
[node name="Shape" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
|
||||||
[node name="BulletSpawner" type="Node2D" parent="."]
|
[node name="BulletSpawn" parent="." instance=ExtResource( 3 )]
|
||||||
script = ExtResource( 3 )
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
extends Node2D
|
extends Node
|
||||||
|
|
||||||
|
|
||||||
export var bullet: PackedScene = preload("res://src/entities/Bullet.tscn")
|
export var bullet: PackedScene = preload("res://src/entities/Bullet.tscn")
|
||||||
|
@ -16,5 +16,5 @@ func shoot():
|
||||||
var new_bullet = bullet.instance()
|
var new_bullet = bullet.instance()
|
||||||
new_bullet.set_position(source.global_position)
|
new_bullet.set_position(source.global_position)
|
||||||
bullet_container_node.add_child(new_bullet)
|
bullet_container_node.add_child(new_bullet)
|
||||||
var rotation = new_bullet.get_angle_to(get_global_mouse_position())
|
var rotation = new_bullet.get_angle_to(source.get_global_mouse_position())
|
||||||
new_bullet.set_rotation(rotation)
|
new_bullet.set_rotation(rotation)
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
[ext_resource path="res://src/entities/behaviours/BulletSpawn.gd" type="Script" id=1]
|
[ext_resource path="res://src/entities/behaviours/BulletSpawn.gd" type="Script" id=1]
|
||||||
|
|
||||||
[node name="BulletSpawn" type="Node2D"]
|
[node name="BulletSpawn" type="Node"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
Loading…
Reference in a new issue