mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-04 15:00:09 +01:00
Improve code style (#1021)
* Remove unnecessary use of `self`
* Connect to signals directly over `connect("name")`
* Use `call_deferred` on callables over `call_deferred("name"))`
* Emit signals directly over `emit_signal("name"...)`
This commit is contained in:
@@ -191,7 +191,7 @@ func _shot_bullet() -> void:
|
||||
else:
|
||||
speed_scale = 1.0
|
||||
|
||||
bullet.position = self.position + bullet_shoot.position * Vector2(speed_scale, 1.0)
|
||||
bullet.position = position + bullet_shoot.position * Vector2(speed_scale, 1.0)
|
||||
get_parent().add_child(bullet)
|
||||
|
||||
bullet.linear_velocity = Vector2(400.0 * speed_scale, -40)
|
||||
@@ -204,5 +204,5 @@ func _shot_bullet() -> void:
|
||||
|
||||
func _spawn_enemy_above() -> void:
|
||||
var enemy := Enemy.instantiate() as RigidBody2D
|
||||
enemy.position = self.position + 50 * Vector2.UP
|
||||
enemy.position = position + 50 * Vector2.UP
|
||||
get_parent().add_child(enemy)
|
||||
|
||||
Reference in New Issue
Block a user