General enemy class. Two new enemy types. Removal of ship_speed

upgrades. Laser damage almost implemented. Multiplayer substantially
improved.
This commit is contained in:
Sage Vaillancourt 2018-06-03 11:11:27 -04:00
parent 1bcdc1a927
commit 5ea68a6a68
64 changed files with 1002 additions and 203 deletions

14
BG.gd Normal file
View File

@ -0,0 +1,14 @@
extends Node2D
var fly_speed = 5
func _ready():
pass
func _process(delta):
$bg1.position.x -= delta*fly_speed
$bg2.position.x -= delta*fly_speed
if $bg1.position.x < -550:
$bg1.position.x = 1600
if $bg2.position.x < -550:
$bg2.position.x = 1600

59
Bad.gd Normal file
View File

@ -0,0 +1,59 @@
#
# Copyright (C) 2018 Sage Vaillancourt, sagev9000@gmail.com
#
# This file is part of Fronter.
#
# Fronter is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Fronter is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Fronter. If not, see <http://www.gnu.org/licenses/>.
#
extends Area2D
signal dead
var speed = 50
var screensize
var health_multi = 1
var kill_reward = 0
var health = 1
var starting_health = 1
var hit_timer = 1000
func _on_Visibility_screen_exited():
queue_free()
func _ready():
connect("area_entered", self, "hit")
pass
func hit(who):
health -= who.damage/health_multi
hit_timer = 0
#var health_bar = Vector2(((health * 6) - 157), -273)
#$HealthBar.set_point_position( 1, health_bar )
if health <= 0:
emit_signal("dead", kill_reward)
queue_free()
var velocity = Vector2()
func _process(delta):
velocity.x -= 1
if velocity.length() > 0:
velocity = velocity.normalized() * speed
position += velocity * delta
prints(health)

32
Bad.tscn Normal file
View File

@ -0,0 +1,32 @@
[gd_scene format=2]
[node name="BadClass" type="Area2D" index="0"]
input_pickable = true
gravity_vec = Vector2( 0, 1 )
gravity = 98.0
linear_damp = 0.1
angular_damp = 1.0
collision_layer = 2
collision_mask = 0
audio_bus_override = false
audio_bus_name = "Master"
_sections_unfolded = [ "Collision" ]
[node name="CollisionBox" type="CollisionShape2D" parent="." index="0"]
[node name="HealthBar" type="Line2D" parent="." index="1"]
points = PoolVector2Array( )
width = 12.0
default_color = Color( 0, 1, 0.0352941, 1 )
texture_mode = 892679477
sharp_limit = 2.0
round_precision = 8
[node name="MainSprite" type="AnimatedSprite" parent="." index="2"]
animation = "default"
_sections_unfolded = [ "Transform" ]

12
Bad1.gd
View File

@ -37,17 +37,20 @@ func _ready():
pass
func hit(who):
health -= 10/health_multi
health -= who.damage/health_multi
$AnimatedSprite.frame = 1
hit_timer = 0
var velocity = Vector2()
var health_bar = Vector2(((health * 6) - 157), -273)
$Line2D.set_point_position( 1, health_bar )
func _process(delta):
if health <= 0:
emit_signal("dead", 15)
queue_free()
var velocity = Vector2()
func _process(delta):
if hit_timer < 0.15:
hit_timer += delta
velocity.x = 0
@ -61,7 +64,4 @@ func _process(delta):
if velocity.length() > 0:
velocity = velocity.normalized() * SPEED
var health_bar = Vector2(((health * 6) - 157), -273)
$Line2D.set_point_position( 1, health_bar )
position += velocity * delta

15
BadClass.gd Normal file
View File

@ -0,0 +1,15 @@
extends "res://Bad.gd"
# class member variables go here, for example:
# var a = 2
# var b = "textvar"
func _ready():
# Called every time the node is added to the scene.
# Initialization here
pass
#func _process(delta):
# # Called every frame. Delta is time since last frame.
# # Update game logic here.
# pass

View File

@ -39,7 +39,7 @@ func _ready():
func hit(who):
health -= 10/health_multi
health -= who.damage/health_multi
$AnimatedSprite.frame = 1
hit_timer = 0
@ -47,7 +47,7 @@ var velocity = Vector2()
func _process(delta):
if health <= 0:
emit_signal("dead", 200)
emit_signal("dead", 100)
queue_free()
$Rotatable.rotation_degrees += delta*fire_speed

51
BlackHole.gd Normal file
View File

@ -0,0 +1,51 @@
extends "res://Bad.gd"
# class member variables go here, for example:
# var a = 2
# var b = "textvar"
var rot_speed = 1
func _ready():
starting_health = 5000
health = starting_health
speed = 10
position.x = 700
position.y = 300
var splitting = false
func _process(delta):
rotation += delta*rot_speed
if rotation > 2*PI:
rotation = 0
if health < starting_health*0.88:
$MainSprite.frame = 1
if health < starting_health*0.76:
$MainSprite.frame = 2
if health < starting_health*0.64:
$MainSprite.frame = 3
if health < starting_health*0.52:
$MainSprite.frame = 4
if health < starting_health*0.40:
$MainSprite.frame = 5
if health < starting_health*0.28:
$MainSprite.frame = 6
if health < starting_health*0.16:
$CollisionBox.disabled = true
$TopHalf.visible = true
$BotHalf.visible = true
$MainSprite.visible = false
if rotation_degrees > 45 && rotation_degrees < 70:
splitting = true
if splitting:
rot_speed = 0
$TopHalf.position.y -= delta*500
$TopHalf.position.x -= delta*250
$BotHalf.position.y += delta*500
$BotHalf.position.x += delta*250
$TopHalf.rotation += delta
$BotHalf.rotation -= delta

73
BlackHole.tscn Normal file
View File

@ -0,0 +1,73 @@
[gd_scene load_steps=16 format=2]
[ext_resource path="res://Bad.tscn" type="PackedScene" id=1]
[ext_resource path="res://BlackHole.gd" type="Script" id=2]
[ext_resource path="res://art/bad/BlackHole/base.png" type="Texture" id=3]
[ext_resource path="res://art/bad/BlackHole/base_1.png" type="Texture" id=4]
[ext_resource path="res://art/bad/BlackHole/base_2.png" type="Texture" id=5]
[ext_resource path="res://art/bad/BlackHole/base_3.png" type="Texture" id=6]
[ext_resource path="res://art/bad/BlackHole/base_4.png" type="Texture" id=7]
[ext_resource path="res://art/bad/BlackHole/base_5.png" type="Texture" id=8]
[ext_resource path="res://art/bad/BlackHole/base_6.png" type="Texture" id=9]
[ext_resource path="res://art/bad/BlackHole/half2.png" type="Texture" id=10]
[ext_resource path="res://art/bad/BlackHole/half1.png" type="Texture" id=11]
[sub_resource type="CircleShape2D" id=2]
custom_solver_bias = 0.0
radius = 904.987
[sub_resource type="SpriteFrames" id=1]
animations = [ {
"frames": [ ExtResource( 3 ), ExtResource( 4 ), ExtResource( 5 ), ExtResource( 6 ), ExtResource( 7 ), ExtResource( 8 ), ExtResource( 9 ) ],
"loop": true,
"name": "default",
"speed": 5.0
} ]
[sub_resource type="SpriteFrames" id=3]
animations = [ {
"frames": [ ExtResource( 10 ) ],
"loop": true,
"name": "default",
"speed": 5.0
} ]
[sub_resource type="SpriteFrames" id=4]
animations = [ {
"frames": [ ExtResource( 11 ) ],
"loop": true,
"name": "default",
"speed": 5.0
} ]
[node name="BlackHole" index="0" instance=ExtResource( 1 )]
scale = Vector2( 0.3, 0.3 )
script = ExtResource( 2 )
_sections_unfolded = [ "Collision", "Transform" ]
[node name="CollisionBox" parent="." index="0"]
shape = SubResource( 2 )
[node name="MainSprite" parent="." index="2"]
frames = SubResource( 1 )
[node name="TopHalf" type="AnimatedSprite" parent="." index="3"]
visible = false
frames = SubResource( 3 )
animation = "default"
[node name="BotHalf" type="AnimatedSprite" parent="." index="4"]
visible = false
frames = SubResource( 4 )
animation = "default"

View File

@ -38,7 +38,7 @@ func _on_Visibility_screen_exited():
queue_free()
func hit(who):
health -= 10/health_multi
health -= who.damage/health_multi
# $AnimatedSprite.frame = 1
hit_timer = 0

View File

@ -18,7 +18,7 @@ animations = [ {
"speed": 5.0
} ]
[node name="Area2D" type="Area2D"]
[node name="BadBlob" type="Area2D"]
scale = Vector2( 0.25, 0.25 )
z_index = -1
@ -27,6 +27,7 @@ gravity_vec = Vector2( 0, 1 )
gravity = 98.0
linear_damp = 0.1
angular_damp = 1.0
collision_layer = 2
collision_mask = 0
audio_bus_override = false
audio_bus_name = "Master"
@ -44,4 +45,17 @@ shape = SubResource( 1 )
frames = SubResource( 2 )
animation = "default"
[node name="Line2D" type="Line2D" parent="." index="2"]
position = Vector2( 112, 65.3334 )
points = PoolVector2Array( -157, -273, 143, -273 )
width = 12.0
default_color = Color( 0, 1, 0.0390625, 1 )
texture_mode = 31
joint_mode = 2
begin_cap_mode = 2
end_cap_mode = 2
sharp_limit = 2.0
round_precision = 8

BIN
Image Sources/Prison.xcf Normal file

Binary file not shown.

Binary file not shown.

View File

@ -21,11 +21,14 @@ extends Area2D
signal hit
const DEFAULT_DAMAGE = 10
export (int) var SPEED
export (int) var DAMAGE
var plasma = false
var current_pen = 0
var friendly_laser = true
var damage = DEFAULT_DAMAGE
func _ready():
$AnimatedSprite.play()

View File

@ -47,7 +47,6 @@ __meta__ = {
[node name="AnimatedSprite" type="AnimatedSprite" parent="." index="1"]
modulate = Color( 0, 0.71875, 1, 1 )
position = Vector2( -1.90735e-06, 0 )
scale = Vector2( 0.1, 0.2 )
frames = SubResource( 2 )

102
Main.gd
View File

@ -22,7 +22,9 @@ extends Node
export (PackedScene) var FirstBad
export (PackedScene) var BlobBad
export (PackedScene) var LaserBad
export (PackedScene) var Prison
export (PackedScene) var RectangleBoss
export (PackedScene) var BlackHole
var players = {}
@ -38,12 +40,19 @@ var touchy_shooty = false
var my_info = { name = "sagethesagesage", color = "FFFFFF" }
var mainmenu
const BADDIE_WAIT_TIME_DEFAULT = 5
var not_loading = false
const BADDIE_WAIT_TIME_DEFAULT = 4
func _ready():
# Prepare black rectangle for fading in
$ColorRect.visible = true
if OS.has_touchscreen_ui_hint():
$HowTo.visible = true
else:
$HowToDesktop.visible = true
# Launch the main menu on boot and pause the game
mainmenu = preload("res://MainMenu.tscn").instance()
add_child(mainmenu)
@ -77,6 +86,13 @@ func _process(delta):
if (Input.is_action_pressed("ui_quit")):
get_tree().quit()
if Input.is_action_pressed("ui_right") || Input.is_action_pressed("ui_left"):
_on_HideHowTo_pressed()
if Input.is_action_pressed("ui_down") || Input.is_action_pressed("ui_up"):
_on_HideHowTo_pressed()
if Input.is_action_pressed("ui_accept"):
_on_HideHowTo_pressed()
# Constantly update point display
updatePoints()
@ -110,31 +126,35 @@ func _process(delta):
screen_flashing = false
$ColorRect.visible = false
# After 100 enemies, enter bossMode
if total_bads_spawned == 100:
bossMode()
# When an enemy dies
func _on_bad_death(kill_money):
# Give players appropriate money
$Player.money += kill_money
var a_round_of_bads = 30
#########################
# ENEMY SPAWNING SCRIPT #
#########################
var a_round_of_bads = 50
var sendblob = 1
var bad_health_multi = 1
var bad_health_multi = 1.5
var total_bads_spawned = 0
func BaddieTimer():
if total_bads_spawned == 75:
if total_bads_spawned == 5: # 75 default
if get_tree().is_network_server():
total_bads_spawned += 1
rpc("bossMode")
else:
total_bads_spawned += 1
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:
if sendblob%50 == 0:
bad_type = 3
sendblob += 1
elif sendblob%20 == 0:
bad_type = 2
sendblob += 1
elif sendblob%5 == 0:
@ -145,8 +165,8 @@ func BaddieTimer():
sendblob += 1
bads_this_round += 1
if $BaddieTimer.wait_time > 0.5:
$BaddieTimer.wait_time = $BaddieTimer.wait_time * 0.975
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
@ -167,14 +187,26 @@ sync func spawnBad(bad_type, position, health_multi):
bad = BlobBad.instance()
if bad_type == 2:
bad = LaserBad.instance()
if bad_type == 3:
bad = Prison.instance()
# Increase BG speed with each enemy spawned
$BG.fly_speed *= 1.01
# Add one to total of enemies spawned
total_bads_spawned += 1
add_child(bad)
bad.connect("dead", self, "_on_bad_death")
if bad_type == 3:
bad.connect("health_up", self, "_on_health_up")
bad.health_multi = health_multi
bad.position = position
func _on_health_up(hp_increase):
$Mothership.health += hp_increase
$Mothership._update_health_bar()
func _on_PauseButton_pressed():
$Player.upgradeMenu()
@ -192,7 +224,10 @@ func _on_Player_restart_game():
for child in self.get_children():
if (child.has_method("_on_Visibility_screen_exited")):
child.queue_free()
if (child.has_method("bossHealth")):
child.queue_free()
bads_this_round = 0
total_bads_spawned = 0
$BaddieTimer.wait_time = BADDIE_WAIT_TIME_DEFAULT
$ShootButton.visible = true
@ -222,30 +257,33 @@ func double_laser_upgrade(id):
get_node(str(id)).double_laser = true
# Show other player's movement
func _on_Player_multiplayer_movement(id, position, is_shooting):
get_node(str(id)).position = position
#prints("Set position of", id, "( currently", get_node(str(id)).position, ") to", position)
func _on_Player_multiplayer_movement(id, pos, other_is_shooting):
get_node(str(id)).position = pos
if is_shooting:
if other_is_shooting:
get_node(str(id)).shoot()
# BOSS MODE #
# Disable enemy spawning
# Wait a few seconds for enemies to clear
# Call for boss launch
var bosstimer = null
sync func bossMode():
prints("bossMode()")
bad_spawning_enabled = false
var bosstimer = Timer.new()
bosstimer = Timer.new()
bosstimer.connect("timeout",self,"_launch_boss")
add_child(bosstimer) #to process
bosstimer.wait_time = 3 # 15 default
bosstimer.wait_time = 15
bosstimer.one_shot = true
bosstimer.start() #to start
# Spawn the first boss
func _launch_boss():
prints("_launch_boss()")
var bad
bad = RectangleBoss.instance()
#bad = RectangleBoss.instance()
bad = BlackHole.instance()
add_child(bad)
# Flash screen when signalled
@ -255,11 +293,24 @@ func _launch_boss():
# Boss death functions the same as regular death
bad.connect("dead", self, "_on_boss_death")
# Get boss health
bad.connect("boss_health", self, "getBossHealth")
func getBossHealth(currentHealth, totalHealth):
totalHealth = float(totalHealth)
var health_bar = Vector2(((currentHealth/totalHealth)*800)+100, 50)
$BossHealth.set_point_position(1, health_bar)
$BossHealth.default_color.a = 1
if currentHealth <= 0:
$BossHealth.default_color.a = 0
pass
# Currently same as regular enemy death
func _on_boss_death(kill_money):
# Give players appropriate money, and restart spawns
$Player.money += kill_money
bad_spawning_enabled = true
bosstimer.stop()
# Begins screen-flashing process
func _flash_screen():
@ -270,10 +321,11 @@ func _flash_screen():
func _load_players(id, info):
player_info = info
#prints(player_info)
prints("_load_players", player_info)
#prints(player_info[id].name, "YEET", player_info[id].color)
func _start_multiplayer_game():
print(player_info)
mainmenu.now_quitting = true
for peer_id in player_info:
if peer_id != get_tree().get_network_unique_id():
@ -283,3 +335,13 @@ func _start_multiplayer_game():
add_child(player)
#get_node("/").add_child(player)
player.setUsername(player_info[peer_id].name)
#$MultiplayerTimer.start()
func _on_HideHowTo_pressed():
$HowTo.visible = false
$HowToDesktop.visible = false
$HideHowTo.visible = false
func _on_Player_other_ship_enable_rainbow(id):
prints("Other player entered rainbow mode")
get_node(str(id)).enable_the_rainbow()

186
Main.tscn
View File

@ -1,15 +1,20 @@
[gd_scene load_steps=13 format=2]
[gd_scene load_steps=20 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://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]
[ext_resource path="res://Prison.tscn" type="PackedScene" id=5]
[ext_resource path="res://RectangleBoss.tscn" type="PackedScene" id=6]
[ext_resource path="res://BlackHole.tscn" type="PackedScene" id=7]
[ext_resource path="res://BG.gd" type="Script" id=8]
[ext_resource path="res://art/bg.png" type="Texture" id=9]
[ext_resource path="res://Player.tscn" type="PackedScene" id=10]
[ext_resource path="res://Mothership.tscn" type="PackedScene" id=11]
[ext_resource path="res://OtherPlayer.tscn" type="PackedScene" id=12]
[ext_resource path="res://art/interface/how_to.png" type="Texture" id=13]
[ext_resource path="res://art/interface/how_to_desktop.png" type="Texture" id=14]
[ext_resource path="res://art/interface/pause.png" type="Texture" id=15]
[sub_resource type="ImageTexture" id=1]
@ -22,60 +27,82 @@ size = Vector2( 0, 0 )
[sub_resource type="SpriteFrames" id=2]
animations = [ {
"frames": [ ExtResource( 9 ) ],
"frames": [ ExtResource( 13 ) ],
"loop": true,
"name": "default",
"speed": 5.0
} ]
[node name="Main" type="Node"]
[sub_resource type="SpriteFrames" id=3]
animations = [ {
"frames": [ ExtResource( 14 ) ],
"loop": true,
"name": "default",
"speed": 5.0
} ]
[sub_resource type="SpriteFrames" id=4]
animations = [ {
"frames": [ ExtResource( 15 ) ],
"loop": true,
"name": "default",
"speed": 5.0
} ]
[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 )
Prison = ExtResource( 5 )
RectangleBoss = ExtResource( 6 )
BlackHole = ExtResource( 7 )
[node name="Sprite" type="Sprite" parent="." index="0"]
[node name="BG" type="Node2D" parent="." index="0"]
editor/display_folded = true
z_index = -1
script = ExtResource( 8 )
_sections_unfolded = [ "Z Index" ]
[node name="bg1" type="Sprite" parent="BG" index="0"]
position = Vector2( 577.646, 365.663 )
scale = Vector2( 0.694364, 0.694364 )
texture = ExtResource( 9 )
_sections_unfolded = [ "Transform" ]
[node name="bg2" type="Sprite" parent="BG" index="1"]
position = Vector2( 1823.66, 361.868 )
scale = Vector2( 0.6985, 0.6985 )
texture = ExtResource( 9 )
_sections_unfolded = [ "Transform" ]
[node name="Sprite" type="Sprite" parent="." index="1"]
visible = false
z_index = -5
texture = SubResource( 1 )
_sections_unfolded = [ "Z Index" ]
[node name="bg" type="Sprite" parent="Sprite" index="0"]
[node name="Player" parent="." index="2" instance=ExtResource( 10 )]
position = Vector2( 544.657, 347.107 )
texture = ExtResource( 6 )
[node name="Player" parent="." index="1" instance=ExtResource( 7 )]
[node name="BaddieTimer" type="Timer" parent="." index="2"]
[node name="BaddieTimer" type="Timer" parent="." index="3"]
process_mode = 1
wait_time = 1.0
wait_time = 2.0
one_shot = false
autostart = false
[node name="Mothership" parent="." index="3" instance=ExtResource( 8 )]
[node name="Mothership" parent="." index="4" instance=ExtResource( 11 )]
editor/display_folded = true
position = Vector2( 18.327, 304.835 )
[node name="Line2D" type="Line2D" parent="Mothership" index="2"]
position = Vector2( 32.7402, 101.849 )
scale = Vector2( 3.33333, 3.33333 )
points = PoolVector2Array( 100, 200, 900, 200 )
width = 15.0
default_color = Color( 0.037384, 0.683594, 0, 1 )
texture_mode = 31
sharp_limit = 2.0
round_precision = 8
_sections_unfolded = [ "Z Index" ]
[node name="MoneyDisplay" type="Label" parent="." index="4"]
[node name="MoneyDisplay" type="Label" parent="." index="5"]
anchor_left = 0.0
anchor_top = 0.0
@ -98,7 +125,57 @@ lines_skipped = 0
max_lines_visible = -1
_sections_unfolded = [ "Size Flags", "custom_fonts" ]
[node name="ShootButton" type="Button" parent="." index="5"]
[node name="OtherPlayer" parent="." index="6" instance=ExtResource( 12 )]
visible = false
_sections_unfolded = [ "Material", "Transform", "Visibility" ]
[node name="BossHealth" type="Line2D" parent="." index="7"]
points = PoolVector2Array( 100, 50, 900, 50 )
width = 15.0
default_color = Color( 1, 0, 0, 0 )
texture_mode = 31
sharp_limit = 2.0
round_precision = 8
[node name="ColorRect" type="ColorRect" parent="." index="8"]
visible = false
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 1026.0
margin_bottom = 601.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
color = Color( 0, 0, 0, 1 )
_sections_unfolded = [ "Visibility" ]
[node name="HowTo" type="AnimatedSprite" parent="." index="9"]
visible = false
position = Vector2( 482.397, 299.674 )
scale = Vector2( 0.42077, 0.42077 )
frames = SubResource( 2 )
animation = "default"
_sections_unfolded = [ "Transform", "Visibility" ]
[node name="HowToDesktop" type="AnimatedSprite" parent="." index="10"]
visible = false
position = Vector2( 482, 300 )
scale = Vector2( 0.42, 0.42 )
frames = SubResource( 3 )
animation = "default"
_sections_unfolded = [ "Transform", "Visibility" ]
[node name="ShootButton" type="Button" parent="." index="11"]
anchor_left = 0.0
anchor_top = 0.0
@ -124,7 +201,7 @@ flat = true
align = 1
_sections_unfolded = [ "Theme" ]
[node name="PauseButton" type="Button" parent="." index="6"]
[node name="PauseButton" type="Button" parent="." index="12"]
anchor_left = 0.0
anchor_top = 0.0
@ -148,34 +225,37 @@ group = null
flat = true
align = 1
[node name="Pause" type="AnimatedSprite" parent="." index="7"]
[node name="Pause" type="AnimatedSprite" parent="." index="13"]
position = Vector2( 972.128, 67.044 )
scale = Vector2( 0.199771, 0.199771 )
frames = SubResource( 2 )
frames = SubResource( 4 )
animation = "default"
[node name="OtherPlayer" parent="." index="8" instance=ExtResource( 10 )]
[node name="HideHowTo" type="Button" parent="." index="14"]
visible = false
_sections_unfolded = [ "Transform", "Visibility" ]
[node name="ColorRect" type="ColorRect" parent="." index="9"]
visible = false
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 1026.0
margin_bottom = 601.0
margin_left = -50.0
margin_top = -15.0
margin_right = 1044.0
margin_bottom = 623.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
color = Color( 0, 0, 0, 1 )
toggle_mode = false
action_mode = 0
enabled_focus_mode = 2
shortcut = null
group = null
flat = true
align = 1
_sections_unfolded = [ "Visibility" ]
[connection signal="body_entered" from="Player" to="Player" method="_on_Player_body_entered"]
@ -186,12 +266,14 @@ _sections_unfolded = [ "Visibility" ]
[connection signal="other_ship_color_change" from="Player" to="." method="other_ship_color_change"]
[connection signal="other_ship_enable_rainbow" from="Player" to="." method="_on_Player_other_ship_enable_rainbow"]
[connection signal="other_shooting_upgrade" from="Player" to="." method="other_shooting_upgrade"]
[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="restart_game" from="Player" to="Mothership" 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"]
@ -206,4 +288,6 @@ _sections_unfolded = [ "Visibility" ]
[connection signal="pressed" from="PauseButton" to="." method="_on_PauseButton_pressed"]
[connection signal="pressed" from="HideHowTo" to="." method="_on_HideHowTo_pressed"]

View File

@ -51,6 +51,9 @@ func _process(delta):
if (Input.is_action_pressed("ui_quit")):
get_tree().quit()
#if (Input.is_action_pressed("ui_accept")):
# now_quitting = true
if ($Ship.rotation_degrees > -7 || $Ship.rotation_degrees < -13):
rotation_multiplier = SLOW_ROTATION
else:

View File

@ -36,40 +36,42 @@ var timer = null
var bullet_delay = 0.1
func _ready():
var health_bar = Vector2(((health * (.8)) + 100), 200)
$Line2D.set_point_position( 1, health_bar )
pass
# timer = Timer.new()
# timer.set_one_shot(true)
# timer.set_wait_time(bullet_delay)
# timer.connect("timeout", self, "on_timeout_complete")
# add_child(timer)
_update_health_bar()
func _process(delta):
if get_tree().has_network_peer() && not get_tree().is_network_server():
#health = slave_health
pass
if health <= 100 && $BlownOut/WhoopsGuy.unit_offset < 1:
$BlownOut/WhoopsGuy.unit_offset += delta
func _on_Mothership_area_shape_entered(area_id, area, area_shape, self_shape):
if not get_tree().has_network_peer():
#if not get_tree().has_network_peer():
if not get_tree().is_network_server():
health -= 50
if get_tree().is_network_server():
health -= 50
rset("slave_health", health)
prints(health)
var health_bar = Vector2(((health * (.8)) + 100), 200)
$Line2D.set_point_position( 1, health_bar )
_update_health_bar()
if health <= 250:
$AnimatedSprite.frame = 1
$BaseSprite.frame = 1
if health <= 100:
$AnimatedSprite.frame = 2
$BaseSprite.frame = 2
if health <= 0:
$AnimatedSprite.frame = 3
$BaseSprite.frame = 3
emit_signal("game_over")
prints("Game Over!")
func _on_Player_restart_game():
health = STARTING_HEALTH
$AnimatedSprite.frame = 0
var health_bar = Vector2(((health * (.8)) + 100), 200)
$BaseSprite.frame = 0
var health_bar = Vector2(((health * (.8)) + 100), 300)
$Line2D.set_point_position( 1, health_bar )
func _update_health_bar():
var health_bar = Vector2(((health * (.8)) + 100), 300)
$Line2D.set_point_position( 1, health_bar )
print(health)

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=2]
[gd_scene load_steps=11 format=2]
[ext_resource path="res://Mothership.gd" type="Script" id=1]
[ext_resource path="res://Laser.tscn" type="PackedScene" id=2]
@ -6,6 +6,7 @@
[ext_resource path="res://art/mothership/mothership_damage1.png" type="Texture" id=4]
[ext_resource path="res://art/mothership/mothership_damage2.png" type="Texture" id=5]
[ext_resource path="res://art/mothership/mothership_ruined.png" type="Texture" id=6]
[ext_resource path="res://art/mothership/whoops_guy.png" type="Texture" id=7]
[sub_resource type="CapsuleShape2D" id=1]
@ -22,15 +23,24 @@ animations = [ {
"speed": 5.0
} ]
[sub_resource type="Curve2D" id=3]
bake_interval = 5.0
_data = {
"points": PoolVector2Array( 0, 0, 0, 0, -815.417, -275.207, -142.554, 423.496, 70.8929, -199.411, -142.027, -653.941, 0, 0, 0, 0, 36.6832, -1766.51 )
}
_sections_unfolded = [ "Resource" ]
[node name="Mothership" type="Area2D"]
position = Vector2( 23.327, 304.835 )
scale = Vector2( 0.3, 0.3 )
position = Vector2( 42.1613, 302.944 )
scale = Vector2( 0.263572, 0.240903 )
input_pickable = true
gravity_vec = Vector2( 0, 1 )
gravity = 98.0
linear_damp = 0.1
angular_damp = 1.0
monitorable = false
collision_layer = 31
collision_mask = 31
audio_bus_override = false
@ -44,10 +54,46 @@ Laser = ExtResource( 2 )
position = Vector2( -110, 0 )
shape = SubResource( 1 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="." index="1"]
[node name="BaseSprite" type="AnimatedSprite" parent="." index="1"]
position = Vector2( 78.4, 0 )
frames = SubResource( 2 )
animation = "default"
_sections_unfolded = [ "Transform" ]
[node name="BlownOut" type="Path2D" parent="." index="2"]
position = Vector2( 935.039, 262.064 )
curve = SubResource( 3 )
[node name="WhoopsGuy" type="PathFollow2D" parent="BlownOut" index="0"]
position = Vector2( -815.417, -275.207 )
rotation = -0.0246469
offset = 0.0
h_offset = 0.0
v_offset = 0.0
rotate = false
cubic_interp = true
loop = false
lookahead = 4.0
[node name="whoops_guy" type="Sprite" parent="BlownOut/WhoopsGuy" index="0"]
rotation = -1.39698e-09
texture = ExtResource( 7 )
_sections_unfolded = [ "Offset", "Transform" ]
[node name="Line2D" type="Line2D" parent="." index="3"]
position = Vector2( 32.7402, 101.849 )
scale = Vector2( 3.33333, 3.33333 )
points = PoolVector2Array( 100, 300, 900, 300 )
width = 15.0
default_color = Color( 0.037384, 0.683594, 0, 1 )
texture_mode = 31
sharp_limit = 2.0
round_precision = 8
[connection signal="area_shape_entered" from="." to="." method="_on_Mothership_area_shape_entered"]

View File

@ -95,15 +95,19 @@ func _server_disconnected():
func _connected_fail():
pass # Could not even connect to server, abort
remote func register_player(id, info):
player_info[id] = info
remote func register_player(new_id, info):
prints("REGISTERING", new_id, info)
player_info[new_id] = info
if get_tree().is_network_server():
# Send my info to new player
#rpc_id(id, "register_player", 1, my_info)
rpc_id(new_id, "register_player", 1, my_info)
# Send the info of existing players
for peer_id in player_info:
rpc_id(id, "register_player", peer_id, player_info[peer_id])
emit_signal("player_info", id, player_info)
if peer_id != new_id:
rpc_id(new_id, "register_player", peer_id, player_info[peer_id])
rpc_id(peer_id, "register_player", new_id, player_info[new_id])
#player_info[new_id] = info
emit_signal("player_info", new_id, player_info)
$Lobby/RichTextLabel.bbcode_text = ""
#$Players.text = str(player_info)

View File

@ -99,7 +99,7 @@ animations = [ {
"speed": 5.0
} ]
[node name="Networking" type="Node" index="0"]
[node name="Networking" type="Node"]
pause_mode = 2
script = ExtResource( 1 )

View File

@ -77,8 +77,6 @@ func _ready():
add_child(timer)
timer.start()
$AnimatedSprite.modulate = \"00FFFF\"
position.x = 100
position.y = 250
@ -109,10 +107,22 @@ func setUsername(name):
username = name
func modulate(color):
$AnimatedSprite.modulate = color
if !rainbow_is_on:
$AnimatedSprite.modulate = color
var rainbow = Color(0,0,0,1)
var r_up = true
var g_up = true
var b_up = true
var rainbow_speed = 30
var rainbow_is_on = false
func _process(delta):
$Username.text = username
if rainbow_is_on:
rainbow(delta)
pass
func shoot():
@ -132,9 +142,36 @@ func shoot():
laser2.position.x = position.x + 46
laser2.current_pen = laser_penetration
can_shoot = false
timer.start()"
timer.start()
# Funky colors #
func enable_the_rainbow():
rainbow_is_on = true
func rainbow(delta):
if rainbow.r < 1 && r_up:
rainbow.r += rainbow_speed*delta/10
if rainbow.r >= 1: r_up = false
else:
rainbow.r -= rainbow_speed*delta/10
if rainbow.r <= 0.2: r_up = true
if rainbow.g < 1 && g_up:
rainbow.g += rainbow_speed*delta/9
if rainbow.g >= 1: g_up = false
else:
rainbow.g -= rainbow_speed*delta/9
if rainbow.g <= 0.2: g_up = true
if rainbow.b < 1 && b_up:
rainbow.b += rainbow_speed*delta/8
if rainbow.b >= 1: b_up = false
else:
rainbow.b -= rainbow_speed*delta/8
if rainbow.b <= 0.2: b_up = true
$AnimatedSprite.modulate = rainbow"
_sections_unfolded = [ "Resource" ]
[sub_resource type="SpriteFrames" id=2]
@ -165,11 +202,11 @@ collision_mask = 29
audio_bus_override = false
audio_bus_name = "Master"
script = SubResource( 1 )
_sections_unfolded = [ "Material" ]
Laser = ExtResource( 1 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="." index="0"]
modulate = Color( 0.276855, 0.445152, 0.84375, 1 )
position = Vector2( 1.01175, 7.07602 )
scale = Vector2( 0.2, 0.2 )
frames = SubResource( 2 )

115
Player.gd
View File

@ -23,13 +23,11 @@ extends Area2D
signal update_display # tells parent to update points display
signal refund # will tell parent a refund is occuring, for display
signal shooting_speed_upgrade # signals that a shooting speed upgrade has occured
signal ship_speed_upgrade
signal other_shooting_upgrade
signal other_ship_speed_upgrade
signal double_laser_upgrade
signal other_ship_color_change
signal other_ship_enable_rainbow
signal shooting_speed_fully_upgraded
signal ship_speed_fully_upgraded
signal restart_game
signal multiplayer_movement
@ -39,6 +37,8 @@ export (PackedScene) var Laser
# THINGS THAT MAY NEED ADJUSTING
#################################
var ship_speed = 500
# first 5 tiers of shooting speed
const BULLET_DELAY_TIER1 = 0.8
const BULLET_DELAY_TIER2 = 0.5
@ -61,21 +61,21 @@ const BULLET_DELAY_TIER5_COST = 1000
# double laser cost
const DOUBLE_LASER_COST = 2000
# the 5 tiers of ship speed
const SHIP_SPEED_TIER1 = 150
const SHIP_SPEED_TIER2 = 200
const SHIP_SPEED_TIER3 = 300
const SHIP_SPEED_TIER4 = 500
const SHIP_SPEED_TIER5 = 800
# 5 tiers of laser damage
const LASER_DAMAGE_TIER1 = 10
const LASER_DAMAGE_TIER2 = 12
const LASER_DAMAGE_TIER3 = 15
const LASER_DAMAGE_TIER4 = 20
const LASER_DAMAGE_TIER5 = 50
# costs of ship speed upgrades
const SHIP_SPEED_TIER2_COST = 200
const SHIP_SPEED_TIER3_COST = 400
const SHIP_SPEED_TIER4_COST = 600
const SHIP_SPEED_TIER5_COST = 800
# costs of laser damage upgrades
const LASER_DAMAGE_TIER2_COST = 200
const LASER_DAMAGE_TIER3_COST = 500
const LASER_DAMAGE_TIER4_COST = 1000
const LASER_DAMAGE_TIER5_COST = 2000
# the ship's starting position
const STARTING_POSITION = Vector2(100, 250)
const STARTING_POSITION = Vector2(130, 250)
# the amount of money the player starts with
const STARTING_MONEY = 100
@ -94,10 +94,6 @@ var can_shoot = false
# timer for shooting speed
var timer = null
# sets ship movement speed to the default
var ship_speed = SHIP_SPEED_TIER1
var ship_speed_tier = 0
# sets the delay between shots to the default
var bullet_delay = BULLET_DELAY_TIER1
var bullet_delay_tier = 0
@ -105,6 +101,7 @@ var bullet_delay_tier = 0
# sets other shooting settings to their defaults
var laser_penetration = 0
var double_laser = false
var laser_damage = LASER_DAMAGE_TIER1
# gives the player their starting points
var money = STARTING_MONEY
@ -126,13 +123,12 @@ func upgradeMenu():
add_child(upgmenu)
upgmenu.connect("refund", self, "_refund_button")
upgmenu.connect("bullet_delay_upgrade", self, "upgradeBulletDelay_button")
upgmenu.connect("ship_speed_upgrade", self, "upgradeShipSpeed_button")
upgmenu.connect("double_laser_upgrade", self, "doubleLaserUpgrade_button")
upgmenu.connect("laser_penetration_upgrade", self, "laserPenetrationUpgrade_button")
upgmenu.connect("menu_closed", self, "menuClosed")
upgmenu.connect("change_color", self, "changeColor")
upgmenu.connect("taste_the_rainbow", self, "enable_the_rainbow")
upgmenu.bullet_delay_tier = bullet_delay_tier
upgmenu.ship_speed_tier = ship_speed_tier
if !get_tree().has_network_peer():
get_tree().paused = true
@ -215,34 +211,6 @@ func upgradeBulletDelay():
timer.set_wait_time(bullet_delay)
rpc("other_shooting_speed_upgrade", get_tree().get_network_unique_id(), bullet_delay)
# upgrades the speed at which the ship moves
# not relevant for touchscreen users
# may be deprecated
func upgradeShipSpeed():
prints("func upgradeShipSpeed():")
if (ship_speed == SHIP_SPEED_TIER1 && money >= SHIP_SPEED_TIER2_COST):
ship_speed = SHIP_SPEED_TIER2
money -= SHIP_SPEED_TIER2_COST
ship_value += SHIP_SPEED_TIER2_COST
ship_speed_tier = 1
elif (ship_speed == SHIP_SPEED_TIER2 && money >= SHIP_SPEED_TIER3_COST):
ship_speed = SHIP_SPEED_TIER3
money -= SHIP_SPEED_TIER3_COST
ship_value += SHIP_SPEED_TIER3_COST
ship_speed_tier = 2
elif (ship_speed == SHIP_SPEED_TIER3 && money >= SHIP_SPEED_TIER4_COST):
ship_speed = SHIP_SPEED_TIER4
money -= SHIP_SPEED_TIER4_COST
ship_value += SHIP_SPEED_TIER4_COST
ship_speed_tier = 3
elif (ship_speed == SHIP_SPEED_TIER4 && money >= SHIP_SPEED_TIER5_COST):
ship_speed = SHIP_SPEED_TIER5
money -= SHIP_SPEED_TIER5_COST
ship_value += SHIP_SPEED_TIER5_COST
ship_speed_tier = 4
prints(ship_speed)
func doubleLaserUpgrade():
if money >= DOUBLE_LASER_COST && double_laser == false:
money -= DOUBLE_LASER_COST
@ -275,7 +243,6 @@ func _refund_button():
bullet_delay = BULLET_DELAY_TIER1
bullet_delay_tier = 0
timer.set_wait_time(bullet_delay)
ship_speed = SHIP_SPEED_TIER1
laser_penetration = 0
double_laser = false
shooting_speed_upgrade = SHOOTING_SPEED_UPGRADE_DEFAULT
@ -317,12 +284,22 @@ remote func other_shooting_speed_upgrade(id, bullet_delay):
remote func _change_color(id, color):
emit_signal("other_ship_color_change", id, color)
remote func _enable_rainbow(id):
emit_signal("other_ship_enable_rainbow", id)
remote func double_laser_upgrade(id):
emit_signal("double_laser_upgrade", id)
# the player's movement vector
var velocity = Vector2()
var rainbow = Color(0,0,0,1)
var r_up = true
var g_up = true
var b_up = true
var rainbow_speed = 30
var rainbow_is_on = false
func _process(delta):
# move player with keyboard
velocity = Vector2()
@ -338,8 +315,11 @@ func _process(delta):
velocity = velocity.normalized() * ship_speed
position += velocity * delta
if rainbow_is_on:
rainbow(delta)
# prevents player leaving the screen
position.x = clamp(position.x, 0, screensize.x)
position.x = clamp(position.x-100, 0, screensize.x-164) + 100
position.y = clamp(position.y, 0, screensize.y)
# basically exists just for rpc messages about whether or not the player is currently firing
@ -370,6 +350,7 @@ func shoot():
laser.current_pen = laser_penetration
laser.position.y = position.y - 27
laser.position.x = position.x + 46
laser.damage = laser_damage
#MAYBE THE LASERS SHOULD BE THEIR OWN NODES
#Would allow for more simple additions in the future
@ -384,6 +365,38 @@ func shoot():
can_shoot = false
timer.start()
# Funky colors #
# NOT CURRENTLY REFUNDABLE #
func enable_the_rainbow():
if money >= 2000 && not rainbow_is_on:
money -= 2000
rainbow_is_on = true
rpc("_enable_rainbow", get_tree().get_network_unique_id())
func rainbow(delta):
if rainbow.r < 1 && r_up:
rainbow.r += rainbow_speed*delta/10
if rainbow.r >= 1: r_up = false
else:
rainbow.r -= rainbow_speed*delta/10
if rainbow.r <= 0.2: r_up = true
if rainbow.g < 1 && g_up:
rainbow.g += rainbow_speed*delta/9
if rainbow.g >= 1: g_up = false
else:
rainbow.g -= rainbow_speed*delta/9
if rainbow.g <= 0.2: g_up = true
if rainbow.b < 1 && b_up:
rainbow.b += rainbow_speed*delta/8
if rainbow.b >= 1: b_up = false
else:
rainbow.b -= rainbow_speed*delta/8
if rainbow.b <= 0.2: b_up = true
$AnimatedSprite.modulate = rainbow
# displays endgame screen and pauses
func gameOver():
var gameover = preload("res://GameOver.tscn").instance()

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

39
Prison.gd Normal file
View File

@ -0,0 +1,39 @@
extends "res://Bad.gd"
func _ready():
health = 500
speed = 50
pass
signal health_up
var centered_x = false
var centered_y = false
func _process(delta):
if health < 200:
speed = 0
$StarSprite.frame = 1
$MainSprite.visible = false
$CollisionBox.disabled = true
if centered_x && centered_y:
$StarSprite.rotation += delta*10
position.x -= delta*500
if position.x < 0:
emit_signal("health_up", 200)
queue_free()
if position.x < 500:
position.x += delta*100
elif position.x > 524:
position.x -= delta*100
else:
centered_x = true
if position.y < 280:
position.y += delta*100
elif position.y > 320:
position.y -= delta*100
else:
centered_y = true

53
Prison.tscn Normal file
View File

@ -0,0 +1,53 @@
[gd_scene load_steps=9 format=2]
[ext_resource path="res://Bad.tscn" type="PackedScene" id=1]
[ext_resource path="res://Prison.gd" type="Script" id=2]
[ext_resource path="res://art/bad/prison/Star.png" type="Texture" id=3]
[ext_resource path="res://art/bad/prison/StarSmile.png" type="Texture" id=4]
[ext_resource path="res://art/bad/prison/Prison.png" type="Texture" id=5]
[sub_resource type="SpriteFrames" id=1]
animations = [ {
"frames": [ ExtResource( 3 ), ExtResource( 4 ) ],
"loop": true,
"name": "default",
"speed": 5.0
} ]
[sub_resource type="CapsuleShape2D" id=2]
custom_solver_bias = 0.0
radius = 367.866
height = 196.873
[sub_resource type="SpriteFrames" id=3]
animations = [ {
"frames": [ ExtResource( 5 ) ],
"loop": true,
"name": "default",
"speed": 5.0
} ]
[node name="Prison" instance=ExtResource( 1 )]
scale = Vector2( 0.2, 0.2 )
script = ExtResource( 2 )
_sections_unfolded = [ "Collision", "Transform" ]
[node name="StarSprite" type="AnimatedSprite" parent="." index="0"]
frames = SubResource( 1 )
animation = "default"
[node name="CollisionBox" parent="." index="1"]
position = Vector2( 0, -40 )
shape = SubResource( 2 )
[node name="MainSprite" parent="." index="3"]
frames = SubResource( 3 )

15
Range.gd Normal file
View File

@ -0,0 +1,15 @@
extends Area2D
# class member variables go here, for example:
# var a = 2
# var b = "textvar"
func _ready():
# Called every time the node is added to the scene.
# Initialization here
pass
#func _process(delta):
# # Called every frame. Delta is time since last frame.
# # Update game logic here.
# pass

View File

@ -22,12 +22,14 @@ extends Area2D
signal dead
signal flash
signal boss_fight_over
signal boss_health
export (PackedScene) var Laser
#### MAYBE ADD A HEALTH BAR TO MAIN ITSELF ####
#var health = 3000
# DEFAULT:
var health = 20000
var starting_health = 20000
var health = starting_health
var timer = null
var hit_timer = 1000
@ -48,7 +50,7 @@ func _ready():
pass
func hit(who):
health -= 3/health_multi
health -= who.damage/(health_multi*3.5)
if health > 1500:
$Inside/InsideBadSprite.frame = 1
hit_timer = 0
@ -57,6 +59,7 @@ func hit(who):
updateOutsideSprite()
if get_tree().is_network_server():
rpc("bossHealth", health)
emit_signal("boss_health", health, starting_health)
func _process(delta):
# Entering view
@ -115,6 +118,8 @@ func _process(delta):
#### DOES LOW HEALTH RELEASE THE INSIDE OR NO HEALTH? ####
if health <= 0 && !flashed:
emit_signal("flash")
$OutsideBottomCollision.disabled = true
$OutsideTopCollision.disabled = true
prints("flash")
flashed = true
#queue_free()
@ -142,6 +147,7 @@ func _on_Inside_area_entered(area):
rpc("bossHealth", health)
else:
pass
emit_signal("boss_health", health, starting_health)
func updateOutsideSprite():
if health > 18000:

View File

@ -32,12 +32,12 @@ animations = [ {
"speed": 5.0
} ]
[sub_resource type="RectangleShape2D" id=4]
[sub_resource type="RectangleShape2D" id=2]
custom_solver_bias = 0.0
extents = Vector2( 414.127, 469.45 )
[sub_resource type="SpriteFrames" id=2]
[sub_resource type="SpriteFrames" id=3]
animations = [ {
"frames": [ 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 ), ExtResource( 21 ), ExtResource( 22 ) ],
@ -46,12 +46,12 @@ animations = [ {
"speed": 5.0
} ]
[sub_resource type="RectangleShape2D" id=3]
[sub_resource type="RectangleShape2D" id=4]
custom_solver_bias = 0.0
extents = Vector2( 404.313, 217.774 )
[node name="RectangleBoss" type="Area2D"]
[node name="RectangleBoss" type="Area2D" index="0"]
position = Vector2( 336.401, -1.22772 )
scale = Vector2( 0.25, 0.25 )
@ -60,10 +60,12 @@ gravity_vec = Vector2( 0, 1 )
gravity = 98.0
linear_damp = 0.1
angular_damp = 1.0
collision_layer = 2
collision_mask = 0
audio_bus_override = false
audio_bus_name = "Master"
script = ExtResource( 1 )
_sections_unfolded = [ "Transform" ]
_sections_unfolded = [ "Collision", "Transform" ]
Laser = ExtResource( 2 )
[node name="Inside" type="Area2D" parent="." index="0"]
@ -87,7 +89,7 @@ _sections_unfolded = [ "Transform" ]
position = Vector2( 3501.19, 1181.02 )
scale = Vector2( 1, 1.00835 )
shape = SubResource( 4 )
shape = SubResource( 2 )
[node name="Line2D" type="Line2D" parent="." index="1"]
@ -101,19 +103,19 @@ round_precision = 8
[node name="BigBadSprite" type="AnimatedSprite" parent="." index="2"]
position = Vector2( 3392, 1182 )
frames = SubResource( 2 )
frames = SubResource( 3 )
animation = "default"
_sections_unfolded = [ "Transform" ]
[node name="OutsideTopCollision" type="CollisionShape2D" parent="." index="3"]
position = Vector2( 3427.85, 491.096 )
shape = SubResource( 3 )
shape = SubResource( 4 )
[node name="OutsideBottomCollision" type="CollisionShape2D" parent="." index="4"]
position = Vector2( 3427.85, 1866.16 )
shape = SubResource( 3 )
shape = SubResource( 4 )
[connection signal="area_entered" from="Inside" to="." method="_on_Inside_area_entered"]

1
TODO
View File

@ -4,4 +4,5 @@
* A story mode?
* The main menu stars could do something silly and fun, like change colors,
maybe taking the menu colors with them.
* Purchasable Mothership upgrades (like turrets), and make all upgrades exponentially more expensive for higher tiers
* etc., etc.

38
Turret.gd Normal file
View File

@ -0,0 +1,38 @@
extends Node2D
var current_target
var can_shoot = true
func _ready():
pass
var zeroPoint = Vector2(-60, -1015)
func _process(delta):
pass
func entityEnteredRange(bad_id, bad, bad_shape, self_shape):
print(bad.get_name())
if ("Bad" in bad.get_name()) && can_shoot:
current_target = bad_id
#var local_pos = zeroPoint + area.position
var local_pos = Vector2()
local_pos = to_local(bad.position)
$Beam.set_point_position(1, local_pos)
$TurretSprite.rotation = ($Beam.get_point_position(0).angle_to($Beam.get_point_position(1))) + PI/5.3
print($Beam.get_point_position(0).angle_to($Beam.get_point_position(1)))
$Beam.default_color.a = 200
$TurretSprite.frame = 1
bad.hit("turret")
$FlashTimer.start()
can_shoot = false
func _on_FlashTimer_timeout():
$Beam.default_color.a = 0
$TurretSprite.frame = 0
pass # replace with function body
func _on_ReloadTimer_timeout():
can_shoot = true
pass # replace with function body

87
Turret.tscn Normal file
View File

@ -0,0 +1,87 @@
[gd_scene load_steps=6 format=2]
[ext_resource path="res://Turret.gd" type="Script" id=1]
[ext_resource path="res://art/turret/turret.png" type="Texture" id=2]
[ext_resource path="res://art/turret/shootin.png" type="Texture" id=3]
[sub_resource type="CircleShape2D" id=1]
custom_solver_bias = 0.0
radius = 32.0821
[sub_resource type="SpriteFrames" id=2]
animations = [ {
"frames": [ ExtResource( 2 ), ExtResource( 3 ) ],
"loop": true,
"name": "default",
"speed": 5.0
} ]
[node name="Turret" type="Node2D"]
script = ExtResource( 1 )
_sections_unfolded = [ "Material", "Pause", "Transform", "Visibility", "Z Index" ]
[node name="Beam" type="Line2D" parent="." index="0"]
position = Vector2( -26.6667, 6.66667 )
points = PoolVector2Array( 26.4234, -6.61987, 2000, 0 )
width = 10.0
default_color = Color( 1, 0, 0, 0 )
texture_mode = 31
sharp_limit = 2.0
round_precision = 8
[node name="Range" type="Area2D" parent="." index="1"]
position = Vector2( -51.824, -18.5961 )
scale = Vector2( 30.8534, 30.8534 )
input_pickable = true
gravity_vec = Vector2( 0, 1 )
gravity = 98.0
linear_damp = 0.1
angular_damp = 1.0
monitorable = false
collision_layer = 31
collision_mask = 31
audio_bus_override = false
audio_bus_name = "Master"
_sections_unfolded = [ "Collision" ]
__meta__ = {
"_edit_group_": true
}
[node name="RangeCircle" type="CollisionShape2D" parent="Range" index="0"]
shape = SubResource( 1 )
[node name="FlashTimer" type="Timer" parent="." index="2"]
process_mode = 1
wait_time = 0.15
one_shot = false
autostart = false
[node name="ReloadTimer" type="Timer" parent="." index="3"]
process_mode = 1
wait_time = 1.0
one_shot = false
autostart = true
[node name="TurretSprite" type="AnimatedSprite" parent="." index="4"]
rotation = 0.785398
scale = Vector2( 0.12, 0.12 )
frames = SubResource( 2 )
animation = "default"
_sections_unfolded = [ "Transform" ]
[connection signal="area_shape_entered" from="Range" to="." method="entityEnteredRange"]
[connection signal="timeout" from="FlashTimer" to="." method="_on_FlashTimer_timeout"]
[connection signal="timeout" from="ReloadTimer" to="." method="_on_ReloadTimer_timeout"]

View File

@ -22,31 +22,27 @@ extends Node
signal refund
signal speed_upgrade
signal bullet_delay_upgrade
signal ship_speed_upgrade
signal double_laser_upgrade
signal add_laser
signal plasma_lasers
signal menu_closed
signal change_color
signal taste_the_rainbow
var bullet_delay_tier
var shooting_speed_tier
var ship_speed_tier
var double_lasers
func _ready():
bullet_delay_tier = get_parent().bullet_delay_tier
$ShootingSpeedUpgrade/Icon.frame = bullet_delay_tier
ship_speed_tier = get_parent().ship_speed_tier
$ShipSpeedUpgrade/Icon.frame = ship_speed_tier
if get_tree().has_network_peer():
$ColorRect.color = Color(1,1,1,0.5)
else:
$ColorRect.color = Color(1,1,1,0.5)
$ColorRect.color = Color(0,0,0,1)
func _process(delta):
$ShootingSpeedUpgrade/Icon.frame = bullet_delay_tier
$ShipSpeedUpgrade/Icon.frame = ship_speed_tier
if (Input.is_action_pressed("ui_quit")):
get_tree().quit()
if Input.is_action_pressed("ui_accept"):
@ -59,9 +55,7 @@ func _on_Button_pressed():
func _on_Refund_pressed():
bullet_delay_tier = 0
ship_speed_tier = 0
$ShootingSpeedUpgrade/Icon.frame = 0
$ShipSpeedUpgrade/Icon.frame = 0
get_tree().paused = false
emit_signal("refund")
@ -70,12 +64,6 @@ func _on_ShootingSpeedUpgrade_pressed():
emit_signal("bullet_delay_upgrade")
bullet_delay_tier = get_parent().bullet_delay_tier
func _on_ShipSpeedUpgrade_pressed():
get_tree().paused = false
emit_signal("ship_speed_upgrade")
prints("UPGRADE SHIP SPEED SIGNAL EMITTED")
ship_speed_tier = get_parent().ship_speed_tier
func _on_DoubleLaserUpgrade_pressed():
get_tree().paused = false
emit_signal("double_laser_upgrade")
@ -108,3 +96,8 @@ func _on_DarkenedLawnGreen_pressed():
func _on_DeepSkyBlue_pressed():
emit_signal("change_color", "00bfff")
#### NOT PAUSING GAME? ####
func _on_Rainbow_pressed():
get_tree().paused = false
emit_signal("taste_the_rainbow")

View File

@ -66,6 +66,7 @@ mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
color = Color( 0, 0, 0, 1 )
_sections_unfolded = [ "Visibility" ]
[node name="Resume" type="Button" parent="." index="1"]
@ -153,10 +154,9 @@ animation = "default"
[node name="ShipSpeedUpgrade" type="Node" parent="." index="4"]
editor/display_folded = true
[node name="Button" type="Button" parent="ShipSpeedUpgrade" index="0"]
visible = false
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
@ -181,6 +181,7 @@ align = 1
[node name="Icon" type="AnimatedSprite" parent="ShipSpeedUpgrade" index="1"]
visible = false
position = Vector2( 530, 310 )
scale = Vector2( 0.392712, 0.392712 )
frames = SubResource( 3 )
@ -188,8 +189,6 @@ animation = "New Anim"
[node name="ColorSelect" type="Node2D" parent="." index="5"]
editor/display_folded = true
[node name="ColorSelectBG" type="Sprite" parent="ColorSelect" index="0"]
position = Vector2( 150, 210 )
@ -412,8 +411,33 @@ group = null
flat = true
align = 1
[node name="Rainbow" type="Button" parent="ColorSelect/ColorSelectBG" index="9"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = -501.0
margin_top = 668.0
margin_right = 501.0
margin_bottom = 1002.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
flat = true
align = 1
[node name="DoubleLaserUpgrade" type="Node2D" parent="." index="6"]
editor/display_folded = true
position = Vector2( -150, -10 )
__meta__ = {
"_edit_group_": true
@ -477,6 +501,8 @@ align = 1
[connection signal="pressed" from="ColorSelect/ColorSelectBG/DeepSkyBlue" to="." method="_on_DeepSkyBlue_pressed"]
[connection signal="pressed" from="ColorSelect/ColorSelectBG/Rainbow" to="." method="_on_Rainbow_pressed"]
[connection signal="pressed" from="DoubleLaserUpgrade/Button" to="." method="_on_DoubleLaserUpgrade_pressed"]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 205 KiB

BIN
art/bad/BlackHole/base.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
art/bad/BlackHole/half1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
art/bad/BlackHole/half2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
art/bad/prison/Prison.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

BIN
art/bad/prison/Star.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 196 KiB

BIN
art/drawn_bg1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

BIN
art/drawn_bg2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 867 KiB

BIN
art/interface/how_to.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
art/turret/shootin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
art/turret/turret.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 55 KiB

View File

@ -227,3 +227,31 @@ texture_format/etc2=false
binary_format/64_bits=true
custom_template/release=""
custom_template/debug=""
[preset.2]
name="Windows Desktop"
platform="Windows Desktop"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
patch_list=PoolStringArray( )
[preset.2.options]
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
binary_format/64_bits=true
custom_template/release=""
custom_template/debug=""
application/icon=""
application/file_version=""
application/product_version=""
application/company_name=""
application/product_name=""
application/file_description=""
application/copyright=""
application/trademarks=""