22 lines
465 B
GDScript
22 lines
465 B
GDScript
extends Button
|
|
|
|
|
|
|
|
|
|
func _on_Button_pressed():
|
|
var scene = load("res://Actors/Fish.tscn")
|
|
var fish = scene.instance()
|
|
fish.position = Vector2(rand_range(300,get_viewport().size.x-300),-100)
|
|
add_child(fish)
|
|
|
|
|
|
|
|
|
|
func _unhandled_input(event: InputEvent) -> void:
|
|
if event.is_action_pressed("Spawn Fish"):
|
|
var scene = load("res://Actors/Fish.tscn")
|
|
var fish = scene.instance()
|
|
fish.position = Vector2(get_global_mouse_position().x, -100)
|
|
add_child(fish)
|
|
|