Progress on RectangleReturn boss

This commit is contained in:
Sage Vaillancourt 2018-11-13 20:53:07 -05:00
parent 854d0ec6b9
commit ac479cf722
5 changed files with 240 additions and 26 deletions

View File

@ -23,7 +23,7 @@ signal dead
export (int) var SPEED export (int) var SPEED
export (PackedScene) var Laser export (PackedScene) var Laser
var screensize var screensize
var fire_speed = 15 var fire_speed = 15#0
var health = 400 var health = 400
var hit_timer = 1000 var hit_timer = 1000
var can_shoot = true var can_shoot = true
@ -104,7 +104,7 @@ func _process(delta):
$Line2D.set_point_position( 1, health_bar ) $Line2D.set_point_position( 1, health_bar )
if independent == true: if independent == true:
print(independent) #print(independent)
position += velocity * delta position += velocity * delta
func shoot(): func shoot():
@ -112,5 +112,5 @@ func shoot():
get_node("../").add_child(laser) get_node("../").add_child(laser)
laser.friendly_laser = false laser.friendly_laser = false
laser.rotation_degrees = 180 laser.rotation_degrees = 180
laser.position.y = position.y - 10 laser.position.y = position.y - 5
laser.position.x = position.x - 170 laser.position.x = position.x - 95

View File

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

View File

@ -52,7 +52,7 @@ animations = [ {
custom_solver_bias = 0.0 custom_solver_bias = 0.0
extents = Vector2( 404.313, 217.774 ) extents = Vector2( 404.313, 217.774 )
[node name="RectangleBoss" type="Area2D" index="0" groups=[ [node name="RectangleBoss" type="Area2D" groups=[
"enemies", "enemies",
]] ]]

View File

@ -1,13 +1,36 @@
extends "res://Bad.gd" extends "res://Bad.gd"
var right_laser_alive = true
var left_laser_alive = true
func _ready(): func _ready():
speed = 0 speed = 0
#$RightArm/BadLaser.independent = false #$RightArm/BadLaser.independent = false
#$RightArm/BadLaser.health_multi = 3 #$RightArm/BadLaser.health_multi = 3
#$LeftArm/BadLaser.independent = false #$LeftArm/BadLaser.independent = false
#$LeftArm/BadLaser.health_multi = 3 #$LeftArm/BadLaser.health_multi = 3
$RightArm/Laser/BadLaser.fire_speed = 25
$LeftArm/Laser/BadLaser.fire_speed = 25
$RightArm/Laser/BadLaser/Rotatable.rotation_degrees = -45
pass pass
func _process(delta): func _process(delta):
$RightArm/UpperArm.rotate(delta) #$RightArm/Forearm.rotate(delta/10)
pass if right_laser_alive:
if $RightArm/Laser/BadLaser:
$RightArm/Laser/BadLaser.health -= delta*30
if $RightArm/Laser/BadLaser.health <= 100:
$RightArm/Laser/BadLaser.fire_speed = 150
if left_laser_alive:
if $LeftArm/Laser/BadLaser:
$LeftArm/Laser/BadLaser.health -= delta*30
if $LeftArm/Laser/BadLaser.health <= 100:
$LeftArm/Laser/BadLaser.fire_speed = 150
func _on_LeftBadLaser_dead(money):
left_laser_alive = false
func _on_RightBadLaser_dead(money):
right_laser_alive = false

View File

@ -1,26 +1,46 @@
[gd_scene load_steps=7 format=2] [gd_scene load_steps=9 format=2]
[ext_resource path="res://Bad.tscn" type="PackedScene" id=1] [ext_resource path="res://Bad.tscn" type="PackedScene" id=1]
[ext_resource path="res://RectangleReturn.gd" type="Script" id=2] [ext_resource path="res://RectangleReturn.gd" type="Script" id=2]
[ext_resource path="res://art/bad/rectangle/return_arm.png" type="Texture" id=3] [ext_resource path="res://art/bad/rectangle/rectangle_inside.png" type="Texture" id=3]
[ext_resource path="res://BadLaser.tscn" type="PackedScene" id=4] [ext_resource path="res://BadLaser.tscn" type="PackedScene" id=4]
[ext_resource path="res://art/bad/rectangle/return_arm.png" type="Texture" id=5]
[sub_resource type="RectangleShape2D" id=2] [sub_resource type="SpriteFrames" id=3]
animations = [ {
"frames": [ ExtResource( 3 ) ],
"loop": true,
"name": "default",
"speed": 5.0
} ]
[sub_resource type="RectangleShape2D" id=1]
custom_solver_bias = 0.0 custom_solver_bias = 0.0
extents = Vector2( 43.4086, 153.113 ) extents = Vector2( 43.4086, 153.113 )
[sub_resource type="RectangleShape2D" id=3] [sub_resource type="RectangleShape2D" id=2]
custom_solver_bias = 0.0 custom_solver_bias = 0.0
extents = Vector2( 42.0251, 121.071 ) extents = Vector2( 42.0251, 121.071 )
[node name="RectangleReturn" index="0" instance=ExtResource( 1 )] [node name="RectangleReturn" index="0" instance=ExtResource( 1 )]
position = Vector2( 509.277, -22.7974 )
script = ExtResource( 2 ) script = ExtResource( 2 )
[node name="MainSprite" parent="." index="2"]
position = Vector2( 371.998, 340.999 )
scale = Vector2( 0.2, 0.2 )
z_index = 1
frames = SubResource( 3 )
_sections_unfolded = [ "Transform", "Z Index" ]
[node name="RightArm" type="Area2D" parent="." index="3"] [node name="RightArm" type="Area2D" parent="." index="3"]
position = Vector2( 284.999, 102 )
input_pickable = true input_pickable = true
gravity_vec = Vector2( 0, 1 ) gravity_vec = Vector2( 0, 1 )
gravity = 98.0 gravity = 98.0
@ -28,13 +48,23 @@ linear_damp = 0.1
angular_damp = 1.0 angular_damp = 1.0
audio_bus_override = false audio_bus_override = false
audio_bus_name = "Master" audio_bus_name = "Master"
_sections_unfolded = [ "Transform" ]
[node name="Forearm" type="RigidBody2D" parent="RightArm" index="0"] [node name="PinJoint2D" type="PinJoint2D" parent="RightArm" index="0"]
position = Vector2( 10.5514, 239.666 )
node_a = NodePath("../Forearm")
node_b = NodePath("../UpperArm")
bias = 0.0
disable_collision = true
softness = 0.0
[node name="Laser" type="RigidBody2D" parent="RightArm" index="1"]
input_pickable = false input_pickable = false
collision_layer = 1 collision_layer = 1
collision_mask = 1 collision_mask = 1
mode = 0 mode = 2
mass = 1.0 mass = 1.0
friction = 1.0 friction = 1.0
bounce = 0.0 bounce = 0.0
@ -50,27 +80,55 @@ linear_damp = -1.0
angular_velocity = 0.0 angular_velocity = 0.0
angular_damp = -1.0 angular_damp = -1.0
[node name="BadLaser" parent="RightArm/Laser" index="0" instance=ExtResource( 4 )]
position = Vector2( 0.575623, 2.26275 )
SPEED = 0
[node name="Forearm" type="RigidBody2D" parent="RightArm" index="2"]
editor/display_folded = true
rotation = -1.2897
scale = Vector2( 0.7, 0.7 )
z_index = -2
input_pickable = false
collision_layer = 1
collision_mask = 1
mode = 1
mass = 1.0
friction = 1.0
bounce = 0.0
gravity_scale = 0.0
custom_integrator = false
continuous_cd = 0
contacts_reported = 0
contact_monitor = false
sleeping = false
can_sleep = true
linear_velocity = Vector2( 0, 0 )
linear_damp = -1.0
angular_velocity = 0.0
angular_damp = -1.0
_sections_unfolded = [ "Transform", "Z Index" ]
[node name="Sprite" type="Sprite" parent="RightArm/Forearm" index="0"] [node name="Sprite" type="Sprite" parent="RightArm/Forearm" index="0"]
position = Vector2( 2.44351, 136.022 ) position = Vector2( 2.44351, 136.022 )
scale = Vector2( 0.25, 0.25 ) scale = Vector2( 0.25, 0.25 )
texture = ExtResource( 3 ) texture = ExtResource( 5 )
_sections_unfolded = [ "Transform" ] _sections_unfolded = [ "Transform" ]
[node name="BadLaser" parent="RightArm/Forearm" index="1" instance=ExtResource( 4 )] [node name="CollisionShape2D" type="CollisionShape2D" parent="RightArm/Forearm" index="1"]
position = Vector2( 0.575623, 2.26275 )
SPEED = 0
[node name="CollisionShape2D" type="CollisionShape2D" parent="RightArm/Forearm" index="2"]
position = Vector2( 4, 95 ) position = Vector2( 4, 95 )
shape = SubResource( 2 ) shape = SubResource( 1 )
[node name="UpperArm" type="RigidBody2D" parent="RightArm" index="1"] [node name="UpperArm" type="RigidBody2D" parent="RightArm" index="3"]
editor/display_folded = true editor/display_folded = true
position = Vector2( 6.58612, 372.305 ) position = Vector2( 135.789, 104.27 )
rotation = -2.72455
scale = Vector2( 0.8, 0.8 )
input_pickable = false input_pickable = false
collision_layer = 1 collision_layer = 1
collision_mask = 1 collision_mask = 1
@ -89,6 +147,7 @@ linear_velocity = Vector2( 0, 0 )
linear_damp = -1.0 linear_damp = -1.0
angular_velocity = 0.0 angular_velocity = 0.0
angular_damp = -1.0 angular_damp = -1.0
_sections_unfolded = [ "Transform", "Z Index" ]
__meta__ = { __meta__ = {
"_edit_group_": true "_edit_group_": true
} }
@ -96,12 +155,144 @@ __meta__ = {
[node name="Sprite" type="Sprite" parent="RightArm/UpperArm" index="0"] [node name="Sprite" type="Sprite" parent="RightArm/UpperArm" index="0"]
scale = Vector2( 0.26, 0.26 ) scale = Vector2( 0.26, 0.26 )
texture = ExtResource( 3 ) texture = ExtResource( 5 )
_sections_unfolded = [ "Transform" ] _sections_unfolded = [ "Transform" ]
[node name="CollisionShape2D" type="CollisionShape2D" parent="RightArm/UpperArm" index="1"] [node name="CollisionShape2D" type="CollisionShape2D" parent="RightArm/UpperArm" index="1"]
position = Vector2( 0, -1 ) position = Vector2( 0, -1 )
shape = SubResource( 3 ) shape = SubResource( 2 )
[node name="LeftArm" type="Area2D" parent="." index="4"]
editor/display_folded = true
position = Vector2( 178.999, 429.998 )
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"
_sections_unfolded = [ "Transform" ]
[node name="PinJoint2D" type="PinJoint2D" parent="LeftArm" index="0"]
position = Vector2( 10.5514, 239.666 )
node_a = NodePath("../Forearm")
node_b = NodePath("../UpperArm")
bias = 0.0
disable_collision = true
softness = 0.0
[node name="Laser" type="RigidBody2D" parent="LeftArm" index="1"]
position = Vector2( 108, 123.999 )
input_pickable = false
collision_layer = 1
collision_mask = 1
mode = 2
mass = 1.0
friction = 1.0
bounce = 0.0
gravity_scale = 0.0
custom_integrator = false
continuous_cd = 0
contacts_reported = 0
contact_monitor = false
sleeping = false
can_sleep = true
linear_velocity = Vector2( 0, 0 )
linear_damp = -1.0
angular_velocity = 0.0
angular_damp = -1.0
[node name="BadLaser" parent="LeftArm/Laser" index="0" instance=ExtResource( 4 )]
position = Vector2( 0.575623, 2.26275 )
SPEED = 0
[node name="Forearm" type="RigidBody2D" parent="LeftArm" index="2"]
editor/display_folded = true
position = Vector2( 109, 125 )
rotation = -1.74696
scale = Vector2( 0.7, 0.7 )
z_index = -2
input_pickable = false
collision_layer = 1
collision_mask = 1
mode = 1
mass = 1.0
friction = 1.0
bounce = 0.0
gravity_scale = 0.0
custom_integrator = false
continuous_cd = 0
contacts_reported = 0
contact_monitor = false
sleeping = false
can_sleep = true
linear_velocity = Vector2( 0, 0 )
linear_damp = -1.0
angular_velocity = 0.0
angular_damp = -1.0
_sections_unfolded = [ "Transform", "Z Index" ]
[node name="Sprite" type="Sprite" parent="LeftArm/Forearm" index="0"]
position = Vector2( 2.44351, 136.022 )
scale = Vector2( 0.25, 0.25 )
texture = ExtResource( 5 )
_sections_unfolded = [ "Transform" ]
[node name="CollisionShape2D" type="CollisionShape2D" parent="LeftArm/Forearm" index="1"]
position = Vector2( 4, 95 )
shape = SubResource( 1 )
[node name="UpperArm" type="RigidBody2D" parent="LeftArm" index="3"]
editor/display_folded = true
position = Vector2( 239.789, 33.2706 )
rotation = -6.68894
scale = Vector2( 0.8, 0.8 )
input_pickable = false
collision_layer = 1
collision_mask = 1
mode = 0
mass = 1.0
friction = 1.0
bounce = 0.0
gravity_scale = 0.0
custom_integrator = false
continuous_cd = 0
contacts_reported = 0
contact_monitor = false
sleeping = false
can_sleep = true
linear_velocity = Vector2( 0, 0 )
linear_damp = -1.0
angular_velocity = 0.0
angular_damp = -1.0
_sections_unfolded = [ "Transform", "Z Index" ]
__meta__ = {
"_edit_group_": true
}
[node name="Sprite" type="Sprite" parent="LeftArm/UpperArm" index="0"]
scale = Vector2( 0.26, 0.26 )
texture = ExtResource( 5 )
_sections_unfolded = [ "Transform" ]
[node name="CollisionShape2D" type="CollisionShape2D" parent="LeftArm/UpperArm" index="1"]
position = Vector2( 0, -1 )
shape = SubResource( 2 )
[connection signal="dead" from="RightArm/Laser/BadLaser" to="." method="_on_RightBadLaser_dead"]
[connection signal="dead" from="LeftArm/Laser/BadLaser" to="." method="_on_LeftBadLaser_dead"]