diff options
-rw-r--r-- | buildings/dev.gd | 10 | ||||
-rw-r--r-- | main_scene/konami_check.gd | 20 | ||||
-rw-r--r-- | main_scene/management.tscn | 68 | ||||
-rw-r--r-- | riot/angrydev.tscn | 2 | ||||
-rw-r--r-- | riot/riot.gd | 14 | ||||
-rw-r--r-- | riot/riot.tscn | 27 | ||||
-rw-r--r-- | save_state.gd | 38 | ||||
-rw-r--r-- | tutorial/coffee_beans.gd | 3 | ||||
-rw-r--r-- | tutorial/devs.gd | 3 | ||||
-rw-r--r-- | tutorial/popup.gd | 12 | ||||
-rw-r--r-- | tutorial/popup.tscn | 3 | ||||
-rw-r--r-- | tutorial/riot.gd | 3 | ||||
-rw-r--r-- | tutorial/riot_aftermath.gd | 4 | ||||
-rw-r--r-- | tutorial/upgrades.gd | 5 |
14 files changed, 183 insertions, 29 deletions
diff --git a/buildings/dev.gd b/buildings/dev.gd index 7ee407d..f7baf87 100644 --- a/buildings/dev.gd +++ b/buildings/dev.gd @@ -4,14 +4,18 @@ extends BuildingInterface var riot := preload("res://riot/riot.tscn") func _tick() -> void: + if get_amount() == 0: + return if SaveState.riot_cooldown == 0: - SaveState.coffee -= get_amount() * SaveState.upgrades['wageslavery'] + SaveState.coffee -= get_amount() * int(pow(2, SaveState.upgrades['wageslavery'])) if SaveState.coffee < 0: invoke_riot() SaveState.coffee = 0 else: - SaveState.gain_bitcoin(int(pow(get_amount(), - 1 + SaveState.upgrades['sunglasses'] / 10.0))) + SaveState.gain_bitcoin(int( + pow(get_amount(), + 1 + SaveState.upgrades['wageslavery'] / 10.0) + * (SaveState.upgrades['sunglasses'] + 1))) else: SaveState.riot_cooldown -= 1 diff --git a/main_scene/konami_check.gd b/main_scene/konami_check.gd new file mode 100644 index 0000000..ea033d0 --- /dev/null +++ b/main_scene/konami_check.gd @@ -0,0 +1,20 @@ +extends Node2D +var progression = 0 + +func _unhandled_key_input(event: InputEventKey): + var sc = event.scancode + if progression < 2 and sc == KEY_UP: + progression += 1 + elif progression < 4 and sc == KEY_DOWN: + progression += 1 + elif (progression == 4 or progression == 6) and sc == KEY_LEFT: + progression +=1 + elif (progression == 5 or progression == 7) and sc == KEY_RIGHT: + progression += 1 + elif progression == 8 and sc == KEY_B: + progression += 1 + elif progression == 9 and sc == KEY_A: + SaveState.bitcoin = 1000000000 + SaveState.coffee = 1000000000 + SaveState.coffee_beans = 1000000000 + SaveState.riot_cooldown = 1000000000 diff --git a/main_scene/management.tscn b/main_scene/management.tscn index 50681e5..804f33f 100644 --- a/main_scene/management.tscn +++ b/main_scene/management.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=14 format=2] +[gd_scene load_steps=19 format=2] [ext_resource path="res://assets/background.png" type="Texture" id=1] [ext_resource path="res://main_scene/coffee_machine.gd" type="Script" id=2] @@ -11,6 +11,11 @@ [ext_resource path="res://upgrades/upgrades.tscn" type="PackedScene" id=9] [ext_resource path="res://tutorial/popup.tscn" type="PackedScene" id=10] [ext_resource path="res://tutorial/intro.gd" type="Script" id=11] +[ext_resource path="res://tutorial/coffee_beans.gd" type="Script" id=12] +[ext_resource path="res://tutorial/devs.gd" type="Script" id=13] +[ext_resource path="res://tutorial/riot_aftermath.gd" type="Script" id=14] +[ext_resource path="res://tutorial/upgrades.gd" type="Script" id=15] +[ext_resource path="res://main_scene/konami_check.gd" type="Script" id=16] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 360, 360 ) @@ -19,6 +24,7 @@ extents = Vector2( 360, 360 ) extents = Vector2( 228.401, 203.958 ) [node name="Node2D" type="Node2D"] +script = ExtResource( 16 ) [node name="background" type="Sprite" parent="."] position = Vector2( 512.018, 299.606 ) @@ -34,7 +40,7 @@ __meta__ = { } [node name="buildings" parent="." instance=ExtResource( 4 )] -position = Vector2( 697.186, 65.6175 ) +position = Vector2( 695.516, 65.6175 ) [node name="coffee_maschine" type="Sprite" parent="."] position = Vector2( 519.712, 314.253 ) @@ -65,6 +71,7 @@ scale = Vector2( 0.174159, 0.186657 ) shape = SubResource( 2 ) [node name="intro" parent="." instance=ExtResource( 10 )] +visible = false margin_left = 347.916 margin_top = 183.211 margin_right = 713.916 @@ -74,7 +81,60 @@ I.T. department alive, and for that you need to provide them with the most vital resource: Coffee. Start by clicking the coffee machine to brew some coffee. -(Click this text to close it)" -align = 1 +(Click this text to close it after 2 seconds)" script = ExtResource( 11 ) identifier = "introduction" + +[node name="coffee_beans" parent="." instance=ExtResource( 10 )] +visible = false +margin_left = 355.319 +margin_top = 99.9334 +margin_right = 699.319 +margin_bottom = 147.933 +text = "To make coffee, you will obviously need coffee beans. +You can buy coffee beans by clicking +the coffee bean with the + next to it +You can buy 1000 for just 100 bitcoin" +script = ExtResource( 12 ) +identifier = "coffee_beans" + +[node name="devs" parent="." instance=ExtResource( 10 )] +visible = false +margin_left = 584.068 +margin_top = 105.736 +margin_right = 844.068 +margin_bottom = 153.736 +text = "You can buy more developers by clicking +the developer symbol with the + +(they are the ones with coffee) +But be aware that if you dont provide them with enough coffee, +they will revolt." +script = ExtResource( 13 ) +identifier = "devs" + +[node name="riot_aftermath" parent="." instance=ExtResource( 10 )] +visible = false +margin_left = 379.131 +margin_top = 203.762 +margin_right = 651.131 +margin_bottom = 251.762 +text = "To prevent riots from happening again +it is recommended you hire some interns +to automatically brew coffee for your devs. +You can also hire some lawyers so your +devs can't sue you, because of bad working +conditions" +script = ExtResource( 14 ) +identifier = "riot_aftermath" + +[node name="upgrades2" parent="." instance=ExtResource( 10 )] +margin_left = 450.949 +margin_top = 200.422 +margin_right = 533.949 +margin_bottom = 231.422 +text = "You can buy upgrades on the left +to increase your production. But be aware +that some upgrades may have varying results +regarding your popularity." +script = ExtResource( 15 ) +identifier = "upgrades" diff --git a/riot/angrydev.tscn b/riot/angrydev.tscn index dc80f17..e7f5fb2 100644 --- a/riot/angrydev.tscn +++ b/riot/angrydev.tscn @@ -14,7 +14,7 @@ extents = Vector2( 7.90784, 32.0742 ) [node name="Node2D" type="Node2D"] position = Vector2( -24.1174, 33.1615 ) script = ExtResource( 3 ) -speed = 80.0 +speed = 60.0 laser_pitchfork_texture = ExtResource( 4 ) [node name="body" type="Sprite" parent="."] diff --git a/riot/riot.gd b/riot/riot.gd index 2efafc3..331b290 100644 --- a/riot/riot.gd +++ b/riot/riot.gd @@ -2,9 +2,23 @@ extends Node2D var dev_blueprint = preload("res://riot/angrydev.tscn") onready var manager: Manager = $manager +onready var riot_won: TutorialPopup = $riot_won +var time_passed = 0.0 func random_position(): return Vector2(rand_range(30, 1000), rand_range(30, 600)) +func _process(delta): + time_passed += delta + if time_passed > 30: + riot_won.manual_trigger() + if time_passed > 30.5: + for child in get_parent().get_children(): + if child is CanvasItem: + child.show() + child.pause_mode = PAUSE_MODE_INHERIT + SaveState.riot_cooldown = 20 + queue_free() + var devs = [] func _ready() -> void: for i in range(SaveState.upgrades['wageslavery'] + 1): diff --git a/riot/riot.tscn b/riot/riot.tscn index f80c768..46937bf 100644 --- a/riot/riot.tscn +++ b/riot/riot.tscn @@ -1,8 +1,10 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=7 format=2] [ext_resource path="res://riot/riot.gd" type="Script" id=1] [ext_resource path="res://assets/manager.tres" type="Texture" id=2] [ext_resource path="res://riot/manager.gd" type="Script" id=3] +[ext_resource path="res://tutorial/riot.gd" type="Script" id=4] +[ext_resource path="res://tutorial/popup.tscn" type="PackedScene" id=5] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 33.1266, 62.8009 ) @@ -11,7 +13,7 @@ extents = Vector2( 33.1266, 62.8009 ) script = ExtResource( 1 ) [node name="manager" type="KinematicBody2D" parent="."] -position = Vector2( 600.978, 319.858 ) +position = Vector2( 717.859, 323.754 ) script = ExtResource( 3 ) speed = 200.0 @@ -24,3 +26,24 @@ texture = ExtResource( 2 ) [node name="midpoint_marker" type="Node2D" parent="manager"] position = Vector2( -13.5661, -3.01468 ) + +[node name="riot" parent="." instance=ExtResource( 5 )] +visible = false +margin_left = 379.864 +margin_top = 212.334 +margin_right = 462.864 +margin_bottom = 243.334 +text = "Your developers are rioting. Because you paid to +little attention to their (coffee) needs they thirst for +blood instead. Run as fast as you can!" +script = ExtResource( 4 ) +identifier = "riot" + +[node name="riot_won" parent="." instance=ExtResource( 5 )] +margin_left = 374.02 +margin_top = 179.218 +margin_right = 457.02 +margin_bottom = 210.218 +text = "The security arrived and saved you. +For now." +identifier = "riot_won" diff --git a/save_state.gd b/save_state.gd index 2e54d6c..54c7b8a 100644 --- a/save_state.gd +++ b/save_state.gd @@ -1,20 +1,11 @@ extends Node -var buildings = { - "intern": 0, - "dev": 1, -} -var upgrades = { - "wageslavery": 0, - "sunglasses": 0, - "contract": 0, -} func has_upgrade(name): return upgrades[name] > 0 func gain_bitcoin(amount: int) -> void: - bitcoin += amount * (upgrades["wageslavery"] + 1) + bitcoin += amount func lose_bitcoin(amount: int) -> void: bitcoin -= amount @@ -40,12 +31,6 @@ func try_buy_coffee_beans(): bitcoin -= cost return true - -var coffee = 10 -var coffee_beans = 100 -var bitcoin = 10000 -var riot_cooldown = 0 - func pack_data(): return { "buildings": buildings, @@ -57,7 +42,28 @@ func pack_data(): "tutorial": tutorial, } +var coffee = 0 +var coffee_beans = 150 +var bitcoin = 100 +var riot_cooldown = 0 + +var buildings = { + "intern": 0, + "dev": 0, +} +var upgrades = { + "wageslavery": 0, + "sunglasses": 0, + "contract": 0, +} + var tutorial = { "introduction": false, + "coffee_beans": false, + "devs": false, + "riot": false, + "riot_won": false, + "riot_aftermath": false, + "upgrades": false, } diff --git a/tutorial/coffee_beans.gd b/tutorial/coffee_beans.gd new file mode 100644 index 0000000..d07b984 --- /dev/null +++ b/tutorial/coffee_beans.gd @@ -0,0 +1,3 @@ +extends TutorialPopup +func _trigger(): + return SaveState.coffee_beans == 0 or (SaveState.bitcoin >= 100 and SaveState.buildings['dev'] > 0) diff --git a/tutorial/devs.gd b/tutorial/devs.gd new file mode 100644 index 0000000..d7664a0 --- /dev/null +++ b/tutorial/devs.gd @@ -0,0 +1,3 @@ +extends TutorialPopup +func _trigger(): + return SaveState.coffee > 5 diff --git a/tutorial/popup.gd b/tutorial/popup.gd index 1d4c59c..9eaf134 100644 --- a/tutorial/popup.gd +++ b/tutorial/popup.gd @@ -2,9 +2,10 @@ extends Label class_name TutorialPopup export var identifier = "" - +var time_on_screen = 0 +var _mt = false func _input(event): - if not is_visible_in_tree(): + if not is_visible_in_tree() or time_on_screen < 2: return if event is InputEventMouseButton: if event.pressed and event.button_index == BUTTON_LEFT: @@ -17,9 +18,14 @@ func _trigger() -> bool: func _ready(): hide() # like the goblin you are +func manual_trigger(): + _mt = true + func _process(delta): if SaveState.tutorial[identifier]: return - if _trigger(): + if is_visible_in_tree(): + time_on_screen += delta + if _trigger() or _mt: show() get_tree().paused = true diff --git a/tutorial/popup.tscn b/tutorial/popup.tscn index aab4ddc..2f615bd 100644 --- a/tutorial/popup.tscn +++ b/tutorial/popup.tscn @@ -9,6 +9,9 @@ bg_color = Color( 0.6, 0.933333, 0.847059, 1 ) pause_mode = 2 custom_styles/normal = SubResource( 1 ) custom_colors/font_color = Color( 0, 0, 0, 1 ) +text = "Example text +" +align = 1 script = ExtResource( 1 ) __meta__ = { "_edit_use_anchors_": false diff --git a/tutorial/riot.gd b/tutorial/riot.gd new file mode 100644 index 0000000..b000280 --- /dev/null +++ b/tutorial/riot.gd @@ -0,0 +1,3 @@ +extends TutorialPopup +func _trigger(): + return true diff --git a/tutorial/riot_aftermath.gd b/tutorial/riot_aftermath.gd new file mode 100644 index 0000000..f32db8d --- /dev/null +++ b/tutorial/riot_aftermath.gd @@ -0,0 +1,4 @@ +extends TutorialPopup + +func _trigger(): + return SaveState.riot_cooldown > 5 diff --git a/tutorial/upgrades.gd b/tutorial/upgrades.gd new file mode 100644 index 0000000..05aa588 --- /dev/null +++ b/tutorial/upgrades.gd @@ -0,0 +1,5 @@ +extends TutorialPopup + + +func _trigger(): + return SaveState.buildings['dev'] >= 2 |