mirror of
https://codeberg.org/Melon-Bread/Comets.gd.git
synced 2024-11-24 21:18:21 -05:00
Set up groups, layers, and bullet wrap around
This commit is contained in:
parent
a5e7731b47
commit
c13e23cdd3
@ -6,7 +6,8 @@
|
|||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_5nukh"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_5nukh"]
|
||||||
size = Vector2(4, 16)
|
size = Vector2(4, 16)
|
||||||
|
|
||||||
[node name="Bullet" type="Area2D"]
|
[node name="Bullet" type="Area2D" groups=["projectile"]]
|
||||||
|
collision_layer = 2
|
||||||
script = ExtResource("1_jyq7a")
|
script = ExtResource("1_jyq7a")
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
@ -20,6 +21,4 @@ shape = SubResource("RectangleShape2D_5nukh")
|
|||||||
one_shot = true
|
one_shot = true
|
||||||
autostart = true
|
autostart = true
|
||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="."]
|
|
||||||
|
|
||||||
[connection signal="timeout" from="LifeTimer" to="." method="_on_life_timer_timeout"]
|
[connection signal="timeout" from="LifeTimer" to="." method="_on_life_timer_timeout"]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_hwy8o"]
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_hwy8o"]
|
||||||
|
|
||||||
[node name="Ship" type="Area2D"]
|
[node name="Ship" type="Area2D" groups=["ship"]]
|
||||||
script = ExtResource("1_japvq")
|
script = ExtResource("1_japvq")
|
||||||
max_speed = null
|
max_speed = null
|
||||||
steering_factor = null
|
steering_factor = null
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
extends Area2D
|
extends Area2D
|
||||||
|
|
||||||
|
@export var max_speed := 1400.00
|
||||||
|
|
||||||
|
var direction := Vector2.ZERO
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
pass
|
var viewport_size := get_viewport_rect().size
|
||||||
|
position.x = wrap(position.x, 0, viewport_size.x)
|
||||||
|
position.y = wrap(position.y, 0,viewport_size.y)
|
||||||
|
|
||||||
func _on_life_timer_timeout() -> void:
|
func _on_life_timer_timeout() -> void:
|
||||||
queue_free()
|
queue_free()
|
||||||
|
@ -17,6 +17,7 @@ func _process(delta: float) -> void:
|
|||||||
position += velocity * delta
|
position += velocity * delta
|
||||||
|
|
||||||
if velocity.length() > 0.0:
|
if velocity.length() > 0.0:
|
||||||
|
# TODO: Have the CollisionShape toate with the sprite
|
||||||
$Sprite2D.rotation = velocity.angle()
|
$Sprite2D.rotation = velocity.angle()
|
||||||
|
|
||||||
var viewport_size := get_viewport_rect().size
|
var viewport_size := get_viewport_rect().size
|
||||||
|
Loading…
Reference in New Issue
Block a user