mirror of
https://codeberg.org/Melon-Bread/Comets.gd.git
synced 2024-11-24 21:18:21 -05:00
Invader's bullets no longer wrap
This commit is contained in:
parent
0b22409369
commit
4f025868e6
@ -3,6 +3,7 @@ extends Area2D
|
|||||||
@export var speed := 1400.00
|
@export var speed := 1400.00
|
||||||
var direction := Vector2.UP
|
var direction := Vector2.UP
|
||||||
var life_span = 0.5
|
var life_span = 0.5
|
||||||
|
var screen_wrap = true
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
$LifeTimer.wait_time = life_span
|
$LifeTimer.wait_time = life_span
|
||||||
@ -14,6 +15,7 @@ func _physics_process(delta: float) -> void:
|
|||||||
print(rotation)
|
print(rotation)
|
||||||
|
|
||||||
# Screenwrap
|
# Screenwrap
|
||||||
|
if screen_wrap:
|
||||||
var viewport_size := get_viewport_rect().size
|
var viewport_size := get_viewport_rect().size
|
||||||
position.x = wrap(position.x, 0, viewport_size.x)
|
position.x = wrap(position.x, 0, viewport_size.x)
|
||||||
position.y = wrap(position.y, 0,viewport_size.y)
|
position.y = wrap(position.y, 0,viewport_size.y)
|
||||||
|
@ -55,6 +55,7 @@ func shoot(pos : Vector2, rot : float) -> void:
|
|||||||
bullet.position = pos
|
bullet.position = pos
|
||||||
bullet.rotation = rot
|
bullet.rotation = rot
|
||||||
bullet.life_span = 0.3
|
bullet.life_span = 0.3
|
||||||
|
bullet.screen_wrap = false
|
||||||
$Projectiles.add_child(bullet)
|
$Projectiles.add_child(bullet)
|
||||||
$ShootSound.play()
|
$ShootSound.play()
|
||||||
can_shoot = false
|
can_shoot = false
|
||||||
|
Loading…
Reference in New Issue
Block a user