Beginnings of first boss implementation

This commit is contained in:
Sage Vaillancourt 2018-05-27 19:22:11 -04:00
parent d420f3706a
commit 03b3064f31
29 changed files with 357 additions and 52 deletions

View File

@ -6,9 +6,6 @@ export (PackedScene) var Laser
var screensize
var health_multi = 1
# class member variables go here, for example:
# var a = 2
# var b = "textvar"
var health = 50
var hit_timer = 1000
@ -19,13 +16,12 @@ func _on_Visibility_screen_exited():
func _ready():
connect("area_entered", self, "hit")
pass
func hit(who):
health -= 10/health_multi
$AnimatedSprite.frame = 1
hit_timer = 0
var velocity = Vector2()
func _process(delta):
@ -42,7 +38,6 @@ func _process(delta):
else:
velocity.x -= 1
$AnimatedSprite.frame = 0
# the player's movement vector
if velocity.length() > 0:
velocity = velocity.normalized() * SPEED

BIN
Image Sources/rectangle.xcf Normal file

Binary file not shown.

View File

@ -18,7 +18,6 @@ func _ready():
pass
func hit(who):
prints(who)
if plasma == true:
pass
elif current_pen > 0:

63
Main.gd
View File

@ -3,12 +3,15 @@ extends Node
export (PackedScene) var FirstBad
export (PackedScene) var BlobBad
export (PackedScene) var LaserBad
export (PackedScene) var RectangleBoss
var position = Vector2(200, 200)
var total_bads_spawned = 0
var bads_this_round = 0
var upgrade_cost = 50
var booting = true
var rectangle_opacity = 1
var bad_spawning_enabled = true
var screen_flashing = false
const BADDIE_WAIT_TIME_DEFAULT = 5
@ -57,6 +60,17 @@ func _process(delta):
if rectangle_opacity <= 0:
booting = false
$ColorRect.visible = false
if screen_flashing == true:
prints("screen_flashing == true", rectangle_opacity)
$ColorRect.color = Color(1, 1, 1, rectangle_opacity)
rectangle_opacity -= delta/4
if rectangle_opacity <= 0:
screen_flashing = false
$ColorRect.visible = false
if total_bads_spawned == 100:
bossMode()
func _on_bad_death(kill_money):
$Player.money += kill_money
@ -65,8 +79,16 @@ func _on_bad_death(kill_money):
var a_round_of_bads = 20
var sendblob = 1
var bad_health_multi = 1
var total_bads_spawned = 0
func BaddieTimer():
if total_bads_spawned <= a_round_of_bads:
if total_bads_spawned == 5:
if get_tree().is_network_server():
rpc("bossMode")
else:
bossMode()
total_bads_spawned += 1
if bads_this_round <= a_round_of_bads && bad_spawning_enabled:
var bad_type
var badposition = Vector2()
if sendblob%20 == 0:
@ -79,10 +101,10 @@ func BaddieTimer():
bad_type = 0
sendblob += 1
total_bads_spawned += 1
bads_this_round += 1
if $BaddieTimer.wait_time > 0.5:
$BaddieTimer.wait_time = $BaddieTimer.wait_time * 0.975
if total_bads_spawned == a_round_of_bads:
if bads_this_round == a_round_of_bads:
bad_health_multi *= 1.5
badposition.x = 1200
@ -92,9 +114,9 @@ func BaddieTimer():
else:
spawnBad(bad_type, badposition, bad_health_multi)
else:
total_bads_spawned = 0
bads_this_round = 0
sync func spawnBad(bad_type, position, health_multi): ### sync func ?
sync func spawnBad(bad_type, position, health_multi):
var bad
if bad_type == 0:
bad = FirstBad.instance()
@ -102,7 +124,9 @@ sync func spawnBad(bad_type, position, health_multi): ### sync func ?
bad = BlobBad.instance()
if bad_type == 2:
bad = LaserBad.instance()
total_bads_spawned += 1
add_child(bad)
bad.connect("dead", self, "_on_bad_death")
bad.health_multi = health_multi
@ -125,7 +149,7 @@ func _on_Player_restart_game():
for child in self.get_children():
if (child.has_method("_on_Visibility_screen_exited")):
child.queue_free()
total_bads_spawned = 0
bads_this_round = 0
$BaddieTimer.wait_time = BADDIE_WAIT_TIME_DEFAULT
$ShootButton.visible = true
@ -161,3 +185,26 @@ func _on_Player_multiplayer_movement(id, position, is_shooting):
$OtherPlayer.position = position
if is_shooting:
$OtherPlayer.shoot()
sync func bossMode():
bad_spawning_enabled = false
var bosstimer = Timer.new()
bosstimer.connect("timeout",self,"_launch_boss")
add_child(bosstimer) #to process
bosstimer.wait_time = 3 # 15 default
bosstimer.one_shot = true
bosstimer.start() #to start
func _launch_boss():
var bad
bad = RectangleBoss.instance()
add_child(bad)
bad.connect("flash", self, "_flash_screen")
bad.show_behind_parent = true
bad.connect("dead", self, "_on_bad_death")
func _flash_screen():
prints("_flash_screen")
screen_flashing = true
rectangle_opacity = 1
$ColorRect.visible = true

View File

@ -1,14 +1,15 @@
[gd_scene load_steps=12 format=2]
[gd_scene load_steps=13 format=2]
[ext_resource path="res://Main.gd" type="Script" id=1]
[ext_resource path="res://Bad1.tscn" type="PackedScene" id=2]
[ext_resource path="res://Bloob.tscn" type="PackedScene" id=3]
[ext_resource path="res://BadLaser.tscn" type="PackedScene" id=4]
[ext_resource path="res://art/bg.png" type="Texture" id=5]
[ext_resource path="res://Player.tscn" type="PackedScene" id=6]
[ext_resource path="res://Mothership.tscn" type="PackedScene" id=7]
[ext_resource path="res://art/interface/pause.png" type="Texture" id=8]
[ext_resource path="res://OtherPlayer.tscn" type="PackedScene" id=9]
[ext_resource path="res://RectangleBoss.tscn" type="PackedScene" id=5]
[ext_resource path="res://art/bg.png" type="Texture" id=6]
[ext_resource path="res://Player.tscn" type="PackedScene" id=7]
[ext_resource path="res://Mothership.tscn" type="PackedScene" id=8]
[ext_resource path="res://art/interface/pause.png" type="Texture" id=9]
[ext_resource path="res://OtherPlayer.tscn" type="PackedScene" id=10]
[sub_resource type="ImageTexture" id=1]
@ -21,19 +22,20 @@ size = Vector2( 0, 0 )
[sub_resource type="SpriteFrames" id=2]
animations = [ {
"frames": [ ExtResource( 8 ) ],
"frames": [ ExtResource( 9 ) ],
"loop": true,
"name": "default",
"speed": 5.0
} ]
[node name="Main" type="Node"]
[node name="Main" type="Node" index="0"]
script = ExtResource( 1 )
_sections_unfolded = [ "Pause" ]
FirstBad = ExtResource( 2 )
BlobBad = ExtResource( 3 )
LaserBad = ExtResource( 4 )
RectangleBoss = ExtResource( 5 )
[node name="Sprite" type="Sprite" parent="." index="0"]
@ -44,9 +46,9 @@ _sections_unfolded = [ "Z Index" ]
[node name="bg" type="Sprite" parent="Sprite" index="0"]
position = Vector2( 544.657, 347.107 )
texture = ExtResource( 5 )
texture = ExtResource( 6 )
[node name="Player" parent="." index="1" instance=ExtResource( 6 )]
[node name="Player" parent="." index="1" instance=ExtResource( 7 )]
[node name="BaddieTimer" type="Timer" parent="." index="2"]
@ -55,7 +57,7 @@ wait_time = 1.0
one_shot = false
autostart = false
[node name="Mothership" parent="." index="3" instance=ExtResource( 7 )]
[node name="Mothership" parent="." index="3" instance=ExtResource( 8 )]
position = Vector2( 18.327, 304.835 )
@ -144,7 +146,19 @@ group = null
flat = true
align = 1
[node name="ColorRect" type="ColorRect" parent="." index="7"]
[node name="Pause" type="AnimatedSprite" parent="." index="7"]
position = Vector2( 972.128, 67.044 )
scale = Vector2( 0.199771, 0.199771 )
frames = SubResource( 2 )
animation = "default"
[node name="OtherPlayer" parent="." index="8" instance=ExtResource( 10 )]
visible = false
_sections_unfolded = [ "Transform", "Visibility" ]
[node name="ColorRect" type="ColorRect" parent="." index="9"]
visible = false
anchor_left = 0.0
@ -162,28 +176,16 @@ size_flags_vertical = 1
color = Color( 0, 0, 0, 1 )
_sections_unfolded = [ "Visibility" ]
[node name="Pause" type="AnimatedSprite" parent="." index="8"]
position = Vector2( 972.128, 67.044 )
scale = Vector2( 0.199771, 0.199771 )
frames = SubResource( 2 )
animation = "default"
[node name="OtherPlayer" parent="." index="9" instance=ExtResource( 9 )]
visible = false
_sections_unfolded = [ "Transform", "Visibility" ]
[connection signal="body_entered" from="Player" to="Player" method="_on_Player_body_entered"]
[connection signal="multiplayer_movement" from="Player" to="." method="_on_Player_multiplayer_movement"]
[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"]

View File

@ -16,6 +16,7 @@ func _ready():
func _process(delta):
if now_quitting == true:
$StartEndlessMode.visible = false
$ColorRect.color = Color(0, 0, 0, rectangle_opacity)
# if rectangle_opacity < 0.75:
rectangle_opacity += delta/2
@ -50,6 +51,5 @@ func _on_Button_pressed():
#$Button.visible = false
now_quitting = true
func _on_Multiplayer_pressed():
emit_signal("multiplayer_menu")

View File

@ -54,7 +54,7 @@ const SHIP_SPEED_TIER5_COST = 800
const STARTING_POSITION = Vector2(100, 250)
# the amount of money the player starts with
const STARTING_MONEY = 100
const STARTING_MONEY = 10000
#################################
@ -178,14 +178,14 @@ func upgradeBulletDelay():
money -= BULLET_DELAY_TIER5_COST
ship_value += BULLET_DELAY_TIER5_COST
bullet_delay_tier = 4
elif (bullet_delay <= BULLET_DELAY_MINIMUM):
emit_signal("bullet_delay_fully_upgraded")
elif (bullet_delay <= BULLET_DELAY_TIER5 && money >= shooting_speed_upgrade):
bullet_delay = bullet_delay*0.95
money -= shooting_speed_upgrade
ship_value += shooting_speed_upgrade
shooting_speed_upgrade *= 1.1
bullet_delay_tier += 1
# elif (bullet_delay <= BULLET_DELAY_MINIMUM):
# emit_signal("bullet_delay_fully_upgraded")
# elif (bullet_delay <= BULLET_DELAY_TIER5 && money >= shooting_speed_upgrade):
# bullet_delay = bullet_delay*0.95
# money -= shooting_speed_upgrade
# ship_value += shooting_speed_upgrade
# shooting_speed_upgrade *= 1.1
# bullet_delay_tier += 1
timer.set_wait_time(bullet_delay)
rpc("other_shooting_speed_upgrade", get_tree().get_network_unique_id(), bullet_delay)

View File

@ -20,7 +20,7 @@ custom_solver_bias = 0.0
radius = 12.8998
height = 40.4125
[node name="Player" type="Area2D" index="0"]
[node name="Player" type="Area2D"]
input_pickable = true
gravity_point = true

142
RectangleBoss.gd Normal file
View File

@ -0,0 +1,142 @@
extends Area2D
signal dead
signal flash
export (PackedScene) var Laser
#### MAYBE ADD A HEALTH BAR TO MAIN ITSELF ####
#var health = 4000
# DEFAULT:
var health = 20000
var hit_timer = 1000
var health_multi = 1
var move_down = true
var small_move_down = true
var speed_multiplier = 3
var flashed = false
func _ready():
connect("area_entered", self, "hit")
pass
func hit(who):
health -= 3/health_multi
if health > 1500:
$Inside/InsideBadSprite.frame = 1
hit_timer = 0
else:
$Inside/InsideBadSprite.frame = 2
updateOutsideSprite()
if get_tree().is_network_server():
rpc("bossHealth", health)
func _process(delta):
# Entering view
if position.x > 0:
position.x -= delta*((100+(position.x))/20)
#### BIG WOBBLE ####
if position.y > 4:
move_down = false
if position.y <= -4:
move_down = true
if abs(position.y) > 4:
speed_multiplier = 1
elif abs(position.y) > 3:
speed_multiplier = 1
elif abs(position.y) > 2:
speed_multiplier = 2
elif abs(position.y) <= 2:
speed_multiplier = 3
if move_down:
if health > 1000:
position.y += delta*speed_multiplier
else:
if health > 1000:
position.y -= delta*speed_multiplier
if health <= 0 && $BigBadSprite.position.x < 5000:
$BigBadSprite.position.x += delta*75
#### SMALL WOBBLE ####
if $Inside/InsideBadSprite.position.y > 1200:
small_move_down = false
if $Inside/InsideBadSprite.position.y <= 1182:
small_move_down = true
if small_move_down:
$Inside/InsideBadSprite.position.y += delta*6
else:
$Inside/InsideBadSprite.position.y -= delta*6
#### DOES LOW HEALTH RELEASE THE INSIDE OR NO HEALTH? ####
if health <= 0 && !flashed:
emit_signal("flash")
emit_signal("dead", 1000)
prints("flash")
flashed = true
#queue_free()
if hit_timer < 0.15:
hit_timer += delta
elif hit_timer < 0.25:
hit_timer += delta
else:
if health > 1500:
$Inside/InsideBadSprite.frame = 0
var health_bar = Vector2(((health * 6) - 157), -273)
#$Line2D.set_point_position( 1, health_bar )
func _on_Inside_area_entered(area):
health -= 15/health_multi
updateOutsideSprite()
if health > 1500:
$Inside/InsideBadSprite.frame = 1
hit_timer = 0
else:
$Inside/InsideBadSprite.frame = 2
if get_tree().is_network_server():
rpc("bossHealth", health)
else:
pass
func updateOutsideSprite():
if health > 18000:
$BigBadSprite.frame = 0
elif health > 16000:
$BigBadSprite.frame = 1
elif health > 14000:
$BigBadSprite.frame = 2
elif health > 12000:
$BigBadSprite.frame = 3
elif health > 10000:
$BigBadSprite.frame = 4
elif health > 9000:
$BigBadSprite.frame = 5
elif health > 8000:
$BigBadSprite.frame = 6
elif health > 7000:
$BigBadSprite.frame = 7
elif health > 6000:
$BigBadSprite.frame = 8
elif health > 5000:
$BigBadSprite.frame = 9
elif health > 4000:
$BigBadSprite.frame = 10
elif health > 3000:
$BigBadSprite.frame = 11
elif health > 2000:
$BigBadSprite.frame = 12
elif health > 1500:
$BigBadSprite.frame = 13
$Inside/InsideBadSprite.frame = 2
elif health <= 0:
$BigBadSprite.frame = 14
slave func bossHealth(host_health):
health = host_health

120
RectangleBoss.tscn Normal file
View File

@ -0,0 +1,120 @@
[gd_scene load_steps=25 format=2]
[ext_resource path="res://RectangleBoss.gd" type="Script" id=1]
[ext_resource path="res://art/bad/rectangle/rectangle_inside.png" type="Texture" id=2]
[ext_resource path="res://art/bad/rectangle/rectangle_inside_wince.png" type="Texture" id=3]
[ext_resource path="res://art/bad/rectangle/rectangle_inside_fear.png" type="Texture" id=4]
[ext_resource path="res://art/bad/rectangle/rectangle_inside_blank.png" type="Texture" id=5]
[ext_resource path="res://art/bad/rectangle/rectangle_outside.png" type="Texture" id=6]
[ext_resource path="res://art/bad/rectangle/rectangle_outside_cracked1.png" type="Texture" id=7]
[ext_resource path="res://art/bad/rectangle/rectangle_outside_cracked2.png" type="Texture" id=8]
[ext_resource path="res://art/bad/rectangle/rectangle_outside_cracked3.png" type="Texture" id=9]
[ext_resource path="res://art/bad/rectangle/rectangle_outside_cracked4.png" type="Texture" id=10]
[ext_resource path="res://art/bad/rectangle/rectangle_outside_cracked5.png" type="Texture" id=11]
[ext_resource path="res://art/bad/rectangle/rectangle_outside_cracked6.png" type="Texture" id=12]
[ext_resource path="res://art/bad/rectangle/rectangle_outside_cracked7.png" type="Texture" id=13]
[ext_resource path="res://art/bad/rectangle/rectangle_outside_cracked8.png" type="Texture" id=14]
[ext_resource path="res://art/bad/rectangle/rectangle_outside_cracked9.png" type="Texture" id=15]
[ext_resource path="res://art/bad/rectangle/rectangle_outside_cracked10.png" type="Texture" id=16]
[ext_resource path="res://art/bad/rectangle/rectangle_outside_cracked11.png" type="Texture" id=17]
[ext_resource path="res://art/bad/rectangle/rectangle_outside_cracked12.png" type="Texture" id=18]
[ext_resource path="res://art/bad/rectangle/rectangle_outside_cracked13.png" type="Texture" id=19]
[ext_resource path="res://art/bad/rectangle/rectangle_outside_cracked14.png" type="Texture" id=20]
[sub_resource type="SpriteFrames" id=1]
animations = [ {
"frames": [ ExtResource( 2 ), ExtResource( 3 ), ExtResource( 4 ), ExtResource( 5 ) ],
"loop": true,
"name": "default",
"speed": 5.0
} ]
[sub_resource type="RectangleShape2D" id=4]
custom_solver_bias = 0.0
extents = Vector2( 414.127, 469.45 )
[sub_resource type="SpriteFrames" id=2]
animations = [ {
"frames": [ ExtResource( 6 ), ExtResource( 7 ), ExtResource( 8 ), ExtResource( 9 ), ExtResource( 10 ), ExtResource( 11 ), ExtResource( 12 ), ExtResource( 13 ), ExtResource( 14 ), ExtResource( 15 ), ExtResource( 16 ), ExtResource( 17 ), ExtResource( 18 ), ExtResource( 19 ), ExtResource( 20 ) ],
"loop": true,
"name": "default",
"speed": 5.0
} ]
[sub_resource type="RectangleShape2D" id=3]
custom_solver_bias = 0.0
extents = Vector2( 404.313, 217.774 )
[node name="RectangleBoss" type="Area2D"]
position = Vector2( 336.401, -1.22772 )
scale = Vector2( 0.25, 0.25 )
input_pickable = true
gravity_vec = Vector2( 0, 1 )
gravity = 98.0
linear_damp = 0.1
angular_damp = 1.0
audio_bus_override = false
audio_bus_name = "Master"
script = ExtResource( 1 )
_sections_unfolded = [ "Transform" ]
Laser = null
[node name="Inside" type="Area2D" parent="." index="0"]
input_pickable = true
gravity_vec = Vector2( 0, 1 )
gravity = 98.0
linear_damp = 0.1
angular_damp = 1.0
audio_bus_override = false
audio_bus_name = "Master"
[node name="InsideBadSprite" type="AnimatedSprite" parent="Inside" index="0"]
position = Vector2( 3392, 1182 )
frames = SubResource( 1 )
animation = "default"
_sections_unfolded = [ "Transform" ]
[node name="Inside Collision" type="CollisionShape2D" parent="Inside" index="1"]
position = Vector2( 3501.19, 1181.02 )
scale = Vector2( 1, 1.00835 )
shape = SubResource( 4 )
[node name="Line2D" type="Line2D" parent="." index="1"]
points = PoolVector2Array( )
width = 10.0
default_color = Color( 0.4, 0.5, 1, 1 )
texture_mode = 31
sharp_limit = 2.0
round_precision = 8
[node name="BigBadSprite" type="AnimatedSprite" parent="." index="2"]
position = Vector2( 3392, 1182 )
frames = SubResource( 2 )
animation = "default"
_sections_unfolded = [ "Transform" ]
[node name="OutsideTopCollision" type="CollisionShape2D" parent="." index="3"]
position = Vector2( 3427.85, 491.096 )
shape = SubResource( 3 )
[node name="OutsideBottomCollision" type="CollisionShape2D" parent="." index="4"]
position = Vector2( 3427.85, 1866.16 )
shape = SubResource( 3 )
[connection signal="area_entered" from="Inside" to="." method="_on_Inside_area_entered"]
[connection signal="body_entered" from="Inside" to="." method="_on_Inside_body_entered"]

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB