Files
godot-demo-projects/networking/multiplayer_bomber/bomb_spawner.gd
Hugo Locurcio bac1e69164 Use static typing in all demos (#1063)
This leads to code that is easier to understand and runs
faster thanks to GDScript's typed instructions.

The untyped declaration warning is now enabled on all projects
where type hints were added. All projects currently run without
any untyped declration warnings.

Dodge the Creeps and Squash the Creeps demos intentionally don't
use type hints to match the documentation, where type hints haven't
been adopted yet (given its beginner focus).
2024-06-01 12:12:18 +02:00

15 lines
353 B
GDScript

extends MultiplayerSpawner
func _init() -> void:
spawn_function = _spawn_bomb
func _spawn_bomb(data: Array) -> Area2D:
if data.size() != 2 or typeof(data[0]) != TYPE_VECTOR2 or typeof(data[1]) != TYPE_INT:
return null
var bomb: Area2D = preload("res://bomb.tscn").instantiate()
bomb.position = data[0]
bomb.from_player = data[1]
return bomb