Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends Node2D
- var laserCount = 0
- var laser = preload("res://bullet.scn")
- var isspacepressed = false
- func _ready():
- set_process(true)
- pass
- func _process(delta):
- if Input.is_action_pressed("ui_select"):
- if isspacepressed == false:
- fire()
- isspacepressed = true
- else:
- isspacepressed = false
- func fire():
- print(laserCount)
- laserCount = laserCount +1
- print("fire")
- var laser_instance = laser.instance()
- laser_instance.set_name("laser" + str(laserCount))
- add_child(laser_instance)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement