199 lines
4.7 KiB
Plaintext
199 lines
4.7 KiB
Plaintext
[gd_scene load_steps=7 format=2]
|
|
|
|
[ext_resource path="res://Laser.tscn" type="PackedScene" id=1]
|
|
[ext_resource path="res://art/player/Rocket1.png" type="Texture" id=2]
|
|
[ext_resource path="res://art/player/Rocket2.png" type="Texture" id=3]
|
|
|
|
[sub_resource type="GDScript" id=1]
|
|
|
|
script/source = "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 shooting_speed_fully_upgraded
|
|
signal ship_speed_fully_upgraded
|
|
signal restart_game
|
|
signal multiplayer_movement
|
|
|
|
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
|
|
const BULLET_DELAY_TIER3 = 0.2
|
|
const BULLET_DELAY_TIER4 = 0.1
|
|
const BULLET_DELAY_TIER5 = 0.05
|
|
const SHOOTING_SPEED_UPGRADE_DEFAULT = 1500
|
|
const BULLET_DELAY_MINIMUM = 0.01
|
|
const BULLET_DELAY_TIER2_COST = 100
|
|
const BULLET_DELAY_TIER3_COST = 200
|
|
const BULLET_DELAY_TIER4_COST = 400
|
|
const BULLET_DELAY_TIER5_COST = 1000
|
|
|
|
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
|
|
const SHIP_SPEED_UPGRADE_DEFAULT = 1500
|
|
const SHIP_SPEED_MAXIMUM = 1200
|
|
const SHIP_SPEED_TIER2_COST = 200
|
|
const SHIP_SPEED_TIER3_COST = 400
|
|
const SHIP_SPEED_TIER4_COST = 600
|
|
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
|
|
var laser_penetration = 0
|
|
var double_laser = false
|
|
|
|
var ship_value = 0
|
|
var refund_percentage = 1
|
|
var money = STARTING_MONEY
|
|
|
|
var shooting_speed_upgrade = SHOOTING_SPEED_UPGRADE_DEFAULT
|
|
var ship_speed_upgrade = SHIP_SPEED_UPGRADE_DEFAULT
|
|
|
|
func _ready():
|
|
timer = Timer.new()
|
|
timer.set_one_shot(true)
|
|
timer.set_wait_time(bullet_delay)
|
|
timer.connect(\"timeout\", self, \"on_timeout_complete\")
|
|
add_child(timer)
|
|
timer.start()
|
|
|
|
position.x = 100
|
|
position.y = 250
|
|
|
|
screensize = get_viewport_rect().size
|
|
$AnimatedSprite.play()
|
|
|
|
var timer = null
|
|
|
|
var can_shoot = false
|
|
var shoot_down = false
|
|
|
|
func on_timeout_complete():
|
|
can_shoot = true
|
|
|
|
#func _unhandled_input(event):
|
|
# if (event is InputEventScreenTouch):
|
|
# gravity_point = true
|
|
# gravity_vec = Vector2(0.5, 0.5)
|
|
|
|
var x_up = false
|
|
var y_up = false
|
|
var x_down = false
|
|
var y_down = false
|
|
|
|
var username = \"username\"
|
|
|
|
func _process(delta):
|
|
$Username.text = username
|
|
pass
|
|
|
|
func shoot():
|
|
if can_shoot:
|
|
var laser = Laser.instance()
|
|
get_node(\"../\").add_child(laser)
|
|
laser.current_pen = laser_penetration
|
|
laser.position.y = position.y - 27
|
|
laser.position.x = position.x + 46
|
|
|
|
#MAYBE THE LASERS SHOULD BE THEIR OWN NODES
|
|
#Would allow for more simple additions in the future
|
|
if double_laser == true:
|
|
var laser2 = Laser.instance()
|
|
get_node(\"../\").add_child(laser2)
|
|
laser2.position.y = position.y + 28
|
|
laser2.position.x = position.x + 46
|
|
laser2.current_pen = laser_penetration
|
|
|
|
|
|
can_shoot = false
|
|
timer.start()"
|
|
_sections_unfolded = [ "Resource" ]
|
|
|
|
[sub_resource type="SpriteFrames" id=2]
|
|
|
|
animations = [ {
|
|
"frames": [ ExtResource( 2 ), ExtResource( 3 ) ],
|
|
"loop": true,
|
|
"name": "default",
|
|
"speed": 15.0
|
|
} ]
|
|
|
|
[sub_resource type="CapsuleShape2D" id=3]
|
|
|
|
custom_solver_bias = 0.0
|
|
radius = 12.8998
|
|
height = 40.4125
|
|
|
|
[node name="OtherPlayer" type="Area2D"]
|
|
|
|
input_pickable = true
|
|
gravity_point = true
|
|
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 = SubResource( 1 )
|
|
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 )
|
|
animation = "default"
|
|
_sections_unfolded = [ "Visibility" ]
|
|
|
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="1"]
|
|
|
|
position = Vector2( 45.5518, -3.09424 )
|
|
shape = SubResource( 3 )
|
|
|
|
[node name="Username" type="Label" parent="." index="2"]
|
|
|
|
anchor_left = 0.0
|
|
anchor_top = 0.0
|
|
anchor_right = 0.0
|
|
anchor_bottom = 0.0
|
|
margin_left = -87.0
|
|
margin_top = -55.0
|
|
margin_right = 87.0
|
|
margin_bottom = -41.0
|
|
rect_pivot_offset = Vector2( 0, 0 )
|
|
rect_clip_content = false
|
|
mouse_filter = 2
|
|
mouse_default_cursor_shape = 0
|
|
size_flags_horizontal = 1
|
|
size_flags_vertical = 4
|
|
text = "username"
|
|
align = 1
|
|
percent_visible = 1.0
|
|
lines_skipped = 0
|
|
max_lines_visible = -1
|
|
|
|
|