Add project.godot. Add some real UpgradeMenu functionality
This commit is contained in:
parent
dcb450506e
commit
e050fe3ecb
2
Bad1.gd
2
Bad1.gd
|
@ -25,7 +25,7 @@ var velocity = Vector2()
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
if health <= 0:
|
if health <= 0:
|
||||||
emit_signal("dead", 150)
|
emit_signal("dead", 15)
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
||||||
if hit_timer < 0.15:
|
if hit_timer < 0.15:
|
||||||
|
|
2
Bloob.gd
2
Bloob.gd
|
@ -24,7 +24,7 @@ var velocity = Vector2()
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
if health <= 0:
|
if health <= 0:
|
||||||
emit_signal("dead", 300)
|
emit_signal("dead", 30)
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
||||||
if hit_timer < 0.15:
|
if hit_timer < 0.15:
|
||||||
|
|
|
@ -18,7 +18,7 @@ animations = [ {
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
} ]
|
} ]
|
||||||
|
|
||||||
[node name="Area2D" type="Area2D" index="0"]
|
[node name="Area2D" type="Area2D"]
|
||||||
|
|
||||||
scale = Vector2( 0.25, 0.25 )
|
scale = Vector2( 0.25, 0.25 )
|
||||||
input_pickable = true
|
input_pickable = true
|
||||||
|
|
25
Main.gd
25
Main.gd
|
@ -2,7 +2,6 @@ extends Node
|
||||||
|
|
||||||
export (PackedScene) var FirstBad
|
export (PackedScene) var FirstBad
|
||||||
export (PackedScene) var BlobBad
|
export (PackedScene) var BlobBad
|
||||||
export (PackedScene) var UpgradeMenu
|
|
||||||
|
|
||||||
var position = Vector2(200, 200)
|
var position = Vector2(200, 200)
|
||||||
var total_bads_spawned = 0
|
var total_bads_spawned = 0
|
||||||
|
@ -51,29 +50,11 @@ func BaddieTimer():
|
||||||
else:
|
else:
|
||||||
total_bads_spawned = 0
|
total_bads_spawned = 0
|
||||||
|
|
||||||
func _on_Player_shooting_speed_upgrade():
|
|
||||||
updatePoints()
|
|
||||||
pass
|
|
||||||
|
|
||||||
func _on_PauseButton_pressed():
|
func _on_PauseButton_pressed():
|
||||||
var upgmenu
|
$Player.upgradeMenu()
|
||||||
upgmenu = UpgradeMenu.instance()
|
|
||||||
add_child(upgmenu)
|
|
||||||
upgmenu.connect("refund", self, "_refund_button")
|
|
||||||
get_tree().paused = true
|
|
||||||
|
|
||||||
func updatePoints():
|
func updatePoints():
|
||||||
$MoneyDisplay.text = str($Player.money, " points")
|
$MoneyDisplay.text = str($Player.money, " points")
|
||||||
|
|
||||||
#When refund signal from upgrade menu comes in,
|
func _on_Player_update_display():
|
||||||
# tell Player to refund upgrades
|
updatePoints()
|
||||||
func _refund_button():
|
|
||||||
$Player.refund()
|
|
||||||
|
|
||||||
#When refund comes back successfully from Player,
|
|
||||||
# pause game again
|
|
||||||
func _on_Player_refund(ship_value):
|
|
||||||
prints("Refunded for ", ship_value)
|
|
||||||
updatePoints()
|
|
||||||
get_tree().paused = true
|
|
||||||
pass # replace with function body
|
|
26
Main.tscn
26
Main.tscn
|
@ -1,12 +1,11 @@
|
||||||
[gd_scene load_steps=10 format=2]
|
[gd_scene load_steps=9 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Main.gd" type="Script" id=1]
|
[ext_resource path="res://Main.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://Bad1.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://Bad1.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://Bloob.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://Bloob.tscn" type="PackedScene" id=3]
|
||||||
[ext_resource path="res://UpgradeMenu.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://art/bg.png" type="Texture" id=4]
|
||||||
[ext_resource path="res://art/bg.png" type="Texture" id=5]
|
[ext_resource path="res://Player.tscn" type="PackedScene" id=5]
|
||||||
[ext_resource path="res://Player.tscn" type="PackedScene" id=6]
|
[ext_resource path="res://Mothership.tscn" type="PackedScene" id=6]
|
||||||
[ext_resource path="res://Mothership.tscn" type="PackedScene" id=7]
|
|
||||||
|
|
||||||
[sub_resource type="ImageTexture" id=1]
|
[sub_resource type="ImageTexture" id=1]
|
||||||
|
|
||||||
|
@ -24,13 +23,12 @@ lossy_quality = 0.7
|
||||||
flags = 7
|
flags = 7
|
||||||
size = Vector2( 0, 0 )
|
size = Vector2( 0, 0 )
|
||||||
|
|
||||||
[node name="Main" type="Node" index="0"]
|
[node name="Main" type="Node"]
|
||||||
|
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
_sections_unfolded = [ "Pause" ]
|
_sections_unfolded = [ "Pause" ]
|
||||||
FirstBad = ExtResource( 2 )
|
FirstBad = ExtResource( 2 )
|
||||||
BlobBad = ExtResource( 3 )
|
BlobBad = ExtResource( 3 )
|
||||||
UpgradeMenu = ExtResource( 4 )
|
|
||||||
|
|
||||||
[node name="Sprite2" type="Sprite" parent="." index="0"]
|
[node name="Sprite2" type="Sprite" parent="." index="0"]
|
||||||
|
|
||||||
|
@ -43,18 +41,18 @@ texture = SubResource( 2 )
|
||||||
[node name="bg" type="Sprite" parent="Sprite" index="0"]
|
[node name="bg" type="Sprite" parent="Sprite" index="0"]
|
||||||
|
|
||||||
position = Vector2( 544.657, 347.107 )
|
position = Vector2( 544.657, 347.107 )
|
||||||
texture = ExtResource( 5 )
|
texture = ExtResource( 4 )
|
||||||
|
|
||||||
[node name="Player" parent="." index="2" instance=ExtResource( 6 )]
|
[node name="Player" parent="." index="2" instance=ExtResource( 5 )]
|
||||||
|
|
||||||
[node name="BaddieTimer" type="Timer" parent="." index="3"]
|
[node name="BaddieTimer" type="Timer" parent="." index="3"]
|
||||||
|
|
||||||
process_mode = 1
|
process_mode = 1
|
||||||
wait_time = 4.0
|
wait_time = 5.0
|
||||||
one_shot = false
|
one_shot = false
|
||||||
autostart = false
|
autostart = false
|
||||||
|
|
||||||
[node name="Mothership" parent="." index="4" instance=ExtResource( 7 )]
|
[node name="Mothership" parent="." index="4" instance=ExtResource( 6 )]
|
||||||
|
|
||||||
[node name="MoneyDisplay" type="Label" parent="." index="5"]
|
[node name="MoneyDisplay" type="Label" parent="." index="5"]
|
||||||
|
|
||||||
|
@ -86,7 +84,7 @@ anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_top = -1.0
|
margin_top = -1.0
|
||||||
margin_right = 337.0
|
margin_right = 205.0
|
||||||
margin_bottom = 295.0
|
margin_bottom = 295.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
|
@ -110,7 +108,7 @@ anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_top = 294.0
|
margin_top = 294.0
|
||||||
margin_right = 337.0
|
margin_right = 190.0
|
||||||
margin_bottom = 600.0
|
margin_bottom = 600.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
|
@ -183,6 +181,8 @@ align = 1
|
||||||
|
|
||||||
[connection signal="shooting_speed_upgrade" from="Player" to="." method="_on_Player_shooting_speed_upgrade"]
|
[connection signal="shooting_speed_upgrade" from="Player" to="." method="_on_Player_shooting_speed_upgrade"]
|
||||||
|
|
||||||
|
[connection signal="update_display" from="Player" to="." method="_on_Player_update_display"]
|
||||||
|
|
||||||
[connection signal="timeout" from="BaddieTimer" to="." method="BaddieTimer"]
|
[connection signal="timeout" from="BaddieTimer" to="." method="BaddieTimer"]
|
||||||
|
|
||||||
[connection signal="button_down" from="UpButton" to="Player" method="upPressed"]
|
[connection signal="button_down" from="UpButton" to="Player" method="upPressed"]
|
||||||
|
|
|
@ -13,11 +13,12 @@ var timer = null
|
||||||
var bullet_delay = 0.1
|
var bullet_delay = 0.1
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
timer = Timer.new()
|
pass
|
||||||
timer.set_one_shot(true)
|
# timer = Timer.new()
|
||||||
timer.set_wait_time(bullet_delay)
|
# timer.set_one_shot(true)
|
||||||
timer.connect("timeout", self, "on_timeout_complete")
|
# timer.set_wait_time(bullet_delay)
|
||||||
add_child(timer)
|
# timer.connect("timeout", self, "on_timeout_complete")
|
||||||
|
# add_child(timer)
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
if health <= 0:
|
if health <= 0:
|
||||||
|
@ -29,16 +30,16 @@ func _process(delta):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _on_GunAimNode_area_entered(area):
|
#func _on_GunAimNode_area_entered(area):
|
||||||
for i in range(20):
|
# for i in range(20):
|
||||||
#var laser = Laser.instance()
|
# #var laser = Laser.instance()
|
||||||
#get_node("../").add_child(laser)
|
# #get_node("../").add_child(laser)
|
||||||
#laser.position.y = position.y - 27
|
# #laser.position.y = position.y - 27
|
||||||
#laser.position.x = position.x + 46
|
# #laser.position.x = position.x + 46
|
||||||
if double_laser == true:
|
# if double_laser == true:
|
||||||
var laser2 = Laser.instance()
|
# var laser2 = Laser.instance()
|
||||||
get_node("../").add_child(laser2)
|
# get_node("../").add_child(laser2)
|
||||||
laser2.position.y = position.y + 28
|
# laser2.position.y = position.y + 28
|
||||||
laser2.position.x = position.x + 46
|
# laser2.position.x = position.x + 46
|
||||||
can_shoot = false
|
# can_shoot = false
|
||||||
timer.start()
|
# timer.start()
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=7 format=2]
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Mothership.gd" type="Script" id=1]
|
[ext_resource path="res://Mothership.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://Laser.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://Laser.tscn" type="PackedScene" id=2]
|
||||||
|
@ -19,12 +19,7 @@ animations = [ {
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
} ]
|
} ]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=3]
|
[node name="Mothership" type="Area2D"]
|
||||||
|
|
||||||
custom_solver_bias = 0.0
|
|
||||||
extents = Vector2( 135.733, 138.728 )
|
|
||||||
|
|
||||||
[node name="Mothership" type="Area2D" index="0"]
|
|
||||||
|
|
||||||
position = Vector2( 23.327, 304.835 )
|
position = Vector2( 23.327, 304.835 )
|
||||||
scale = Vector2( 0.3, 0.3 )
|
scale = Vector2( 0.3, 0.3 )
|
||||||
|
@ -49,21 +44,4 @@ shape = SubResource( 1 )
|
||||||
frames = SubResource( 2 )
|
frames = SubResource( 2 )
|
||||||
animation = "default"
|
animation = "default"
|
||||||
|
|
||||||
[node name="GunAimNode" type="Area2D" parent="." index="2"]
|
|
||||||
|
|
||||||
input_pickable = true
|
|
||||||
gravity_vec = Vector2( 0, 1 )
|
|
||||||
gravity = 98.0
|
|
||||||
linear_damp = 0.1
|
|
||||||
angular_damp = 1.0
|
|
||||||
audio_bus_override = false
|
|
||||||
audio_bus_name = "Master"
|
|
||||||
|
|
||||||
[node name="GunAim" type="CollisionShape2D" parent="GunAimNode" index="0"]
|
|
||||||
|
|
||||||
position = Vector2( -178.686, -46.8981 )
|
|
||||||
shape = SubResource( 3 )
|
|
||||||
|
|
||||||
[connection signal="area_entered" from="GunAimNode" to="." method="_on_GunAimNode_area_entered"]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
128
Player.gd
128
Player.gd
|
@ -1,16 +1,22 @@
|
||||||
extends Area2D
|
extends Area2D
|
||||||
|
|
||||||
signal refund
|
signal update_display # tells parent to update points display
|
||||||
signal shooting_speed_upgrade
|
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
|
||||||
|
|
||||||
export (PackedScene) var Laser
|
export (PackedScene) var Laser
|
||||||
|
|
||||||
#Default ship strengths and costs
|
#Default ship strengths and costs
|
||||||
const SHOOTING_SPEED_UPGRADE_DEFAULT = 1500 #To be replaced
|
|
||||||
const BULLET_DELAY_TIER1 = 0.8
|
const BULLET_DELAY_TIER1 = 0.8
|
||||||
const BULLET_DELAY_TIER2 = 0.5
|
const BULLET_DELAY_TIER2 = 0.5
|
||||||
const BULLET_DELAY_TIER3 = 0.2
|
const BULLET_DELAY_TIER3 = 0.2
|
||||||
const BULLET_DELAY_TIER4 = 0.1
|
const BULLET_DELAY_TIER4 = 0.1
|
||||||
const BULLET_DELAY_TIER5 = 0.05
|
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_TIER2_COST = 100
|
||||||
const BULLET_DELAY_TIER3_COST = 200
|
const BULLET_DELAY_TIER3_COST = 200
|
||||||
const BULLET_DELAY_TIER4_COST = 400
|
const BULLET_DELAY_TIER4_COST = 400
|
||||||
|
@ -21,6 +27,12 @@ const SHIP_SPEED_TIER2 = 200
|
||||||
const SHIP_SPEED_TIER3 = 300
|
const SHIP_SPEED_TIER3 = 300
|
||||||
const SHIP_SPEED_TIER4 = 500
|
const SHIP_SPEED_TIER4 = 500
|
||||||
const SHIP_SPEED_TIER5 = 800
|
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
|
||||||
|
|
||||||
var screensize
|
var screensize
|
||||||
|
|
||||||
|
@ -32,41 +44,76 @@ var laser_penetration = 0
|
||||||
var double_laser = false
|
var double_laser = false
|
||||||
|
|
||||||
var ship_value = 0
|
var ship_value = 0
|
||||||
var refund_percentage = 1
|
var refund_percentage = 0.9
|
||||||
var money = 100
|
var money = 100
|
||||||
|
|
||||||
var shooting_speed_upgrade = SHOOTING_SPEED_UPGRADE_DEFAULT
|
var shooting_speed_upgrade = SHOOTING_SPEED_UPGRADE_DEFAULT
|
||||||
|
var ship_speed_upgrade = SHIP_SPEED_UPGRADE_DEFAULT
|
||||||
|
|
||||||
|
func upgradeMenu():
|
||||||
|
var upgmenu = preload("res://UpgradeMenu.tscn").instance()
|
||||||
|
add_child(upgmenu)
|
||||||
|
upgmenu.connect("refund", self, "_refund_button")
|
||||||
|
upgmenu.connect("bullet_delay_upgrade", self, "upgradeBulletDelay_button")
|
||||||
|
get_tree().paused = true
|
||||||
|
|
||||||
|
func upgradeBulletDelay_button():
|
||||||
|
upgradeBulletDelay()
|
||||||
|
emit_signal("update_display")
|
||||||
|
get_tree().paused = true
|
||||||
|
|
||||||
func upgradeBulletDelay():
|
func upgradeBulletDelay():
|
||||||
if (can_shoot == true):
|
if (bullet_delay == BULLET_DELAY_TIER1 && money >= BULLET_DELAY_TIER2_COST):
|
||||||
if (bullet_delay == 0.8 && money >= BULLET_DELAY_TIER2_COST):
|
bullet_delay = BULLET_DELAY_TIER2
|
||||||
bullet_delay = BULLET_DELAY_TIER2
|
money -= BULLET_DELAY_TIER2_COST
|
||||||
money -= BULLET_DELAY_TIER2_COST
|
ship_value += BULLET_DELAY_TIER2_COST
|
||||||
ship_value += BULLET_DELAY_TIER2_COST
|
elif (bullet_delay == BULLET_DELAY_TIER2 && money >= BULLET_DELAY_TIER3_COST):
|
||||||
elif (bullet_delay == 0.5 && money >= BULLET_DELAY_TIER3_COST):
|
bullet_delay = BULLET_DELAY_TIER3
|
||||||
bullet_delay = BULLET_DELAY_TIER3
|
money -= BULLET_DELAY_TIER3_COST
|
||||||
money -= BULLET_DELAY_TIER3_COST
|
ship_value += BULLET_DELAY_TIER3_COST
|
||||||
ship_value += BULLET_DELAY_TIER3_COST
|
elif (bullet_delay == BULLET_DELAY_TIER3 && money >= BULLET_DELAY_TIER4_COST):
|
||||||
elif (bullet_delay == 0.2 && money >= BULLET_DELAY_TIER4_COST):
|
bullet_delay = BULLET_DELAY_TIER4
|
||||||
bullet_delay = BULLET_DELAY_TIER4
|
money -= BULLET_DELAY_TIER4_COST
|
||||||
money -= BULLET_DELAY_TIER4_COST
|
ship_value += BULLET_DELAY_TIER4_COST
|
||||||
ship_value += BULLET_DELAY_TIER4_COST
|
elif (bullet_delay == BULLET_DELAY_TIER4 && money >= BULLET_DELAY_TIER5_COST):
|
||||||
elif (bullet_delay == 0.1 && money >= BULLET_DELAY_TIER5_COST):
|
bullet_delay = BULLET_DELAY_TIER5
|
||||||
bullet_delay = BULLET_DELAY_TIER5
|
money -= BULLET_DELAY_TIER5_COST
|
||||||
money -= BULLET_DELAY_TIER5_COST
|
ship_value += BULLET_DELAY_TIER5_COST
|
||||||
ship_value += BULLET_DELAY_TIER5_COST
|
elif (bullet_delay <= BULLET_DELAY_MINIMUM):
|
||||||
elif (bullet_delay <= 0.01):
|
emit_signal("bullet_delay_fully_upgraded")
|
||||||
emit_signal("bullet_delay_fully_upgraded")
|
elif (bullet_delay <= BULLET_DELAY_TIER5 && money >= shooting_speed_upgrade):
|
||||||
elif (bullet_delay <= 0.05 && money >= shooting_speed_upgrade):
|
bullet_delay = bullet_delay*0.95
|
||||||
bullet_delay = bullet_delay*0.95
|
money -= shooting_speed_upgrade
|
||||||
money -= shooting_speed_upgrade
|
ship_value += shooting_speed_upgrade
|
||||||
ship_value += shooting_speed_upgrade
|
shooting_speed_upgrade *= 1.1
|
||||||
shooting_speed_upgrade *= 1.1
|
timer.set_wait_time(bullet_delay)
|
||||||
|
prints(bullet_delay)
|
||||||
timer.set_wait_time(bullet_delay)
|
|
||||||
prints(bullet_delay)
|
func upgradeShipSpeed():
|
||||||
timer.start()
|
if (ship_speed == SHIP_SPEED_TIER1 && money >= SHIP_SPEED_TIER2_COST):
|
||||||
can_shoot = false
|
ship_speed = SHIP_SPEED_TIER2
|
||||||
|
money -= SHIP_SPEED_TIER2_COST
|
||||||
|
ship_value += SHIP_SPEED_TIER2_COST
|
||||||
|
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
|
||||||
|
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
|
||||||
|
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
|
||||||
|
elif (ship_speed >= SHIP_SPEED_MAXIMUM):
|
||||||
|
emit_signal("ship_speed_fully_upgraded")
|
||||||
|
elif (ship_speed >= SHIP_SPEED_TIER5 && money >= ship_speed_upgrade):
|
||||||
|
ship_speed = ship_speed*1.05
|
||||||
|
money -= ship_speed_upgrade
|
||||||
|
ship_value += ship_speed_upgrade
|
||||||
|
ship_speed_upgrade *= 1.1
|
||||||
|
prints(ship_speed)
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
timer = Timer.new()
|
timer = Timer.new()
|
||||||
|
@ -81,13 +128,16 @@ func _ready():
|
||||||
screensize = get_viewport_rect().size
|
screensize = get_viewport_rect().size
|
||||||
$AnimatedSprite.play()
|
$AnimatedSprite.play()
|
||||||
|
|
||||||
func refund():
|
func _refund_button():
|
||||||
bullet_delay = BULLET_DELAY_TIER1
|
bullet_delay = BULLET_DELAY_TIER1
|
||||||
|
timer.set_wait_time(bullet_delay)
|
||||||
ship_speed = SHIP_SPEED_TIER1
|
ship_speed = SHIP_SPEED_TIER1
|
||||||
shooting_speed_upgrade = SHOOTING_SPEED_UPGRADE_DEFAULT
|
shooting_speed_upgrade = SHOOTING_SPEED_UPGRADE_DEFAULT
|
||||||
money += ship_value*refund_percentage
|
money += ship_value*refund_percentage
|
||||||
emit_signal("refund", ship_value*refund_percentage)
|
prints("Refunded ", ship_value*refund_percentage)
|
||||||
ship_value = 0
|
ship_value = 0
|
||||||
|
emit_signal("update_display")
|
||||||
|
get_tree().paused = true
|
||||||
|
|
||||||
var timer = null
|
var timer = null
|
||||||
|
|
||||||
|
@ -99,6 +149,11 @@ var shoot_down = false
|
||||||
func on_timeout_complete():
|
func on_timeout_complete():
|
||||||
can_shoot = true
|
can_shoot = true
|
||||||
|
|
||||||
|
#func _unhandled_input(event):
|
||||||
|
# if (event is InputEventScreenTouch):
|
||||||
|
# gravity_point = true
|
||||||
|
# gravity_vec = Vector2(0.5, 0.5)
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
var velocity = Vector2() # the player's movement vector
|
var velocity = Vector2() # the player's movement vector
|
||||||
if (Input.is_action_pressed("ui_right")):
|
if (Input.is_action_pressed("ui_right")):
|
||||||
|
@ -120,6 +175,9 @@ func _process(delta):
|
||||||
shoot()
|
shoot()
|
||||||
if (Input.is_action_pressed("ui_select") && can_shoot == true):
|
if (Input.is_action_pressed("ui_select") && can_shoot == true):
|
||||||
upgradeBulletDelay()
|
upgradeBulletDelay()
|
||||||
|
if (Input.is_action_pressed("ui_reset") && can_shoot == true):
|
||||||
|
#upgradeShipSpeed()
|
||||||
|
upgradeMenu()
|
||||||
|
|
||||||
func _on_Player_body_entered(body):
|
func _on_Player_body_entered(body):
|
||||||
prints("hit")
|
prints("hit")
|
||||||
|
|
|
@ -23,8 +23,9 @@ height = 76.5834
|
||||||
[node name="Player" type="Area2D" index="0"]
|
[node name="Player" type="Area2D" index="0"]
|
||||||
|
|
||||||
input_pickable = true
|
input_pickable = true
|
||||||
gravity_vec = Vector2( 0, 1 )
|
gravity_point = true
|
||||||
gravity = 98.0
|
gravity_vec = Vector2( 10, 10 )
|
||||||
|
gravity = 1000.0
|
||||||
linear_damp = 0.1
|
linear_damp = 0.1
|
||||||
angular_damp = 1.0
|
angular_damp = 1.0
|
||||||
audio_bus_override = false
|
audio_bus_override = false
|
||||||
|
|
|
@ -6,18 +6,14 @@ signal bullet_delay_upgrade
|
||||||
signal add_laser
|
signal add_laser
|
||||||
signal plasma_lasers
|
signal plasma_lasers
|
||||||
|
|
||||||
# class member variables go here, for example:
|
var shooting_speed_tier
|
||||||
# var a = 2
|
var ship_speed_tier
|
||||||
# var b = "textvar"
|
var double_lasers
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
# Called every time the node is added to the scene.
|
|
||||||
# Initialization here
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
#func _process(delta):
|
#func _process(delta):
|
||||||
# # Called every frame. Delta is time since last frame.
|
|
||||||
# # Update game logic here.
|
|
||||||
# pass
|
# pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,4 +25,14 @@ func _on_Button_pressed():
|
||||||
func _on_Refund_pressed():
|
func _on_Refund_pressed():
|
||||||
get_tree().paused = false
|
get_tree().paused = false
|
||||||
emit_signal("refund")
|
emit_signal("refund")
|
||||||
|
$ShootingSpeedIcon.frame = 0
|
||||||
pass # replace with function body
|
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")
|
||||||
|
$ShootingSpeedIcon.frame += 1
|
||||||
|
pass
|
|
@ -1,17 +1,44 @@
|
||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://UpgradeMenu.gd" type="Script" id=1]
|
[ext_resource path="res://UpgradeMenu.gd" type="Script" id=1]
|
||||||
|
[ext_resource path="res://art/upgrade_menu/shootingspeed1.png" type="Texture" id=2]
|
||||||
|
[ext_resource path="res://art/upgrade_menu/shootingspeed2.png" type="Texture" id=3]
|
||||||
|
|
||||||
[sub_resource type="Theme" id=1]
|
[sub_resource type="Theme" id=1]
|
||||||
|
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id=2]
|
||||||
|
|
||||||
|
animations = [ {
|
||||||
|
"frames": [ ExtResource( 2 ), ExtResource( 3 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "default",
|
||||||
|
"speed": 5.0
|
||||||
|
} ]
|
||||||
|
|
||||||
[node name="UpgradeMenu" type="Node"]
|
[node name="UpgradeMenu" type="Node"]
|
||||||
|
|
||||||
pause_mode = 2
|
pause_mode = 2
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
_sections_unfolded = [ "Pause" ]
|
_sections_unfolded = [ "Pause" ]
|
||||||
|
|
||||||
[node name="Resume" type="Button" parent="." index="0"]
|
[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_right = 1026.0
|
||||||
|
margin_bottom = 605.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.188874, 0.188049, 0.203125, 1 )
|
||||||
|
|
||||||
|
[node name="Resume" type="Button" parent="." index="1"]
|
||||||
|
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
|
@ -36,9 +63,8 @@ group = null
|
||||||
text = "Resume"
|
text = "Resume"
|
||||||
flat = false
|
flat = false
|
||||||
align = 1
|
align = 1
|
||||||
_sections_unfolded = [ "Theme" ]
|
|
||||||
|
|
||||||
[node name="Refund" type="Button" parent="." index="1"]
|
[node name="Refund" type="Button" parent="." index="2"]
|
||||||
|
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
|
@ -63,8 +89,43 @@ text = "Refund"
|
||||||
flat = false
|
flat = false
|
||||||
align = 1
|
align = 1
|
||||||
|
|
||||||
|
[node name="ShootingSpeedIcon" type="AnimatedSprite" parent="." index="3"]
|
||||||
|
|
||||||
|
position = Vector2( 287.25, 218.906 )
|
||||||
|
scale = Vector2( 0.244531, 0.244531 )
|
||||||
|
frames = SubResource( 2 )
|
||||||
|
animation = "default"
|
||||||
|
|
||||||
|
[node name="ShootingSpeedUpgrade" type="Button" parent="." index="4"]
|
||||||
|
|
||||||
|
anchor_left = 0.0
|
||||||
|
anchor_top = 0.0
|
||||||
|
anchor_right = 0.0
|
||||||
|
anchor_bottom = 0.0
|
||||||
|
margin_left = 210.0
|
||||||
|
margin_top = 170.0
|
||||||
|
margin_right = 365.0
|
||||||
|
margin_bottom = 268.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="button_down" from="Resume" to="." method="_on_Resume_button_down"]
|
||||||
|
|
||||||
[connection signal="pressed" from="Resume" to="." method="_on_Button_pressed"]
|
[connection signal="pressed" from="Resume" to="." method="_on_Button_pressed"]
|
||||||
|
|
||||||
[connection signal="pressed" from="Refund" to="." method="_on_Refund_pressed"]
|
[connection signal="pressed" from="Refund" to="." method="_on_Refund_pressed"]
|
||||||
|
|
||||||
|
[connection signal="pressed" from="ShootingSpeedUpgrade" to="." method="_on_ShootingSpeedUpgrade_pressed"]
|
||||||
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
Binary file not shown.
After Width: | Height: | Size: 37 KiB |
|
@ -0,0 +1,43 @@
|
||||||
|
; Engine configuration file.
|
||||||
|
; It's best edited using the editor UI and not directly,
|
||||||
|
; since the parameters that go here are not all obvious.
|
||||||
|
;
|
||||||
|
; Format:
|
||||||
|
; [section] ; section goes between []
|
||||||
|
; param=value ; assign values to parameters
|
||||||
|
|
||||||
|
config_version=3
|
||||||
|
|
||||||
|
[application]
|
||||||
|
|
||||||
|
config/name="Fronter"
|
||||||
|
run/main_scene="res://Main.tscn"
|
||||||
|
config/icon="res://icon.png"
|
||||||
|
|
||||||
|
[display]
|
||||||
|
|
||||||
|
window/stretch/mode="2d"
|
||||||
|
|
||||||
|
[input]
|
||||||
|
|
||||||
|
ui_select=[ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":69,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":3,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
]
|
||||||
|
ui_reset=[ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":82,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":2,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
]
|
||||||
|
ctlr_l=[ Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":6,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
]
|
||||||
|
ctlr_r=[ Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":7,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
]
|
||||||
|
ctlr_a=[ Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
]
|
||||||
|
ctlr_start=[ Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
]
|
||||||
|
ui_quit=[ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777217,"unicode":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
|
||||||
|
[rendering]
|
||||||
|
|
||||||
|
environment/default_clear_color=Color( 0.210938, 0.210938, 0.210938, 1 )
|
||||||
|
environment/default_environment="res://default_env.tres"
|
Loading…
Reference in New Issue