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
} ]
[node name="Laser" type="Area2D" index="0"]
[node name="Laser" type="Area2D"]
input_pickable = true
gravity_vec = Vector2( 0, 1 )

74
Main.gd
View File

@ -141,43 +141,53 @@ var sendblob = 1
var bad_health_multi = 1.5
var total_bads_spawned = 0
func BaddieTimer():
if total_bads_spawned%6 == 0: # 75 default
if get_tree().is_network_server():
total_bads_spawned += 1
rpc("bossMode")
else:
total_bads_spawned += 1
bossMode()
#if total_bads_spawned%6 == 0: # 75 default
# if get_tree().is_network_server():
# total_bads_spawned += 1
# rpc("bossMode")
# else:
# total_bads_spawned += 1
# bossMode()
#
if bads_this_round <= a_round_of_bads && bad_spawning_enabled:
var bad_type
var badposition = Vector2()
if sendblob%50 == 0:
bad_type = 3
sendblob += 1
elif sendblob%20 == 0:
bad_type = 2
sendblob += 1
elif sendblob%5 == 0:
bad_type = 1
sendblob += 1
if sendblob%6 == 0:
if get_tree().is_network_server():
total_bads_spawned += 1
sendblob += 1
rpc("bossMode")
else:
total_bads_spawned += 1
sendblob += 1
bossMode()
else:
bad_type = 0
sendblob += 1
bads_this_round += 1
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)
if sendblob%50 == 0:
bad_type = 3
sendblob += 1
elif sendblob%20 == 0:
bad_type = 2
sendblob += 1
elif sendblob%5 == 0:
bad_type = 1
sendblob += 1
else:
bad_type = 0
sendblob += 1
bads_this_round += 1
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:
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="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="." method="_on_Player_restart_game"]
[connection signal="update_display" from="Player" to="." method="_on_Player_update_display"]
[connection signal="timeout" from="BaddieTimer" to="." method="BaddieTimer"]