Multiplayer groundwork has started, among other sizeable art, balance,
and design changes
3
Bad1.gd
|
@ -4,6 +4,7 @@ signal dead
|
|||
export (int) var SPEED
|
||||
export (PackedScene) var Laser
|
||||
var screensize
|
||||
var health_multi = 1
|
||||
|
||||
# class member variables go here, for example:
|
||||
# var a = 2
|
||||
|
@ -21,7 +22,7 @@ func _ready():
|
|||
|
||||
|
||||
func hit(who):
|
||||
health -= 10
|
||||
health -= 10/health_multi
|
||||
$AnimatedSprite.frame = 1
|
||||
hit_timer = 0
|
||||
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
extends Area2D
|
||||
|
||||
signal dead
|
||||
export (int) var SPEED
|
||||
export (PackedScene) var Laser
|
||||
var screensize
|
||||
var fire_speed = 15
|
||||
var health = 400
|
||||
var hit_timer = 1000
|
||||
var can_shoot = true
|
||||
var health_multi = 1
|
||||
|
||||
func _on_Visibility_screen_exited():
|
||||
prints("bye-bye, bad bad")
|
||||
queue_free()
|
||||
|
||||
func _ready():
|
||||
connect("area_entered", self, "hit")
|
||||
$Rotatable.rotation_degrees = -90
|
||||
|
||||
|
||||
func hit(who):
|
||||
health -= 10/health_multi
|
||||
$AnimatedSprite.frame = 1
|
||||
hit_timer = 0
|
||||
|
||||
var velocity = Vector2()
|
||||
|
||||
func _process(delta):
|
||||
if health <= 0:
|
||||
emit_signal("dead", 200)
|
||||
queue_free()
|
||||
|
||||
$Rotatable.rotation_degrees += delta*fire_speed
|
||||
|
||||
if ($Rotatable.rotation_degrees > 45 && $Rotatable.rotation_degrees < 55 && can_shoot == true):
|
||||
can_shoot = false
|
||||
shoot()
|
||||
|
||||
elif ($Rotatable.rotation_degrees > 135 && $Rotatable.rotation_degrees < 145 && can_shoot == true):
|
||||
can_shoot = false
|
||||
shoot()
|
||||
|
||||
elif ($Rotatable.rotation_degrees > 225 && $Rotatable.rotation_degrees < 235 && can_shoot == true):
|
||||
can_shoot = false
|
||||
shoot()
|
||||
|
||||
elif ($Rotatable.rotation_degrees > 315 && $Rotatable.rotation_degrees < 325 && can_shoot == true):
|
||||
can_shoot = false
|
||||
shoot()
|
||||
|
||||
elif ( $Rotatable.rotation_degrees > 55 && $Rotatable.rotation_degrees < 60):
|
||||
can_shoot = true
|
||||
elif ( $Rotatable.rotation_degrees > 145 && $Rotatable.rotation_degrees < 150):
|
||||
can_shoot = true
|
||||
elif ( $Rotatable.rotation_degrees > 235 && $Rotatable.rotation_degrees < 235):
|
||||
can_shoot = true
|
||||
elif ( $Rotatable.rotation_degrees > 325 && $Rotatable.rotation_degrees < 325):
|
||||
can_shoot = true
|
||||
|
||||
if $Rotatable.rotation_degrees > 360:
|
||||
$Rotatable.rotation_degrees = 0
|
||||
can_shoot = true
|
||||
|
||||
|
||||
if hit_timer < 0.15:
|
||||
hit_timer += delta
|
||||
if health < 100:
|
||||
fire_speed = 75
|
||||
elif hit_timer < 0.25:
|
||||
hit_timer += delta
|
||||
velocity.x -= 1
|
||||
else:
|
||||
velocity.x -= 1
|
||||
$AnimatedSprite.frame = 0
|
||||
|
||||
if velocity.length() > 0:
|
||||
velocity = velocity.normalized() * SPEED
|
||||
|
||||
var health_bar = Vector2(((health * 3.75) - 750), -1100)
|
||||
$Line2D.set_point_position( 1, health_bar )
|
||||
|
||||
position += velocity * delta
|
||||
|
||||
func shoot():
|
||||
var laser = Laser.instance()
|
||||
get_node("../").add_child(laser)
|
||||
laser.friendly_laser = false
|
||||
laser.rotation_degrees = 180
|
||||
laser.position.y = position.y - 10
|
||||
laser.position.x = position.x - 170
|
|
@ -0,0 +1,89 @@
|
|||
[gd_scene load_steps=8 format=2]
|
||||
|
||||
[ext_resource path="res://BadLaser.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Laser.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://art/bad/laser/bad_laser_stationary.png" type="Texture" id=3]
|
||||
[ext_resource path="res://art/bad/laser/bad_laser_rotatable.png" type="Texture" id=4]
|
||||
|
||||
[sub_resource type="SpriteFrames" id=1]
|
||||
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 3 ) ],
|
||||
"loop": true,
|
||||
"name": "New Anim",
|
||||
"speed": 5.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="SpriteFrames" id=2]
|
||||
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 4 ) ],
|
||||
"loop": true,
|
||||
"name": "default",
|
||||
"speed": 5.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="CircleShape2D" id=3]
|
||||
|
||||
custom_solver_bias = 0.0
|
||||
radius = 867.264
|
||||
|
||||
[node name="BadLaser" type="Area2D"]
|
||||
|
||||
position = Vector2( 947.34, 293.528 )
|
||||
scale = Vector2( 0.07, 0.07 )
|
||||
z_index = -1
|
||||
input_pickable = true
|
||||
gravity_vec = Vector2( 0, 1 )
|
||||
gravity = 98.0
|
||||
linear_damp = 0.1
|
||||
angular_damp = 1.0
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
audio_bus_override = false
|
||||
audio_bus_name = "Master"
|
||||
script = ExtResource( 1 )
|
||||
_sections_unfolded = [ "Collision", "Transform", "Z Index" ]
|
||||
SPEED = 20
|
||||
Laser = ExtResource( 2 )
|
||||
|
||||
[node name="BlinkTimer" type="Timer" parent="." index="0"]
|
||||
|
||||
process_mode = 1
|
||||
wait_time = 1.0
|
||||
one_shot = false
|
||||
autostart = false
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="." index="1"]
|
||||
|
||||
frames = SubResource( 1 )
|
||||
animation = "New Anim"
|
||||
|
||||
[node name="Rotatable" type="AnimatedSprite" parent="." index="2"]
|
||||
|
||||
frames = SubResource( 2 )
|
||||
animation = "default"
|
||||
_sections_unfolded = [ "Transform" ]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="3"]
|
||||
|
||||
position = Vector2( 0, -14.2857 )
|
||||
shape = SubResource( 3 )
|
||||
|
||||
[node name="Line2D" type="Line2D" parent="." index="4"]
|
||||
|
||||
position = Vector2( 9.15527e-05, 33.3334 )
|
||||
points = PoolVector2Array( -750, -1100, 143, -1100 )
|
||||
width = 40.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
|
||||
_sections_unfolded = [ "Capping" ]
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_Bad1_body_entered"]
|
||||
|
||||
|
5
Bloob.gd
|
@ -3,6 +3,7 @@ extends Area2D
|
|||
signal dead
|
||||
export (int) var SPEED
|
||||
var screensize
|
||||
var health_multi = 1
|
||||
|
||||
# class member variables go here, for example:
|
||||
# var a = 2
|
||||
|
@ -18,7 +19,7 @@ func _on_Visibility_screen_exited():
|
|||
queue_free()
|
||||
|
||||
func hit(who):
|
||||
health -= 10
|
||||
health -= 10/health_multi
|
||||
# $AnimatedSprite.frame = 1
|
||||
hit_timer = 0
|
||||
|
||||
|
@ -26,7 +27,7 @@ var velocity = Vector2()
|
|||
|
||||
func _process(delta):
|
||||
if health <= 0:
|
||||
emit_signal("dead", 30)
|
||||
emit_signal("dead", 50)
|
||||
queue_free()
|
||||
|
||||
if hit_timer < 0.15:
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://Node.gd" type="Script" id=1]
|
||||
[ext_resource path="res://art/gameover.png" type="Texture" id=2]
|
||||
[ext_resource path="res://art/restart.png" type="Texture" id=3]
|
||||
[ext_resource path="res://art/restart_hover.png" type="Texture" id=4]
|
||||
|
||||
[sub_resource type="SpriteFrames" id=1]
|
||||
|
||||
|
@ -12,30 +14,62 @@ animations = [ {
|
|||
"speed": 5.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="SpriteFrames" id=2]
|
||||
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 3 ), ExtResource( 4 ) ],
|
||||
"loop": true,
|
||||
"name": "default",
|
||||
"speed": 5.0
|
||||
} ]
|
||||
|
||||
[node name="Node" type="Node"]
|
||||
|
||||
pause_mode = 2
|
||||
script = ExtResource( 1 )
|
||||
_sections_unfolded = [ "Pause" ]
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="." index="0"]
|
||||
[node name="ColorRect" type="ColorRect" parent="." index="0"]
|
||||
|
||||
position = Vector2( 524.951, 264.196 )
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 1025.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 )
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="." index="1"]
|
||||
|
||||
position = Vector2( 467.672, 255.152 )
|
||||
scale = Vector2( 0.457698, 0.457698 )
|
||||
z_index = 1
|
||||
frames = SubResource( 1 )
|
||||
animation = "default"
|
||||
_sections_unfolded = [ "Z Index" ]
|
||||
|
||||
[node name="Button" type="Button" parent="." index="1"]
|
||||
[node name="Restart" type="AnimatedSprite" parent="." index="2"]
|
||||
|
||||
position = Vector2( 702.774, 515.898 )
|
||||
scale = Vector2( 0.605426, 0.605426 )
|
||||
frames = SubResource( 2 )
|
||||
animation = "default"
|
||||
|
||||
[node name="Button" type="Button" parent="." index="3"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 490.0
|
||||
margin_top = 480.0
|
||||
margin_right = 690.0
|
||||
margin_left = 516.0
|
||||
margin_top = 439.0
|
||||
margin_right = 889.0
|
||||
margin_bottom = 561.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
|
@ -48,10 +82,11 @@ toggle_mode = false
|
|||
enabled_focus_mode = 2
|
||||
shortcut = null
|
||||
group = null
|
||||
text = "Restart?"
|
||||
flat = false
|
||||
flat = true
|
||||
align = 1
|
||||
|
||||
[connection signal="button_down" from="Button" to="." method="_on_Button_button_down"]
|
||||
|
||||
[connection signal="pressed" from="Button" to="." method="_on_Button_pressed"]
|
||||
|
||||
|
||||
|
|
8
Laser.gd
|
@ -6,6 +6,7 @@ export (int) var SPEED
|
|||
export (int) var DAMAGE
|
||||
var plasma = false
|
||||
var current_pen = 0
|
||||
var friendly_laser = true
|
||||
|
||||
func _on_Visibility_screen_exited():
|
||||
prints("byebye laser boi")
|
||||
|
@ -17,7 +18,7 @@ func _ready():
|
|||
pass
|
||||
|
||||
func hit(who):
|
||||
|
||||
prints(who)
|
||||
if plasma == true:
|
||||
pass
|
||||
elif current_pen > 0:
|
||||
|
@ -28,7 +29,10 @@ func hit(who):
|
|||
|
||||
func _process(delta):
|
||||
var velocity = Vector2()
|
||||
velocity.x += 1
|
||||
if friendly_laser == true:
|
||||
velocity.x += 1
|
||||
else:
|
||||
velocity.x -= 1
|
||||
velocity = velocity.normalized() * SPEED
|
||||
position += velocity * delta
|
||||
|
||||
|
|
|
@ -26,12 +26,12 @@ gravity_vec = Vector2( 0, 1 )
|
|||
gravity = 98.0
|
||||
linear_damp = 0.1
|
||||
angular_damp = 1.0
|
||||
collision_layer = 3
|
||||
collision_mask = 3
|
||||
collision_layer = 7
|
||||
collision_mask = 7
|
||||
audio_bus_override = false
|
||||
audio_bus_name = "Master"
|
||||
script = ExtResource( 1 )
|
||||
_sections_unfolded = [ "Collision" ]
|
||||
_sections_unfolded = [ "Collision", "Z Index" ]
|
||||
SPEED = 1200
|
||||
DAMAGE = 10
|
||||
|
||||
|
@ -40,7 +40,7 @@ DAMAGE = 10
|
|||
position = Vector2( 28, -5 )
|
||||
rotation = 1.5708
|
||||
shape = SubResource( 1 )
|
||||
_sections_unfolded = [ "Transform" ]
|
||||
_sections_unfolded = [ "Transform", "Z Index" ]
|
||||
__meta__ = {
|
||||
"_edit_group_": true
|
||||
}
|
||||
|
|
77
Main.gd
|
@ -2,22 +2,37 @@ extends Node
|
|||
|
||||
export (PackedScene) var FirstBad
|
||||
export (PackedScene) var BlobBad
|
||||
export (PackedScene) var LaserBad
|
||||
|
||||
var position = Vector2(200, 200)
|
||||
var total_bads_spawned = 0
|
||||
var upgrade_cost = 50
|
||||
var booting = true
|
||||
var rectangle_opacity = 1
|
||||
|
||||
const BADDIE_WAIT_TIME_DEFAULT = 5
|
||||
|
||||
remote func move_player(id, position):
|
||||
prints("MAIN SAYS:", id, position)
|
||||
pass
|
||||
|
||||
func _ready():
|
||||
var mainmenu = preload("res://MainMenu.tscn").instance()
|
||||
add_child(mainmenu)
|
||||
mainmenu.connect("multiplayer_menu", self, "_open_multiplayer_menu")
|
||||
get_tree().paused = true
|
||||
$BaddieTimer.wait_time = BADDIE_WAIT_TIME_DEFAULT
|
||||
$BaddieTimer.start()
|
||||
randomize()
|
||||
updatePoints()
|
||||
|
||||
var touchy_shooty = false
|
||||
|
||||
func _open_multiplayer_menu():
|
||||
var multiplayer = preload("res://Networking.tscn").instance()
|
||||
add_child(multiplayer)
|
||||
get_tree().paused = true
|
||||
|
||||
func _process(delta):
|
||||
if (Input.is_action_pressed("ctlr_l")):
|
||||
if (Input.is_action_pressed("ctlr_r")):
|
||||
|
@ -27,32 +42,55 @@ func _process(delta):
|
|||
if (Input.is_action_pressed("ui_quit")):
|
||||
get_tree().quit()
|
||||
updatePoints()
|
||||
|
||||
if (touchy_feely && (abs(touchy_feely.position.x - $Player.position.x) > 1)):
|
||||
if (touchy_feely.position.x < 800):
|
||||
$Player.moveto(touchy_feely.position)
|
||||
|
||||
if (touchy_shooty && $Player.can_shoot):
|
||||
$Player.shoot()
|
||||
|
||||
if booting == true:
|
||||
$ColorRect.color = Color(0, 0, 0, rectangle_opacity)
|
||||
rectangle_opacity -= delta/1.25
|
||||
if rectangle_opacity <= 0:
|
||||
booting = false
|
||||
$ColorRect.visible = false
|
||||
|
||||
func _on_bad_death(kill_money):
|
||||
$Player.money += kill_money
|
||||
updatePoints()
|
||||
|
||||
var sendblob = 0
|
||||
var a_round_of_bads = 20
|
||||
var sendblob = 1
|
||||
var bad_health_multi = 1
|
||||
func BaddieTimer():
|
||||
if total_bads_spawned < 11:
|
||||
if total_bads_spawned <= a_round_of_bads:
|
||||
var bad
|
||||
|
||||
if sendblob == 5:
|
||||
sendblob = 0
|
||||
if sendblob%20 == 0:
|
||||
bad = LaserBad.instance()
|
||||
sendblob += 1
|
||||
elif sendblob%5 == 0:
|
||||
bad = BlobBad.instance()
|
||||
sendblob += 1
|
||||
else:
|
||||
bad = FirstBad.instance()
|
||||
sendblob += 1
|
||||
|
||||
add_child(bad)
|
||||
bad.connect("dead", self, "_on_bad_death")
|
||||
bad.health_multi = bad_health_multi
|
||||
|
||||
total_bads_spawned += 1
|
||||
$BaddieTimer.wait_time = $BaddieTimer.wait_time * 0.97
|
||||
if $BaddieTimer.wait_time > 0.5:
|
||||
$BaddieTimer.wait_time = $BaddieTimer.wait_time * 0.99
|
||||
if total_bads_spawned == a_round_of_bads:
|
||||
bad_health_multi *= 1.5
|
||||
|
||||
updatePoints()
|
||||
|
||||
bad.position.x = 1200
|
||||
bad.position.y = (randi()%470) + 40
|
||||
bad.position.y = (randi()%410) + 50
|
||||
else:
|
||||
total_bads_spawned = 0
|
||||
|
||||
|
@ -66,12 +104,35 @@ func _on_Player_update_display():
|
|||
updatePoints()
|
||||
|
||||
func _on_Mothership_game_over():
|
||||
$ShootButton.visible = false
|
||||
$Player.gameOver()
|
||||
|
||||
|
||||
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
|
||||
$BaddieTimer.wait_time = BADDIE_WAIT_TIME_DEFAULT
|
||||
$ShootButton.visible = true
|
||||
|
||||
var touchy_feely
|
||||
|
||||
#func _input(event):
|
||||
# if (event is InputEventScreenTouch || event is InputEventScreenDrag):
|
||||
# if event.position.x < 800:
|
||||
# touchy_feely = event
|
||||
# prints(event.index)
|
||||
# else:
|
||||
# touchy_shooty = true
|
||||
#
|
||||
|
||||
var touchscreen_on = false
|
||||
func _input(event):
|
||||
if (event is InputEventScreenTouch || event is InputEventScreenDrag):
|
||||
touchscreen_on = true
|
||||
if event.position.x < 800: #&& (abs (event.position.y - $Player.position.y) < 100) :
|
||||
$Player.position.x = event.position.x + 100*(event.position.x/800)
|
||||
$Player.position.y = event.position.y - 100
|
||||
prints(event.index)
|
||||
else:
|
||||
touchy_shooty = true
|
139
Main.tscn
|
@ -1,13 +1,15 @@
|
|||
[gd_scene load_steps=8 format=2]
|
||||
[gd_scene load_steps=11 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://art/bg.png" type="Texture" id=4]
|
||||
[ext_resource path="res://Player.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://Mothership.tscn" type="PackedScene" id=6]
|
||||
[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]
|
||||
|
||||
[sub_resource type="ImageTexture" id=2]
|
||||
[sub_resource type="ImageTexture" id=1]
|
||||
|
||||
flags = 7
|
||||
storage = 0
|
||||
|
@ -15,25 +17,35 @@ lossy_quality = 0.7
|
|||
flags = 7
|
||||
size = Vector2( 0, 0 )
|
||||
|
||||
[node name="Main" type="Node" index="0"]
|
||||
[sub_resource type="SpriteFrames" id=2]
|
||||
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 8 ) ],
|
||||
"loop": true,
|
||||
"name": "default",
|
||||
"speed": 5.0
|
||||
} ]
|
||||
|
||||
[node name="Main" type="Node"]
|
||||
|
||||
script = ExtResource( 1 )
|
||||
_sections_unfolded = [ "Pause" ]
|
||||
FirstBad = ExtResource( 2 )
|
||||
BlobBad = ExtResource( 3 )
|
||||
LaserBad = ExtResource( 4 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="." index="0"]
|
||||
|
||||
z_index = -5
|
||||
texture = SubResource( 2 )
|
||||
texture = SubResource( 1 )
|
||||
_sections_unfolded = [ "Z Index" ]
|
||||
|
||||
[node name="bg" type="Sprite" parent="Sprite" index="0"]
|
||||
|
||||
position = Vector2( 544.657, 347.107 )
|
||||
texture = ExtResource( 4 )
|
||||
texture = ExtResource( 5 )
|
||||
|
||||
[node name="Player" parent="." index="1" instance=ExtResource( 5 )]
|
||||
[node name="Player" parent="." index="1" instance=ExtResource( 6 )]
|
||||
|
||||
[node name="BaddieTimer" type="Timer" parent="." index="2"]
|
||||
|
||||
|
@ -42,7 +54,9 @@ wait_time = 1.0
|
|||
one_shot = false
|
||||
autostart = false
|
||||
|
||||
[node name="Mothership" parent="." index="3" instance=ExtResource( 6 )]
|
||||
[node name="Mothership" parent="." index="3" instance=ExtResource( 7 )]
|
||||
|
||||
position = Vector2( 18.327, 304.835 )
|
||||
|
||||
[node name="Line2D" type="Line2D" parent="Mothership" index="2"]
|
||||
|
||||
|
@ -62,10 +76,10 @@ anchor_left = 0.0
|
|||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 919.0
|
||||
margin_top = 4.0
|
||||
margin_right = 1012.0
|
||||
margin_bottom = 35.0
|
||||
margin_left = 913.0
|
||||
margin_top = 536.0
|
||||
margin_right = 1006.0
|
||||
margin_bottom = 571.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
mouse_filter = 2
|
||||
|
@ -77,64 +91,16 @@ align = 2
|
|||
percent_visible = 1.0
|
||||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
_sections_unfolded = [ "custom_fonts" ]
|
||||
_sections_unfolded = [ "Size Flags", "custom_fonts" ]
|
||||
|
||||
[node name="UpButton" type="Button" parent="." index="5"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_top = -1.0
|
||||
margin_right = 205.0
|
||||
margin_bottom = 295.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
|
||||
_sections_unfolded = [ "Visibility" ]
|
||||
|
||||
[node name="DownButton" type="Button" parent="." index="6"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_top = 294.0
|
||||
margin_right = 190.0
|
||||
margin_bottom = 600.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
|
||||
_sections_unfolded = [ "Visibility" ]
|
||||
|
||||
[node name="ShootButton" type="Button" parent="." index="7"]
|
||||
[node name="ShootButton" type="Button" parent="." index="5"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 785.0
|
||||
margin_top = 375.0
|
||||
margin_top = 125.0
|
||||
margin_right = 1022.0
|
||||
margin_bottom = 599.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
|
@ -144,6 +110,7 @@ mouse_filter = 0
|
|||
mouse_default_cursor_shape = 0
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
disabled = true
|
||||
toggle_mode = false
|
||||
enabled_focus_mode = 2
|
||||
shortcut = null
|
||||
|
@ -152,16 +119,16 @@ flat = true
|
|||
align = 1
|
||||
_sections_unfolded = [ "Theme" ]
|
||||
|
||||
[node name="PauseButton" type="Button" parent="." index="8"]
|
||||
[node name="PauseButton" type="Button" parent="." index="6"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 944.0
|
||||
margin_left = 940.0
|
||||
margin_top = 36.0
|
||||
margin_right = 1001.0
|
||||
margin_bottom = 93.0
|
||||
margin_bottom = 100.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
focus_mode = 2
|
||||
|
@ -173,13 +140,33 @@ toggle_mode = false
|
|||
enabled_focus_mode = 2
|
||||
shortcut = null
|
||||
group = null
|
||||
text = "||"
|
||||
flat = false
|
||||
flat = true
|
||||
align = 1
|
||||
|
||||
[connection signal="body_entered" from="Player" to="Player" method="_on_Player_body_entered"]
|
||||
[node name="ColorRect" type="ColorRect" parent="." index="7"]
|
||||
|
||||
[connection signal="refund" from="Player" to="." method="_on_Player_refund"]
|
||||
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 )
|
||||
|
||||
[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"
|
||||
|
||||
[connection signal="body_entered" from="Player" to="Player" method="_on_Player_body_entered"]
|
||||
|
||||
[connection signal="restart_game" from="Player" to="Mothership" method="_on_Player_restart_game"]
|
||||
|
||||
|
@ -195,14 +182,6 @@ align = 1
|
|||
|
||||
[connection signal="game_over" from="Mothership" to="." method="_on_Mothership_game_over"]
|
||||
|
||||
[connection signal="button_down" from="UpButton" to="Player" method="upPressed"]
|
||||
|
||||
[connection signal="button_up" from="UpButton" to="Player" method="upDepressed"]
|
||||
|
||||
[connection signal="button_down" from="DownButton" to="Player" method="downPressed"]
|
||||
|
||||
[connection signal="button_up" from="DownButton" to="Player" method="downDepressed"]
|
||||
|
||||
[connection signal="button_down" from="ShootButton" to="Player" method="shootDown"]
|
||||
|
||||
[connection signal="button_up" from="ShootButton" to="Player" method="shootUp"]
|
||||
|
|
36
MainMenu.gd
|
@ -1,25 +1,33 @@
|
|||
extends Node
|
||||
|
||||
signal multiplayer_menu
|
||||
|
||||
var clockwise = false
|
||||
var rotation_multiplier = 1
|
||||
const PEAK_ANGLE = -15
|
||||
const TROUGH_ANGLE = -5
|
||||
const SLOW_ROTATION = 0.8
|
||||
const REGULAR_ROTATION = 1
|
||||
var now_quitting = false
|
||||
var rectangle_opacity = 0
|
||||
|
||||
func _ready():
|
||||
$Music.play()
|
||||
pass
|
||||
|
||||
func _process(delta):
|
||||
# if clockwise == true:
|
||||
# $Ship.rotation_degrees += (($Ship.rotation_degrees - TROUGH_ANGLE)*delta*0.2) + (delta/10)
|
||||
# if $Ship.rotation_degrees < TROUGH_ANGLE:
|
||||
# clockwise = false
|
||||
if now_quitting == true:
|
||||
$ColorRect.color = Color(0, 0, 0, rectangle_opacity)
|
||||
# if rectangle_opacity < 0.75:
|
||||
rectangle_opacity += delta/2
|
||||
$Music.volume_db -= delta*20
|
||||
# else:
|
||||
# $Ship.rotation_degrees -= (($Ship.rotation_degrees - PEAK_ANGLE)*delta*0.2) + (delta/10)
|
||||
# if $Ship.rotation_degrees > PEAK_ANGLE:
|
||||
# clockwise = true
|
||||
# rectangle_opacity += delta/4
|
||||
if rectangle_opacity >= 1:
|
||||
get_tree().paused = false
|
||||
queue_free()
|
||||
|
||||
if (Input.is_action_pressed("ui_quit")):
|
||||
get_tree().quit()
|
||||
|
||||
if ($Ship.rotation_degrees > -7 || $Ship.rotation_degrees < -13):
|
||||
rotation_multiplier = SLOW_ROTATION
|
||||
|
@ -34,8 +42,14 @@ func _process(delta):
|
|||
$Ship.rotation_degrees -= delta
|
||||
if $Ship.rotation_degrees < PEAK_ANGLE:
|
||||
clockwise = true
|
||||
|
||||
#if Input.is_action_pressed("ui_accept"):
|
||||
# _on_Button_pressed()
|
||||
|
||||
func _on_Button_pressed():
|
||||
get_tree().paused = false
|
||||
queue_free()
|
||||
pass # replace with function body
|
||||
#$Button.visible = false
|
||||
now_quitting = true
|
||||
|
||||
|
||||
func _on_Multiplayer_pressed():
|
||||
emit_signal("multiplayer_menu")
|
|
@ -1,9 +1,10 @@
|
|||
[gd_scene load_steps=7 format=2]
|
||||
[gd_scene load_steps=9 format=2]
|
||||
|
||||
[ext_resource path="res://MainMenu.gd" type="Script" id=1]
|
||||
[ext_resource path="res://mainmenu.png" type="Texture" id=2]
|
||||
[ext_resource path="res://menu_music.ogg" type="AudioStream" id=3]
|
||||
[ext_resource path="res://art/player/Rocket1.png" type="Texture" id=4]
|
||||
[ext_resource path="res://menu_button.png" type="Texture" id=5]
|
||||
|
||||
[sub_resource type="SpriteFrames" id=1]
|
||||
|
||||
|
@ -23,6 +24,15 @@ animations = [ {
|
|||
"speed": 5.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="SpriteFrames" id=3]
|
||||
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 5 ) ],
|
||||
"loop": true,
|
||||
"name": "default",
|
||||
"speed": 5.0
|
||||
} ]
|
||||
|
||||
[node name="Node" type="Node"]
|
||||
|
||||
pause_mode = 2
|
||||
|
@ -43,6 +53,7 @@ volume_db = 0.0
|
|||
autoplay = false
|
||||
mix_target = 0
|
||||
bus = "Master"
|
||||
_sections_unfolded = [ "Pause" ]
|
||||
|
||||
[node name="Ship" type="AnimatedSprite" parent="." index="2"]
|
||||
|
||||
|
@ -53,7 +64,23 @@ frames = SubResource( 2 )
|
|||
animation = "default"
|
||||
_sections_unfolded = [ "Transform" ]
|
||||
|
||||
[node name="Button" type="Button" parent="." index="3"]
|
||||
[node name="ColorRect" type="ColorRect" parent="." index="3"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 1020.0
|
||||
margin_bottom = 600.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, 0 )
|
||||
|
||||
[node name="StartEndlessMode" type="Button" parent="." index="4"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
|
@ -76,7 +103,42 @@ shortcut = null
|
|||
group = null
|
||||
flat = true
|
||||
align = 1
|
||||
_sections_unfolded = [ "Material", "Visibility" ]
|
||||
|
||||
[connection signal="pressed" from="Button" to="." method="_on_Button_pressed"]
|
||||
[node name="Menubutton" type="AnimatedSprite" parent="." index="5"]
|
||||
|
||||
position = Vector2( 925, 288 )
|
||||
scale = Vector2( 0.4, 0.4 )
|
||||
frames = SubResource( 3 )
|
||||
animation = "default"
|
||||
_sections_unfolded = [ "Transform" ]
|
||||
|
||||
[node name="Multiplayer" type="Button" parent="." index="6"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 860.0
|
||||
margin_top = 220.0
|
||||
margin_right = 980.0
|
||||
margin_bottom = 360.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
|
||||
|
||||
[connection signal="pressed" from="StartEndlessMode" to="." method="_on_Button_pressed"]
|
||||
|
||||
[connection signal="pressed" from="Multiplayer" to="." method="_on_Multiplayer_pressed"]
|
||||
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ gravity_vec = Vector2( 0, 1 )
|
|||
gravity = 98.0
|
||||
linear_damp = 0.1
|
||||
angular_damp = 1.0
|
||||
collision_layer = 3
|
||||
collision_mask = 3
|
||||
collision_layer = 31
|
||||
collision_mask = 31
|
||||
audio_bus_override = false
|
||||
audio_bus_name = "Master"
|
||||
script = ExtResource( 1 )
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
extends Area2D
|
||||
|
||||
var my_ip
|
||||
var peer
|
||||
var player_info = {}
|
||||
var my_info = { name = "", color = Color8(255, 0, 255) }
|
||||
var server_ip
|
||||
|
||||
func _ready():
|
||||
my_ip = IP.get_local_addresses()[1]
|
||||
prints(my_ip)
|
||||
$YourIP.text = str("Your IP address:", my_ip)
|
||||
get_tree().connect("network_peer_connected", self, "_player_connected")
|
||||
get_tree().connect("network_peer_disconnected", self, "_player_disconnected")
|
||||
get_tree().connect("connected_to_server", self, "_connected_ok")
|
||||
get_tree().connect("connection_failed", self, "_connected_fail")
|
||||
get_tree().connect("server_disconnected", self, "_server_disconnected")
|
||||
get_tree().paused = true
|
||||
|
||||
func _on_Server_pressed():
|
||||
peer = NetworkedMultiplayerENet.new()
|
||||
peer.create_server(6969, 8)
|
||||
get_tree().set_network_peer(peer)
|
||||
get_tree().set_meta("network_peer", peer)
|
||||
prints(get_tree().is_network_server())
|
||||
prints(get_tree().has_network_peer())
|
||||
prints(my_info)
|
||||
|
||||
func _on_Client_pressed():
|
||||
peer = NetworkedMultiplayerENet.new()
|
||||
peer.create_client(server_ip, 6969)
|
||||
get_tree().set_network_peer(peer)
|
||||
get_tree().set_meta("network_peer", peer)
|
||||
prints(get_tree().is_network_server())
|
||||
prints(get_tree().has_network_peer())
|
||||
|
||||
func _player_connected(id):
|
||||
prints("AYYYYYYYYY ", id)
|
||||
|
||||
func _player_disconnected(id):
|
||||
prints("OH NO ", id)
|
||||
player_info.erase(id) # Erase player from info
|
||||
|
||||
func _connected_ok():
|
||||
# Only called on clients, not server. Send my ID and info to all the other peers
|
||||
rpc("register_player", get_tree().get_network_unique_id(), my_info)
|
||||
|
||||
func _server_disconnected():
|
||||
pass # Server kicked us, show error and abort
|
||||
|
||||
func _connected_fail():
|
||||
pass # Could not even connect to server, abort
|
||||
|
||||
remote func register_player(id, info):
|
||||
player_info[id] = info
|
||||
if get_tree().is_network_server():
|
||||
# Send my info to new player
|
||||
rpc_id(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])
|
||||
prints(player_info[id], id)
|
||||
|
||||
# Call function to update lobby UI
|
||||
|
||||
func _on_BackToMain_pressed():
|
||||
prints("YEETUS")
|
||||
hide()
|
||||
|
||||
func _on_UsernameEntry_text_changed(new_text):
|
||||
my_info = {name = new_text, color = my_info.color}
|
||||
$UsernameLabel.text = str("Your netname is \"", new_text, "\"")
|
||||
|
||||
func _on_Server_Entry_text_changed(new_text):
|
||||
server_ip = new_text
|
||||
|
||||
func _on_UsernameEntry_text_entered(new_text):
|
||||
my_info = {name = new_text, color = my_info.color}
|
||||
$UsernameLabel.text = str("Your netname is \"", new_text, "\"")
|
||||
|
||||
func _on_Server_Entry_text_entered(new_text):
|
||||
server_ip = new_text
|
|
@ -0,0 +1,253 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[sub_resource type="BitmapFont" id=1]
|
||||
|
||||
textures = [ ]
|
||||
chars = PoolIntArray( )
|
||||
kernings = PoolIntArray( )
|
||||
height = 1.0
|
||||
ascent = 0.0
|
||||
distance_field = false
|
||||
|
||||
[sub_resource type="BitmapFont" id=2]
|
||||
|
||||
textures = [ ]
|
||||
chars = PoolIntArray( )
|
||||
kernings = PoolIntArray( )
|
||||
height = 1.0
|
||||
ascent = 0.0
|
||||
distance_field = false
|
||||
|
||||
[node name="Node" type="Node"]
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="." index="0"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = -3.0
|
||||
margin_top = -1.0
|
||||
margin_right = 1028.0
|
||||
margin_bottom = 619.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="Server" type="Button" parent="." index="1"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 118.0
|
||||
margin_top = 69.0
|
||||
margin_right = 382.0
|
||||
margin_bottom = 282.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
|
||||
text = "Server"
|
||||
flat = false
|
||||
align = 1
|
||||
|
||||
[node name="Client" type="Button" parent="." index="2"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 548.0
|
||||
margin_top = 283.0
|
||||
margin_right = 785.0
|
||||
margin_bottom = 416.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
|
||||
text = "Client"
|
||||
flat = false
|
||||
align = 1
|
||||
|
||||
[node name="Name" type="Button" parent="." index="3"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 196.0
|
||||
margin_top = 456.0
|
||||
margin_right = 295.0
|
||||
margin_bottom = 532.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
|
||||
text = "Name"
|
||||
flat = false
|
||||
align = 1
|
||||
|
||||
[node name="UsernameEntry" type="LineEdit" parent="." index="4"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 518.0
|
||||
margin_top = 464.0
|
||||
margin_right = 721.0
|
||||
margin_bottom = 490.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
focus_mode = 2
|
||||
mouse_filter = 0
|
||||
mouse_default_cursor_shape = 1
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
focus_mode = 2
|
||||
context_menu_enabled = true
|
||||
placeholder_text = "Enter username"
|
||||
placeholder_alpha = 0.6
|
||||
caret_blink = false
|
||||
caret_blink_speed = 0.65
|
||||
caret_position = 0
|
||||
_sections_unfolded = [ "Placeholder" ]
|
||||
|
||||
[node name="Server Entry" type="LineEdit" parent="." index="5"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 518.0
|
||||
margin_top = 502.0
|
||||
margin_right = 721.0
|
||||
margin_bottom = 528.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
focus_mode = 2
|
||||
mouse_filter = 0
|
||||
mouse_default_cursor_shape = 1
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
focus_mode = 2
|
||||
context_menu_enabled = true
|
||||
placeholder_text = "Enter server IP"
|
||||
placeholder_alpha = 0.6
|
||||
caret_blink = false
|
||||
caret_blink_speed = 0.65
|
||||
caret_position = 0
|
||||
_sections_unfolded = [ "Placeholder" ]
|
||||
|
||||
[node name="YourIP" type="RichTextLabel" parent="." index="6"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 588.0
|
||||
margin_top = 161.0
|
||||
margin_right = 839.0
|
||||
margin_bottom = 181.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = true
|
||||
mouse_filter = 0
|
||||
mouse_default_cursor_shape = 0
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
bbcode_enabled = false
|
||||
bbcode_text = ""
|
||||
visible_characters = -1
|
||||
percent_visible = 1.0
|
||||
meta_underlined = true
|
||||
tab_size = 4
|
||||
text = "Your IP address: XXX.XXX.X.XXX"
|
||||
scroll_active = true
|
||||
scroll_following = false
|
||||
selection_enabled = false
|
||||
override_selected_font_color = false
|
||||
|
||||
[node name="UsernameLabel" type="RichTextLabel" parent="." index="7"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 588.0
|
||||
margin_top = 139.0
|
||||
margin_right = 839.0
|
||||
margin_bottom = 159.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = true
|
||||
mouse_filter = 0
|
||||
mouse_default_cursor_shape = 0
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
custom_fonts/mono_font = SubResource( 1 )
|
||||
custom_fonts/italics_font = SubResource( 2 )
|
||||
bbcode_enabled = false
|
||||
bbcode_text = "Enter a username"
|
||||
visible_characters = -1
|
||||
percent_visible = 1.0
|
||||
meta_underlined = true
|
||||
tab_size = 4
|
||||
text = "Enter a username"
|
||||
scroll_active = true
|
||||
scroll_following = false
|
||||
selection_enabled = false
|
||||
override_selected_font_color = false
|
||||
_sections_unfolded = [ "BBCode", "custom_fonts" ]
|
||||
|
||||
[node name="BackToMain" type="Button" parent="." index="8"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 22.0
|
||||
margin_top = 503.0
|
||||
margin_right = 156.0
|
||||
margin_bottom = 573.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
|
||||
text = "Back to Main Menu"
|
||||
flat = false
|
||||
align = 1
|
||||
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
extends Node
|
||||
|
||||
var my_ip
|
||||
var peer
|
||||
var player_info = {}
|
||||
var my_info = { name = "", color = Color8(255, 0, 255) }
|
||||
var server_ip
|
||||
|
||||
func _ready():
|
||||
my_ip = IP.get_local_addresses()[1]
|
||||
prints(my_ip)
|
||||
$YourIP.text = str("Your IP address:", my_ip)
|
||||
get_tree().connect("network_peer_connected", self, "_player_connected")
|
||||
get_tree().connect("network_peer_disconnected", self, "_player_disconnected")
|
||||
get_tree().connect("connected_to_server", self, "_connected_ok")
|
||||
get_tree().connect("connection_failed", self, "_connected_fail")
|
||||
get_tree().connect("server_disconnected", self, "_server_disconnected")
|
||||
get_tree().paused = true
|
||||
|
||||
func _on_Server_pressed():
|
||||
peer = NetworkedMultiplayerENet.new()
|
||||
peer.create_server(6969, 8)
|
||||
get_tree().set_network_peer(peer)
|
||||
get_tree().set_meta("network_peer", peer)
|
||||
prints(get_tree().is_network_server())
|
||||
prints(get_tree().has_network_peer())
|
||||
prints(my_info)
|
||||
|
||||
func _on_Client_pressed():
|
||||
peer = NetworkedMultiplayerENet.new()
|
||||
peer.create_client(server_ip, 6969)
|
||||
get_tree().set_network_peer(peer)
|
||||
get_tree().set_meta("network_peer", peer)
|
||||
prints(get_tree().is_network_server())
|
||||
prints(get_tree().has_network_peer())
|
||||
|
||||
func _player_connected(id):
|
||||
prints("AYYYYYYYYY ", id)
|
||||
|
||||
func _player_disconnected(id):
|
||||
prints("OH NO ", id)
|
||||
player_info.erase(id) # Erase player from info
|
||||
|
||||
func _connected_ok():
|
||||
# Only called on clients, not server. Send my ID and info to all the other peers
|
||||
rpc("register_player", get_tree().get_network_unique_id(), my_info)
|
||||
|
||||
func _server_disconnected():
|
||||
pass # Server kicked us, show error and abort
|
||||
|
||||
func _connected_fail():
|
||||
pass # Could not even connect to server, abort
|
||||
|
||||
remote func move_player(id, position):
|
||||
prints("NETWORKING SAYS:", id, position)
|
||||
pass
|
||||
|
||||
remote func register_player(id, info):
|
||||
player_info[id] = info
|
||||
if get_tree().is_network_server():
|
||||
# Send my info to new player
|
||||
rpc_id(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])
|
||||
prints(player_info[id], id)
|
||||
|
||||
# Call function to update lobby UI here
|
||||
|
||||
func _on_Name_pressed():
|
||||
my_info = { name = $LineEdit.text, color = Color8(18, 255, 18) }
|
||||
|
||||
func _on_LineEdit_text_entered(new_text):
|
||||
my_info = {name = new_text, color = my_info.color}
|
||||
$UsernameLabel.text = str("Your netname is \"", new_text, "\"")
|
||||
|
||||
func _on_Server_Entry_text_entered(new_text):
|
||||
server_ip = new_text
|
||||
|
||||
func _on_BackToMain_pressed():
|
||||
$Server.visible = false
|
||||
$Client.visible = false
|
||||
$Name.visible = false
|
||||
$UsernameEntry.visible = false
|
||||
$ServerEntry.visible = false
|
||||
$YourIP.visible = false
|
||||
$UsernameLabel.visible = false
|
||||
$BackToMain.visible = false
|
||||
$ColorRect.visible = false
|
|
@ -0,0 +1,271 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://Networking.gd" type="Script" id=1]
|
||||
|
||||
[sub_resource type="BitmapFont" id=1]
|
||||
|
||||
textures = [ ]
|
||||
chars = PoolIntArray( )
|
||||
kernings = PoolIntArray( )
|
||||
height = 1.0
|
||||
ascent = 0.0
|
||||
distance_field = false
|
||||
|
||||
[sub_resource type="BitmapFont" id=2]
|
||||
|
||||
textures = [ ]
|
||||
chars = PoolIntArray( )
|
||||
kernings = PoolIntArray( )
|
||||
height = 1.0
|
||||
ascent = 0.0
|
||||
distance_field = false
|
||||
|
||||
[node name="Networking" type="Node" index="0"]
|
||||
|
||||
pause_mode = 2
|
||||
script = ExtResource( 1 )
|
||||
_sections_unfolded = [ "Pause" ]
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="." index="0"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = -3.0
|
||||
margin_top = -1.0
|
||||
margin_right = 1028.0
|
||||
margin_bottom = 619.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="Server" type="Button" parent="." index="1"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 118.0
|
||||
margin_top = 69.0
|
||||
margin_right = 382.0
|
||||
margin_bottom = 282.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
|
||||
text = "Server"
|
||||
flat = false
|
||||
align = 1
|
||||
|
||||
[node name="Client" type="Button" parent="." index="2"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 548.0
|
||||
margin_top = 283.0
|
||||
margin_right = 785.0
|
||||
margin_bottom = 416.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
|
||||
text = "Client"
|
||||
flat = false
|
||||
align = 1
|
||||
|
||||
[node name="Name" type="Button" parent="." index="3"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 196.0
|
||||
margin_top = 456.0
|
||||
margin_right = 295.0
|
||||
margin_bottom = 532.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
|
||||
text = "Name"
|
||||
flat = false
|
||||
align = 1
|
||||
|
||||
[node name="UsernameEntry" type="LineEdit" parent="." index="4"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 518.0
|
||||
margin_top = 464.0
|
||||
margin_right = 721.0
|
||||
margin_bottom = 490.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
focus_mode = 2
|
||||
mouse_filter = 0
|
||||
mouse_default_cursor_shape = 1
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
focus_mode = 2
|
||||
context_menu_enabled = true
|
||||
placeholder_text = "Enter username"
|
||||
placeholder_alpha = 0.6
|
||||
caret_blink = false
|
||||
caret_blink_speed = 0.65
|
||||
caret_position = 0
|
||||
_sections_unfolded = [ "Placeholder" ]
|
||||
|
||||
[node name="ServerEntry" type="LineEdit" parent="." index="5"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 518.0
|
||||
margin_top = 502.0
|
||||
margin_right = 721.0
|
||||
margin_bottom = 528.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
focus_mode = 2
|
||||
mouse_filter = 0
|
||||
mouse_default_cursor_shape = 1
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
focus_mode = 2
|
||||
context_menu_enabled = true
|
||||
placeholder_text = "Enter server IP"
|
||||
placeholder_alpha = 0.6
|
||||
caret_blink = false
|
||||
caret_blink_speed = 0.65
|
||||
caret_position = 0
|
||||
_sections_unfolded = [ "Placeholder" ]
|
||||
|
||||
[node name="YourIP" type="RichTextLabel" parent="." index="6"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 588.0
|
||||
margin_top = 161.0
|
||||
margin_right = 839.0
|
||||
margin_bottom = 181.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = true
|
||||
mouse_filter = 0
|
||||
mouse_default_cursor_shape = 0
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
bbcode_enabled = false
|
||||
bbcode_text = ""
|
||||
visible_characters = -1
|
||||
percent_visible = 1.0
|
||||
meta_underlined = true
|
||||
tab_size = 4
|
||||
text = "Your IP address: XXX.XXX.X.XXX"
|
||||
scroll_active = true
|
||||
scroll_following = false
|
||||
selection_enabled = false
|
||||
override_selected_font_color = false
|
||||
|
||||
[node name="UsernameLabel" type="RichTextLabel" parent="." index="7"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 588.0
|
||||
margin_top = 139.0
|
||||
margin_right = 839.0
|
||||
margin_bottom = 159.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = true
|
||||
mouse_filter = 0
|
||||
mouse_default_cursor_shape = 0
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
custom_fonts/mono_font = SubResource( 1 )
|
||||
custom_fonts/italics_font = SubResource( 2 )
|
||||
bbcode_enabled = false
|
||||
bbcode_text = "Enter a username"
|
||||
visible_characters = -1
|
||||
percent_visible = 1.0
|
||||
meta_underlined = true
|
||||
tab_size = 4
|
||||
text = "Enter a username"
|
||||
scroll_active = true
|
||||
scroll_following = false
|
||||
selection_enabled = false
|
||||
override_selected_font_color = false
|
||||
_sections_unfolded = [ "BBCode", "custom_fonts" ]
|
||||
|
||||
[node name="BackToMain" type="Button" parent="." index="8"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 22.0
|
||||
margin_top = 503.0
|
||||
margin_right = 156.0
|
||||
margin_bottom = 573.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
|
||||
text = "Back to Main Menu"
|
||||
flat = false
|
||||
align = 1
|
||||
|
||||
[connection signal="pressed" from="Server" to="." method="_on_Server_pressed"]
|
||||
|
||||
[connection signal="pressed" from="Client" to="." method="_on_Client_pressed"]
|
||||
|
||||
[connection signal="pressed" from="Name" to="." method="_on_Name_pressed"]
|
||||
|
||||
[connection signal="text_entered" from="UsernameEntry" to="." method="_on_LineEdit_text_entered"]
|
||||
|
||||
[connection signal="text_entered" from="ServerEntry" to="." method="_on_Server_Entry_text_entered"]
|
||||
|
||||
[connection signal="pressed" from="BackToMain" to="." method="_on_BackToMain_pressed"]
|
||||
|
||||
|
17
Node.gd
|
@ -1,21 +1,24 @@
|
|||
extends Node
|
||||
|
||||
signal restart
|
||||
# class member variables go here, for example:
|
||||
# var a = 2
|
||||
# var b = "textvar"
|
||||
var rectangle_opacity = 0
|
||||
|
||||
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
|
||||
func _process(delta):
|
||||
$ColorRect.color = Color(0, 0, 0, rectangle_opacity)
|
||||
if rectangle_opacity < 1:
|
||||
rectangle_opacity += delta/2
|
||||
if (Input.is_action_pressed("ui_quit")):
|
||||
get_tree().quit()
|
||||
|
||||
|
||||
func _on_Button_pressed():
|
||||
emit_signal("restart")
|
||||
queue_free()
|
||||
|
||||
func _on_Button_button_down():
|
||||
$Restart.frame = 1
|
||||
|
|
91
Player.gd
|
@ -1,5 +1,6 @@
|
|||
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
|
||||
|
@ -10,6 +11,9 @@ signal restart_game
|
|||
|
||||
export (PackedScene) var Laser
|
||||
|
||||
################################
|
||||
#THINGS THAT MAY NEED ADJUSTING
|
||||
#################################
|
||||
#Default ship strengths and costs
|
||||
const BULLET_DELAY_TIER1 = 0.8
|
||||
const BULLET_DELAY_TIER2 = 0.5
|
||||
|
@ -37,9 +41,12 @@ const SHIP_SPEED_TIER5_COST = 800
|
|||
|
||||
const STARTING_MONEY = 100
|
||||
|
||||
#################################
|
||||
|
||||
var screensize
|
||||
|
||||
var ship_speed = SHIP_SPEED_TIER1
|
||||
var ship_speed_tier = 0
|
||||
|
||||
var bullet_delay = BULLET_DELAY_TIER1
|
||||
var bullet_delay_tier = 0
|
||||
|
@ -58,7 +65,14 @@ 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.bullet_delay_tier = bullet_delay_tier
|
||||
upgmenu.ship_speed_tier = ship_speed_tier
|
||||
get_tree().paused = true
|
||||
|
||||
func upgradeShipSpeed_button():
|
||||
upgradeShipSpeed()
|
||||
emit_signal("update_display")
|
||||
get_tree().paused = true
|
||||
|
||||
func upgradeBulletDelay_button():
|
||||
|
@ -99,22 +113,27 @@ func upgradeBulletDelay():
|
|||
prints(bullet_delay)
|
||||
|
||||
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
|
||||
elif (ship_speed >= SHIP_SPEED_MAXIMUM):
|
||||
emit_signal("ship_speed_fully_upgraded")
|
||||
elif (ship_speed >= SHIP_SPEED_TIER5 && money >= ship_speed_upgrade):
|
||||
|
@ -130,6 +149,7 @@ func _ready():
|
|||
timer.set_wait_time(bullet_delay)
|
||||
timer.connect("timeout", self, "on_timeout_complete")
|
||||
add_child(timer)
|
||||
timer.start()
|
||||
|
||||
position.x = 100
|
||||
position.y = 250
|
||||
|
@ -151,9 +171,7 @@ func _refund_button():
|
|||
|
||||
var timer = null
|
||||
|
||||
var can_shoot = true
|
||||
var going_up = false
|
||||
var going_down = false
|
||||
var can_shoot = false
|
||||
var shoot_down = false
|
||||
|
||||
func on_timeout_complete():
|
||||
|
@ -164,44 +182,72 @@ func on_timeout_complete():
|
|||
# gravity_point = true
|
||||
# gravity_vec = Vector2(0.5, 0.5)
|
||||
|
||||
func _process(delta):
|
||||
var velocity = Vector2() # the player's movement vector
|
||||
if (Input.is_action_pressed("ui_right")):
|
||||
var x_up = false
|
||||
var y_up = false
|
||||
var x_down = false
|
||||
var y_down = false
|
||||
|
||||
func moveto(finger_position):
|
||||
if (finger_position.x > position.x && finger_position.x < 800):
|
||||
velocity.x += 1
|
||||
if (Input.is_action_pressed("ui_left")):
|
||||
x_up = true
|
||||
if position.x > finger_position.x:
|
||||
velocity.x -= 1
|
||||
if (Input.is_action_pressed("ui_down") || going_down == true):
|
||||
x_down = true
|
||||
if (finger_position.y - 100 > position.y && finger_position.x < 800):
|
||||
velocity.y += 1
|
||||
if (Input.is_action_pressed("ui_up") || going_up == true):
|
||||
y_up = true
|
||||
if (position.y > finger_position.y - 100 && finger_position.x < 800):
|
||||
velocity.y -= 1
|
||||
y_down = true
|
||||
# if (finger_position.x >= 800 && can_shoot):
|
||||
# shoot()
|
||||
if get_tree().has_network_peer():
|
||||
rpc("move_player", get_tree().get_network_unique_id(), position)
|
||||
|
||||
#remote func move_player(id, position):
|
||||
# prints("PLAYER SAYS:", id, position)
|
||||
# pass
|
||||
|
||||
var velocity = Vector2() # the player's movement vector
|
||||
|
||||
func _process(delta):
|
||||
velocity = Vector2()
|
||||
if (Input.is_action_pressed("ui_right") || x_up):
|
||||
velocity.x += 1
|
||||
x_up = false
|
||||
if (Input.is_action_pressed("ui_left") || x_down):
|
||||
velocity.x -= 1
|
||||
x_down = false
|
||||
if (Input.is_action_pressed("ui_down") || y_up):
|
||||
velocity.y += 1
|
||||
y_up = false
|
||||
if (Input.is_action_pressed("ui_up") || y_down):
|
||||
velocity.y -= 1
|
||||
y_down = false
|
||||
if (velocity.length() > 0):
|
||||
velocity = velocity.normalized() * ship_speed
|
||||
|
||||
position += velocity * delta
|
||||
position.x = clamp(position.x, 0, screensize.x)
|
||||
position.y = clamp(position.y, 0, screensize.y)
|
||||
if get_tree().has_network_peer():
|
||||
rpc("move_player", get_tree().get_network_unique_id(), position)
|
||||
|
||||
if ((Input.is_action_pressed("ui_accept") || shoot_down == true) && can_shoot == true):
|
||||
shoot()
|
||||
# if (Input.is_action_pressed("ui_select") && can_shoot == true):
|
||||
# upgradeBulletDelay()
|
||||
|
||||
if (Input.is_action_pressed("ui_reset") && can_shoot == true):
|
||||
#upgradeShipSpeed()
|
||||
upgradeMenu()
|
||||
|
||||
var x_up = false
|
||||
var y_up = false
|
||||
var x_down = false
|
||||
var y_down = false
|
||||
|
||||
func _on_Player_body_entered(body):
|
||||
prints("hit")
|
||||
|
||||
func upPressed():
|
||||
going_up = true
|
||||
func upDepressed():
|
||||
going_up = false
|
||||
|
||||
func downPressed():
|
||||
going_down = true
|
||||
func downDepressed():
|
||||
going_down = false
|
||||
|
||||
func shootDown():
|
||||
shoot_down = true
|
||||
func shootUp():
|
||||
|
@ -222,6 +268,7 @@ func shoot():
|
|||
laser2.position.y = position.y + 28
|
||||
laser2.position.x = position.x + 46
|
||||
laser2.current_pen = laser_penetration
|
||||
|
||||
|
||||
can_shoot = false
|
||||
timer.start()
|
||||
|
|
11
Player.tscn
|
@ -17,8 +17,8 @@ animations = [ {
|
|||
[sub_resource type="CapsuleShape2D" id=2]
|
||||
|
||||
custom_solver_bias = 0.0
|
||||
radius = 19.3222
|
||||
height = 76.5834
|
||||
radius = 12.8998
|
||||
height = 40.4125
|
||||
|
||||
[node name="Player" type="Area2D"]
|
||||
|
||||
|
@ -28,9 +28,12 @@ gravity_vec = Vector2( 10, 10 )
|
|||
gravity = 1000.0
|
||||
linear_damp = 0.1
|
||||
angular_damp = 1.0
|
||||
collision_layer = 29
|
||||
collision_mask = 29
|
||||
audio_bus_override = false
|
||||
audio_bus_name = "Master"
|
||||
script = ExtResource( 1 )
|
||||
_sections_unfolded = [ "Collision", "Z Index" ]
|
||||
Laser = ExtResource( 2 )
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="." index="0"]
|
||||
|
@ -43,10 +46,8 @@ _sections_unfolded = [ "Transform" ]
|
|||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="1"]
|
||||
|
||||
position = Vector2( -4.44824, -0.0942383 )
|
||||
rotation = 1.5708
|
||||
position = Vector2( 45.5518, -3.09424 )
|
||||
shape = SubResource( 2 )
|
||||
disabled = true
|
||||
_sections_unfolded = [ "Material", "Transform", "Visibility", "Z Index" ]
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ extends Node
|
|||
signal refund
|
||||
signal speed_upgrade
|
||||
signal bullet_delay_upgrade
|
||||
signal ship_speed_upgrade
|
||||
signal add_laser
|
||||
signal plasma_lasers
|
||||
|
||||
|
@ -13,29 +14,37 @@ var double_lasers
|
|||
|
||||
func _ready():
|
||||
bullet_delay_tier = get_parent().bullet_delay_tier
|
||||
$ShootingSpeedIcon.frame = bullet_delay_tier
|
||||
$ShootingSpeedUpgrade/Icon.frame = bullet_delay_tier
|
||||
ship_speed_tier = get_parent().ship_speed_tier
|
||||
$ShipSpeedUpgrade/Icon.frame = ship_speed_tier
|
||||
|
||||
func _process(delta):
|
||||
$ShootingSpeedIcon.frame = bullet_delay_tier
|
||||
$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"):
|
||||
_on_Button_pressed()
|
||||
|
||||
func _on_Button_pressed():
|
||||
get_tree().paused = false
|
||||
queue_free()
|
||||
|
||||
|
||||
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")
|
||||
$ShootingSpeedIcon.frame = 0
|
||||
pass # replace with function body
|
||||
|
||||
func shooting_speed_upgrade_success():
|
||||
$ShootingSpeedIcon.frame += 1
|
||||
|
||||
func _on_ShootingSpeedUpgrade_pressed():
|
||||
get_tree().paused = false
|
||||
emit_signal("bullet_delay_upgrade")
|
||||
bullet_delay_tier = get_parent().bullet_delay_tier
|
||||
pass
|
||||
|
||||
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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=9 format=2]
|
||||
[gd_scene load_steps=15 format=2]
|
||||
|
||||
[ext_resource path="res://UpgradeMenu.gd" type="Script" id=1]
|
||||
[ext_resource path="res://art/upgrade_menu/shootingspeed1.png" type="Texture" id=2]
|
||||
|
@ -6,6 +6,11 @@
|
|||
[ext_resource path="res://art/upgrade_menu/shootingspeed3.png" type="Texture" id=4]
|
||||
[ext_resource path="res://art/upgrade_menu/shootingspeed4.png" type="Texture" id=5]
|
||||
[ext_resource path="res://art/upgrade_menu/shootingspeed5.png" type="Texture" id=6]
|
||||
[ext_resource path="res://art/upgrade_menu/shipspeed1.png" type="Texture" id=7]
|
||||
[ext_resource path="res://art/upgrade_menu/shipspeed2.png" type="Texture" id=8]
|
||||
[ext_resource path="res://art/upgrade_menu/shipspeed3.png" type="Texture" id=9]
|
||||
[ext_resource path="res://art/upgrade_menu/shipspeed4.png" type="Texture" id=10]
|
||||
[ext_resource path="res://art/upgrade_menu/shipspeed5.png" type="Texture" id=11]
|
||||
|
||||
[sub_resource type="Theme" id=1]
|
||||
|
||||
|
@ -18,6 +23,15 @@ animations = [ {
|
|||
"name": "default",
|
||||
"speed": 5.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="SpriteFrames" id=3]
|
||||
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 7 ), ExtResource( 8 ), ExtResource( 9 ), ExtResource( 10 ), ExtResource( 11 ) ],
|
||||
"loop": true,
|
||||
"name": "New Anim",
|
||||
"speed": 5.0
|
||||
} ]
|
||||
_sections_unfolded = [ "Resource" ]
|
||||
|
||||
[node name="UpgradeMenu" type="Node"]
|
||||
|
@ -40,7 +54,7 @@ mouse_filter = 0
|
|||
mouse_default_cursor_shape = 0
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
color = Color( 0.188874, 0.188049, 0.203125, 1 )
|
||||
color = Color( 0, 0, 0, 1 )
|
||||
|
||||
[node name="Resume" type="Button" parent="." index="1"]
|
||||
|
||||
|
@ -74,10 +88,10 @@ anchor_left = 0.0
|
|||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 842.0
|
||||
margin_top = 420.0
|
||||
margin_right = 966.0
|
||||
margin_bottom = 523.0
|
||||
margin_left = 860.0
|
||||
margin_top = 250.0
|
||||
margin_right = 984.0
|
||||
margin_bottom = 353.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
focus_mode = 2
|
||||
|
@ -93,14 +107,9 @@ text = "Refund"
|
|||
flat = false
|
||||
align = 1
|
||||
|
||||
[node name="ShootingSpeedIcon" type="AnimatedSprite" parent="." index="3"]
|
||||
[node name="ShootingSpeedUpgrade" type="Node" parent="." index="3"]
|
||||
|
||||
position = Vector2( 525.939, 118.838 )
|
||||
scale = Vector2( 0.392712, 0.392712 )
|
||||
frames = SubResource( 2 )
|
||||
animation = "default"
|
||||
|
||||
[node name="ShootingSpeedUpgrade" type="Button" parent="." index="4"]
|
||||
[node name="Button" type="Button" parent="ShootingSpeedUpgrade" index="0"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
|
@ -108,7 +117,7 @@ anchor_right = 0.0
|
|||
anchor_bottom = 0.0
|
||||
margin_left = 400.0
|
||||
margin_top = 40.0
|
||||
margin_right = 652.0
|
||||
margin_right = 660.0
|
||||
margin_bottom = 198.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
|
@ -124,12 +133,54 @@ group = null
|
|||
flat = true
|
||||
align = 1
|
||||
|
||||
[node name="Icon" type="AnimatedSprite" parent="ShootingSpeedUpgrade" index="1"]
|
||||
|
||||
position = Vector2( 530, 120 )
|
||||
scale = Vector2( 0.392712, 0.392712 )
|
||||
frames = SubResource( 2 )
|
||||
animation = "default"
|
||||
|
||||
[node name="ShipSpeedUpgrade" type="Node" parent="." index="4"]
|
||||
|
||||
[node name="Button" type="Button" parent="ShipSpeedUpgrade" index="0"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 400.0
|
||||
margin_top = 230.0
|
||||
margin_right = 660.0
|
||||
margin_bottom = 388.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="Icon" type="AnimatedSprite" parent="ShipSpeedUpgrade" index="1"]
|
||||
|
||||
position = Vector2( 530, 310 )
|
||||
scale = Vector2( 0.392712, 0.392712 )
|
||||
frames = SubResource( 3 )
|
||||
animation = "New Anim"
|
||||
|
||||
[connection signal="button_down" from="Resume" to="." method="_on_Resume_button_down"]
|
||||
|
||||
[connection signal="pressed" from="Resume" to="." method="_on_Button_pressed"]
|
||||
|
||||
[connection signal="pressed" from="Refund" to="." method="_on_Refund_pressed"]
|
||||
|
||||
[connection signal="pressed" from="ShootingSpeedUpgrade" to="." method="_on_ShootingSpeedUpgrade_pressed"]
|
||||
[connection signal="pressed" from="ShootingSpeedUpgrade/Button" to="." method="_on_ShootingSpeedUpgrade_pressed"]
|
||||
|
||||
[connection signal="pressed" from="ShipSpeedUpgrade/Button" to="." method="_on_ShipSpeedUpgrade_pressed"]
|
||||
|
||||
|
||||
|
|
After Width: | Height: | Size: 65 KiB |
After Width: | Height: | Size: 116 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 37 KiB |
After Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 26 KiB |
|
@ -11,6 +11,237 @@ patch_list=PoolStringArray( )
|
|||
|
||||
[preset.0.options]
|
||||
|
||||
graphics/32_bits_framebuffer=true
|
||||
one_click_deploy/clear_previous_install=true
|
||||
custom_package/debug=""
|
||||
custom_package/release=""
|
||||
command_line/extra_args=""
|
||||
version/code=1
|
||||
version/name="1.0"
|
||||
package/unique_name="org.godotengine.$genname"
|
||||
package/name=""
|
||||
package/signed=true
|
||||
screen/immersive_mode=true
|
||||
screen/orientation=0
|
||||
screen/support_small=true
|
||||
screen/support_normal=true
|
||||
screen/support_large=true
|
||||
screen/support_xlarge=true
|
||||
launcher_icons/xxxhdpi_192x192=""
|
||||
launcher_icons/xxhdpi_144x144=""
|
||||
launcher_icons/xhdpi_96x96=""
|
||||
launcher_icons/hdpi_72x72=""
|
||||
launcher_icons/mdpi_48x48=""
|
||||
keystore/release=""
|
||||
keystore/release_user=""
|
||||
keystore/release_password=""
|
||||
apk_expansion/enable=false
|
||||
apk_expansion/SALT=""
|
||||
apk_expansion/public_key=""
|
||||
architectures/armeabi-v7a=true
|
||||
architectures/arm64-v8a=false
|
||||
architectures/x86=false
|
||||
architectures/x86_64=false
|
||||
permissions/access_checkin_properties=false
|
||||
permissions/access_coarse_location=false
|
||||
permissions/access_fine_location=false
|
||||
permissions/access_location_extra_commands=false
|
||||
permissions/access_mock_location=false
|
||||
permissions/access_network_state=true
|
||||
permissions/access_surface_flinger=false
|
||||
permissions/access_wifi_state=true
|
||||
permissions/account_manager=false
|
||||
permissions/add_voicemail=false
|
||||
permissions/authenticate_accounts=false
|
||||
permissions/battery_stats=false
|
||||
permissions/bind_accessibility_service=false
|
||||
permissions/bind_appwidget=false
|
||||
permissions/bind_device_admin=false
|
||||
permissions/bind_input_method=false
|
||||
permissions/bind_nfc_service=false
|
||||
permissions/bind_notification_listener_service=false
|
||||
permissions/bind_print_service=false
|
||||
permissions/bind_remoteviews=false
|
||||
permissions/bind_text_service=false
|
||||
permissions/bind_vpn_service=false
|
||||
permissions/bind_wallpaper=false
|
||||
permissions/bluetooth=false
|
||||
permissions/bluetooth_admin=false
|
||||
permissions/bluetooth_privileged=false
|
||||
permissions/brick=false
|
||||
permissions/broadcast_package_removed=false
|
||||
permissions/broadcast_sms=false
|
||||
permissions/broadcast_sticky=false
|
||||
permissions/broadcast_wap_push=false
|
||||
permissions/call_phone=false
|
||||
permissions/call_privileged=false
|
||||
permissions/camera=false
|
||||
permissions/capture_audio_output=false
|
||||
permissions/capture_secure_video_output=false
|
||||
permissions/capture_video_output=false
|
||||
permissions/change_component_enabled_state=false
|
||||
permissions/change_configuration=false
|
||||
permissions/change_network_state=true
|
||||
permissions/change_wifi_multicast_state=true
|
||||
permissions/change_wifi_state=true
|
||||
permissions/clear_app_cache=false
|
||||
permissions/clear_app_user_data=false
|
||||
permissions/control_location_updates=false
|
||||
permissions/delete_cache_files=false
|
||||
permissions/delete_packages=false
|
||||
permissions/device_power=false
|
||||
permissions/diagnostic=false
|
||||
permissions/disable_keyguard=false
|
||||
permissions/dump=false
|
||||
permissions/expand_status_bar=false
|
||||
permissions/factory_test=false
|
||||
permissions/flashlight=false
|
||||
permissions/force_back=false
|
||||
permissions/get_accounts=false
|
||||
permissions/get_package_size=false
|
||||
permissions/get_tasks=false
|
||||
permissions/get_top_activity_info=false
|
||||
permissions/global_search=false
|
||||
permissions/hardware_test=false
|
||||
permissions/inject_events=false
|
||||
permissions/install_location_provider=false
|
||||
permissions/install_packages=false
|
||||
permissions/install_shortcut=false
|
||||
permissions/internal_system_window=false
|
||||
permissions/internet=true
|
||||
permissions/kill_background_processes=false
|
||||
permissions/location_hardware=false
|
||||
permissions/manage_accounts=false
|
||||
permissions/manage_app_tokens=false
|
||||
permissions/manage_documents=false
|
||||
permissions/master_clear=false
|
||||
permissions/media_content_control=false
|
||||
permissions/modify_audio_settings=false
|
||||
permissions/modify_phone_state=false
|
||||
permissions/mount_format_filesystems=false
|
||||
permissions/mount_unmount_filesystems=false
|
||||
permissions/nfc=false
|
||||
permissions/persistent_activity=false
|
||||
permissions/process_outgoing_calls=false
|
||||
permissions/read_calendar=false
|
||||
permissions/read_call_log=false
|
||||
permissions/read_contacts=false
|
||||
permissions/read_external_storage=false
|
||||
permissions/read_frame_buffer=false
|
||||
permissions/read_history_bookmarks=false
|
||||
permissions/read_input_state=false
|
||||
permissions/read_logs=false
|
||||
permissions/read_phone_state=true
|
||||
permissions/read_profile=false
|
||||
permissions/read_sms=false
|
||||
permissions/read_social_stream=false
|
||||
permissions/read_sync_settings=false
|
||||
permissions/read_sync_stats=false
|
||||
permissions/read_user_dictionary=false
|
||||
permissions/reboot=false
|
||||
permissions/receive_boot_completed=false
|
||||
permissions/receive_mms=false
|
||||
permissions/receive_sms=false
|
||||
permissions/receive_wap_push=false
|
||||
permissions/record_audio=false
|
||||
permissions/reorder_tasks=false
|
||||
permissions/restart_packages=false
|
||||
permissions/send_respond_via_message=false
|
||||
permissions/send_sms=false
|
||||
permissions/set_activity_watcher=false
|
||||
permissions/set_alarm=false
|
||||
permissions/set_always_finish=false
|
||||
permissions/set_animation_scale=false
|
||||
permissions/set_debug_app=false
|
||||
permissions/set_orientation=false
|
||||
permissions/set_pointer_speed=false
|
||||
permissions/set_preferred_applications=false
|
||||
permissions/set_process_limit=false
|
||||
permissions/set_time=false
|
||||
permissions/set_time_zone=false
|
||||
permissions/set_wallpaper=false
|
||||
permissions/set_wallpaper_hints=false
|
||||
permissions/signal_persistent_processes=false
|
||||
permissions/status_bar=false
|
||||
permissions/subscribed_feeds_read=false
|
||||
permissions/subscribed_feeds_write=false
|
||||
permissions/system_alert_window=false
|
||||
permissions/transmit_ir=false
|
||||
permissions/uninstall_shortcut=false
|
||||
permissions/update_device_stats=false
|
||||
permissions/use_credentials=false
|
||||
permissions/use_sip=false
|
||||
permissions/vibrate=false
|
||||
permissions/wake_lock=false
|
||||
permissions/write_apn_settings=false
|
||||
permissions/write_calendar=false
|
||||
permissions/write_call_log=false
|
||||
permissions/write_contacts=false
|
||||
permissions/write_external_storage=false
|
||||
permissions/write_gservices=false
|
||||
permissions/write_history_bookmarks=false
|
||||
permissions/write_profile=false
|
||||
permissions/write_secure_settings=false
|
||||
permissions/write_settings=false
|
||||
permissions/write_sms=false
|
||||
permissions/write_social_stream=false
|
||||
permissions/write_sync_settings=false
|
||||
permissions/write_user_dictionary=false
|
||||
user_permissions/0=false
|
||||
user_permissions/1=false
|
||||
user_permissions/2=false
|
||||
user_permissions/3=false
|
||||
user_permissions/4=false
|
||||
user_permissions/5=false
|
||||
user_permissions/6=false
|
||||
user_permissions/7=false
|
||||
user_permissions/8=false
|
||||
user_permissions/9=false
|
||||
user_permissions/10=false
|
||||
user_permissions/11=false
|
||||
user_permissions/12=false
|
||||
user_permissions/13=false
|
||||
user_permissions/14=false
|
||||
user_permissions/15=false
|
||||
user_permissions/16=false
|
||||
user_permissions/17=false
|
||||
user_permissions/18=false
|
||||
user_permissions/19=false
|
||||
|
||||
[preset.1]
|
||||
|
||||
name="HTML5"
|
||||
platform="HTML5"
|
||||
runnable=true
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
patch_list=PoolStringArray( )
|
||||
|
||||
[preset.1.options]
|
||||
|
||||
texture_format/s3tc=true
|
||||
texture_format/etc=false
|
||||
texture_format/etc2=true
|
||||
html/custom_html_shell=""
|
||||
html/head_include=""
|
||||
custom_template/release=""
|
||||
custom_template/debug=""
|
||||
|
||||
[preset.2]
|
||||
|
||||
name="Android 2"
|
||||
platform="Android"
|
||||
runnable=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
patch_list=PoolStringArray( )
|
||||
|
||||
[preset.2.options]
|
||||
|
||||
graphics/32_bits_framebuffer=true
|
||||
one_click_deploy/clear_previous_install=true
|
||||
custom_package/debug=""
|
||||
|
@ -207,24 +438,3 @@ user_permissions/16=false
|
|||
user_permissions/17=false
|
||||
user_permissions/18=false
|
||||
user_permissions/19=false
|
||||
|
||||
[preset.1]
|
||||
|
||||
name="HTML5"
|
||||
platform="HTML5"
|
||||
runnable=true
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
patch_list=PoolStringArray( )
|
||||
|
||||
[preset.1.options]
|
||||
|
||||
texture_format/s3tc=true
|
||||
texture_format/etc=false
|
||||
texture_format/etc2=true
|
||||
html/custom_html_shell=""
|
||||
html/head_include=""
|
||||
custom_template/release=""
|
||||
custom_template/debug=""
|
||||
|
|
After Width: | Height: | Size: 3.3 KiB |