fixed tabbing, small type issues
This commit is contained in:
parent
7b14cc8333
commit
046b3450a7
@ -8,7 +8,7 @@ signal bulletDamageSignal(body, bullet)
|
|||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
||||||
func setSpeed(value)->void:
|
func setSpeed(value:int)->void:
|
||||||
speed = value
|
speed = value
|
||||||
if speed <0:
|
if speed <0:
|
||||||
bullet_graphic.flip_h = true
|
bullet_graphic.flip_h = true
|
||||||
|
|||||||
@ -44,8 +44,8 @@ func reset()->void:
|
|||||||
timeAvailable = timers[currentLevel]
|
timeAvailable = timers[currentLevel]
|
||||||
playerHealth = player.starting_health
|
playerHealth = player.starting_health
|
||||||
coinsCollected = 0
|
coinsCollected = 0
|
||||||
|
|
||||||
func secondCounter()->void:
|
func secondCounter()->void:
|
||||||
timeAvailable -=1
|
timeAvailable -=1
|
||||||
countDownSignal.emit(timeAvailable)
|
countDownSignal.emit(timeAvailable)
|
||||||
if timeAvailable <=0:
|
if timeAvailable <=0:
|
||||||
|
|||||||
@ -21,7 +21,7 @@ func _ready() -> void:
|
|||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(delta: float) -> void:
|
func _process(_delta: float) -> void:
|
||||||
if Input.is_action_just_pressed("save"):
|
if Input.is_action_just_pressed("save"):
|
||||||
print("Save the game!")
|
print("Save the game!")
|
||||||
if Input.is_action_just_pressed("load"):
|
if Input.is_action_just_pressed("load"):
|
||||||
@ -47,14 +47,13 @@ func buildLevel()->void:
|
|||||||
|
|
||||||
func updateEnemies()->void:
|
func updateEnemies()->void:
|
||||||
if slimes:
|
if slimes:
|
||||||
var totalSlimes = 0
|
|
||||||
for obj in slimes.get_children():
|
for obj in slimes.get_children():
|
||||||
if obj is Slime:
|
if obj is Slime:
|
||||||
totalSlimes +=1
|
|
||||||
Gamecontroller.addEnemyToLevel(obj)
|
Gamecontroller.addEnemyToLevel(obj)
|
||||||
#hook up to game controller
|
#hook up to game controller
|
||||||
if not obj.slimeDamageSignal.is_connected(Gamecontroller._on_slime_damage):
|
if not obj.slimeDamageSignal.is_connected(Gamecontroller._on_slime_damage):
|
||||||
obj.slimeDamageSignal.connect(Gamecontroller._on_slime_damage)
|
obj.slimeDamageSignal.connect(Gamecontroller._on_slime_damage)
|
||||||
|
|
||||||
func updateCoins()->void:
|
func updateCoins()->void:
|
||||||
if coins:
|
if coins:
|
||||||
var totalCoins = 0
|
var totalCoins = 0
|
||||||
@ -101,13 +100,14 @@ func teleport(body)->void:
|
|||||||
var newPosition = Vector2(random_x,random_y)
|
var newPosition = Vector2(random_x,random_y)
|
||||||
body.teleport_to(newPosition)
|
body.teleport_to(newPosition)
|
||||||
|
|
||||||
func loadLevel(level:String)->void:
|
func loadLevel(levelString:String)->void:
|
||||||
get_tree().call_deferred("change_scene_to_file", level)
|
get_tree().call_deferred("change_scene_to_file", levelString)
|
||||||
func stashBullet(bullet:Bullet)->void:
|
|
||||||
|
func stashBullet(bulletToStash:Bullet)->void:
|
||||||
var stashPosition:Vector2 = Vector2(-100,100)
|
var stashPosition:Vector2 = Vector2(-100,100)
|
||||||
bullet.position = stashPosition
|
bulletToStash.position = stashPosition
|
||||||
bullet.setSpeed(0)
|
bulletToStash.setSpeed(0)
|
||||||
bullet.set_process(false)
|
bulletToStash.set_process(false)
|
||||||
|
|
||||||
func bulletFactory()->Bullet :
|
func bulletFactory()->Bullet :
|
||||||
var myBullet:Bullet
|
var myBullet:Bullet
|
||||||
@ -122,9 +122,8 @@ func bulletFactory()->Bullet :
|
|||||||
|
|
||||||
bulletArray.push_front(myBullet)
|
bulletArray.push_front(myBullet)
|
||||||
return myBullet
|
return myBullet
|
||||||
func makeBullet(targetPosition, speed)->void:
|
|
||||||
print("Make a bullet!")
|
func makeBullet(targetPosition:Transform2D, speed:int)->void:
|
||||||
print("bullets created: "+str( bulletArray.size() ))
|
|
||||||
var myBullet:Bullet = bulletFactory()
|
var myBullet:Bullet = bulletFactory()
|
||||||
myBullet.transform = targetPosition
|
myBullet.transform = targetPosition
|
||||||
myBullet.setSpeed(speed)
|
myBullet.setSpeed(speed)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user