mirror of
https://github.com/tpawstdio/skyscraperrising.git
synced 2025-05-05 22:24:50 -04:00
Animanted office sprites
This commit is contained in:
parent
8fd498367b
commit
63bde9f37f
8 changed files with 59 additions and 18 deletions
|
@ -1,7 +1,32 @@
|
||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=16 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/room.gd" type="Script" id=1]
|
[ext_resource path="res://src/room.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://assets/Office/office_t0_6_1.png" type="Texture" id=2]
|
[ext_resource path="res://assets/Office/office_t0_1_3.png" type="Texture" id=2]
|
||||||
|
[ext_resource path="res://assets/Office/office_t1_2_3.png" type="Texture" id=3]
|
||||||
|
[ext_resource path="res://assets/Office/office_t0_1_5.png" type="Texture" id=4]
|
||||||
|
[ext_resource path="res://assets/Office/office_t0_1_4.png" type="Texture" id=5]
|
||||||
|
[ext_resource path="res://assets/Office/office_t0_1_6.png" type="Texture" id=6]
|
||||||
|
[ext_resource path="res://assets/Office/office_t0_1_2.png" type="Texture" id=7]
|
||||||
|
[ext_resource path="res://assets/Office/office_t0_1_1.png" type="Texture" id=8]
|
||||||
|
[ext_resource path="res://assets/Office/office_t0_1_0.png" type="Texture" id=9]
|
||||||
|
[ext_resource path="res://assets/Office/office_t1_2_1.png" type="Texture" id=10]
|
||||||
|
[ext_resource path="res://assets/Office/office_t1_2_4.png" type="Texture" id=11]
|
||||||
|
[ext_resource path="res://assets/Office/office_t1_2_2.png" type="Texture" id=12]
|
||||||
|
[ext_resource path="res://assets/Office/office_t1_2_0.png" type="Texture" id=13]
|
||||||
|
[ext_resource path="res://assets/Office/office_t1_2_5.png" type="Texture" id=14]
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id=1]
|
||||||
|
animations = [ {
|
||||||
|
"frames": [ ExtResource( 13 ), ExtResource( 10 ), ExtResource( 12 ), ExtResource( 3 ), ExtResource( 11 ), ExtResource( 14 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "v2",
|
||||||
|
"speed": 2.0
|
||||||
|
}, {
|
||||||
|
"frames": [ ExtResource( 9 ), ExtResource( 8 ), ExtResource( 7 ), ExtResource( 2 ), ExtResource( 5 ), ExtResource( 4 ), ExtResource( 6 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "v1",
|
||||||
|
"speed": 2.0
|
||||||
|
} ]
|
||||||
|
|
||||||
[node name="Office" type="Node2D"]
|
[node name="Office" type="Node2D"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
@ -11,5 +36,8 @@ room_expense = 350
|
||||||
room_capacity = 1
|
room_capacity = 1
|
||||||
is_rentable = true
|
is_rentable = true
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite" parent="."]
|
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||||
texture = ExtResource( 2 )
|
frames = SubResource( 1 )
|
||||||
|
animation = "v1"
|
||||||
|
frame = 5
|
||||||
|
playing = true
|
||||||
|
|
|
@ -6,6 +6,8 @@ var year: int = 1
|
||||||
var prev_quarter: int
|
var prev_quarter: int
|
||||||
var quarter: int = 1
|
var quarter: int = 1
|
||||||
var population: int = 0
|
var population: int = 0
|
||||||
|
var news: String
|
||||||
|
|
||||||
enum GameSpeed { SLOW, MEDIUM, FAST }
|
enum GameSpeed { SLOW, MEDIUM, FAST }
|
||||||
|
|
||||||
signal quarter_income
|
signal quarter_income
|
||||||
|
|
|
@ -1,17 +1,11 @@
|
||||||
extends Panel
|
extends Panel
|
||||||
|
|
||||||
func _ready():
|
|
||||||
$GameStatus/MoneyLbl.text = str(GameData.budget)
|
|
||||||
$GameStatus/YearNumLbl.text = str(GameData.year)
|
|
||||||
$GameStatus/QuaterNumLbl.text = str(GameData.quarter)
|
|
||||||
$GameStatus/PopNumLbl.text = str(GameData.population)
|
|
||||||
$GameMenus/NameBtn.text = GameData.tower_name
|
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
$GameStatus/MoneyLbl.text = str(GameData.budget)
|
$GameStatus/MoneyLbl.text = str(GameData.budget)
|
||||||
$GameStatus/YearNumLbl.text = str(GameData.year)
|
$GameStatus/YearNumLbl.text = str(GameData.year)
|
||||||
$GameStatus/PopNumLbl.text = str(GameData.population)
|
$GameStatus/PopNumLbl.text = str(GameData.population)
|
||||||
$GameStatus/QuaterNumLbl.text = str(GameData.quarter)
|
$GameStatus/QuaterNumLbl.text = str(GameData.quarter)
|
||||||
|
$GameMenus/NameBtn.text = GameData.tower_name
|
||||||
|
|
||||||
func _on_NameBtn_pressed():
|
func _on_NameBtn_pressed():
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
4
project/src/gui.gd
Normal file
4
project/src/gui.gd
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
func _on_NameBtn_pressed():
|
||||||
|
pass
|
|
@ -1,10 +1,12 @@
|
||||||
[gd_scene load_steps=2 format=2]
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/gpanel.gd" type="Script" id=1]
|
[ext_resource path="res://src/gpanel.gd" type="Script" id=1]
|
||||||
|
[ext_resource path="res://src/gui.gd" type="Script" id=2]
|
||||||
|
|
||||||
[node name="GUI" type="Control"]
|
[node name="GUI" type="Control"]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
|
script = ExtResource( 2 )
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
tool
|
||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
enum IncomeFrequency { ONE_TIME, QUARTERLY }
|
enum IncomeFrequency { ONE_TIME, QUARTERLY }
|
||||||
|
enum ChooseSprite { VERSION_1, VERSION_2 }
|
||||||
|
|
||||||
export var room_cost: int = 10000
|
export var room_cost: int = 10000
|
||||||
export var room_income: int
|
export var room_income: int
|
||||||
|
@ -8,6 +10,7 @@ export var room_expense: int
|
||||||
export var room_capacity: int
|
export var room_capacity: int
|
||||||
export var is_rentable: bool
|
export var is_rentable: bool
|
||||||
export(IncomeFrequency) var income_frequency = IncomeFrequency.QUARTERLY
|
export(IncomeFrequency) var income_frequency = IncomeFrequency.QUARTERLY
|
||||||
|
export(ChooseSprite) var choose_sprite = ChooseSprite.VERSION_1
|
||||||
|
|
||||||
var is_vacant: bool
|
var is_vacant: bool
|
||||||
var num_of_tenants: int
|
var num_of_tenants: int
|
||||||
|
@ -23,6 +26,12 @@ func _ready():
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
|
|
||||||
|
match choose_sprite:
|
||||||
|
ChooseSprite.VERSION_1:
|
||||||
|
$AnimatedSprite.play("v1")
|
||||||
|
ChooseSprite.VERSION_2:
|
||||||
|
$AnimatedSprite.play("v2")
|
||||||
|
|
||||||
# If the office is no longer vacant, start rent timer
|
# If the office is no longer vacant, start rent timer
|
||||||
if is_rentable == true:
|
if is_rentable == true:
|
||||||
if num_of_tenants >= room_capacity:
|
if num_of_tenants >= room_capacity:
|
||||||
|
|
|
@ -35,6 +35,7 @@ margin_right = 312.0
|
||||||
margin_bottom = 42.0
|
margin_bottom = 42.0
|
||||||
text = "Elecoms HQ"
|
text = "Elecoms HQ"
|
||||||
align = 1
|
align = 1
|
||||||
|
caret_blink = true
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,15 +7,16 @@
|
||||||
[node name="World" type="Node"]
|
[node name="World" type="Node"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
[node name="GUI" parent="." instance=ExtResource( 2 )]
|
|
||||||
|
|
||||||
[node name="Quarters" type="Timer" parent="."]
|
[node name="Quarters" type="Timer" parent="."]
|
||||||
wait_time = 10.0
|
wait_time = 10.0
|
||||||
autostart = true
|
autostart = true
|
||||||
|
|
||||||
[node name="Office" parent="." instance=ExtResource( 3 )]
|
[node name="Office" parent="." instance=ExtResource( 3 )]
|
||||||
position = Vector2( 427.577, 274.653 )
|
position = Vector2( 481.153, 260.554 )
|
||||||
income_frequency = 1
|
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite" parent="."]
|
[node name="Office2" parent="." instance=ExtResource( 3 )]
|
||||||
|
position = Vector2( 271.221, 296.175 )
|
||||||
|
choose_sprite = 1
|
||||||
|
|
||||||
|
[node name="GUI" parent="." instance=ExtResource( 2 )]
|
||||||
[connection signal="timeout" from="Quarters" to="." method="_on_Quarters_timeout"]
|
[connection signal="timeout" from="Quarters" to="." method="_on_Quarters_timeout"]
|
||||||
|
|
Loading…
Add table
Reference in a new issue