Fix enemy lasers crashing mothership. Randomized boss spawns

This commit is contained in:
Sage Vaillancourt 2018-06-05 16:43:23 -04:00
parent 2ae7067aeb
commit c3301f068a
3 changed files with 45 additions and 35 deletions

View File

@ -19,7 +19,7 @@ animations = [ {
"speed": 20.0 "speed": 20.0
} ] } ]
[node name="Laser" type="Area2D" index="0"] [node name="Laser" type="Area2D"]
input_pickable = true input_pickable = true
gravity_vec = Vector2( 0, 1 ) gravity_vec = Vector2( 0, 1 )

74
Main.gd
View File

@ -141,43 +141,53 @@ var sendblob = 1
var bad_health_multi = 1.5 var bad_health_multi = 1.5
var total_bads_spawned = 0 var total_bads_spawned = 0
func BaddieTimer(): func BaddieTimer():
if total_bads_spawned%6 == 0: # 75 default #if total_bads_spawned%6 == 0: # 75 default
if get_tree().is_network_server(): # if get_tree().is_network_server():
total_bads_spawned += 1 # total_bads_spawned += 1
rpc("bossMode") # rpc("bossMode")
else: # else:
total_bads_spawned += 1 # total_bads_spawned += 1
bossMode() # bossMode()
#
if bads_this_round <= a_round_of_bads && bad_spawning_enabled: if bads_this_round <= a_round_of_bads && bad_spawning_enabled:
var bad_type var bad_type
var badposition = Vector2() var badposition = Vector2()
if sendblob%50 == 0: if sendblob%6 == 0:
bad_type = 3 if get_tree().is_network_server():
sendblob += 1 total_bads_spawned += 1
elif sendblob%20 == 0: sendblob += 1
bad_type = 2 rpc("bossMode")
sendblob += 1 else:
elif sendblob%5 == 0: total_bads_spawned += 1
bad_type = 1 sendblob += 1
sendblob += 1 bossMode()
else: else:
bad_type = 0 if sendblob%50 == 0:
sendblob += 1 bad_type = 3
sendblob += 1
bads_this_round += 1 elif sendblob%20 == 0:
if $BaddieTimer.wait_time > 1: bad_type = 2
$BaddieTimer.wait_time = $BaddieTimer.wait_time * 0.99 sendblob += 1
if bads_this_round == a_round_of_bads: elif sendblob%5 == 0:
bad_health_multi *= 1.5 bad_type = 1
sendblob += 1
badposition.x = 1200 else:
badposition.y = (randi()%410) + 50 bad_type = 0
if get_tree().is_network_server(): sendblob += 1
rpc("spawnBad", bad_type, badposition, bad_health_multi)
else: bads_this_round += 1
spawnBad(bad_type, badposition, bad_health_multi) if $BaddieTimer.wait_time > 1:
$BaddieTimer.wait_time = $BaddieTimer.wait_time * 0.99
if bads_this_round == a_round_of_bads:
bad_health_multi *= 1.5
badposition.x = 1200
badposition.y = (randi()%410) + 50
if get_tree().is_network_server():
rpc("spawnBad", bad_type, badposition, bad_health_multi)
else:
spawnBad(bad_type, badposition, bad_health_multi)
else: else:
bads_this_round = 0 bads_this_round = 0

View File

@ -270,10 +270,10 @@ _sections_unfolded = [ "Visibility" ]
[connection signal="other_shooting_upgrade" from="Player" to="." method="other_shooting_upgrade"] [connection signal="other_shooting_upgrade" from="Player" to="." method="other_shooting_upgrade"]
[connection signal="restart_game" from="Player" to="." method="_on_Player_restart_game"]
[connection signal="restart_game" from="Player" to="Mothership" method="_on_Player_restart_game"] [connection signal="restart_game" from="Player" to="Mothership" method="_on_Player_restart_game"]
[connection signal="restart_game" from="Player" to="." method="_on_Player_restart_game"]
[connection signal="update_display" from="Player" to="." method="_on_Player_update_display"] [connection signal="update_display" from="Player" to="." method="_on_Player_update_display"]
[connection signal="timeout" from="BaddieTimer" to="." method="BaddieTimer"] [connection signal="timeout" from="BaddieTimer" to="." method="BaddieTimer"]