This commit is contained in:
Mike Schwörer 2022-01-28 00:28:17 +01:00
parent 792b95365c
commit ebc6cc26c7
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
21 changed files with 271 additions and 32 deletions

View File

@ -1 +0,0 @@

View File

@ -1,3 +0,0 @@
source_md5="47313fa4c47a9963fddd764e1ec6e4a8"
dest_md5="26ea799ea0a3da9e753b3ebe822e0570"

1
Builds/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*

0
Builds/.gitkeep Normal file
View File

View File

@ -0,0 +1,3 @@
[gd_resource type="DynamicFont" format=2]
[resource]

Binary file not shown.

View File

@ -4,9 +4,10 @@
[ext_resource path="res://sprites/bringmans/bm00.png" type="Texture" id=2] [ext_resource path="res://sprites/bringmans/bm00.png" type="Texture" id=2]
[sub_resource type="CircleShape2D" id=1] [sub_resource type="CircleShape2D" id=1]
radius = 22.3607 radius = 21.0238
[node name="KinematicBody2D" type="KinematicBody2D"] [node name="KinematicBody2D" type="KinematicBody2D"]
collision_mask = 14
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="shape" type="CollisionShape2D" parent="."] [node name="shape" type="CollisionShape2D" parent="."]

View File

@ -7,6 +7,8 @@
radius = 82.2982 radius = 82.2982
[node name="KinematicBody2D" type="KinematicBody2D"] [node name="KinematicBody2D" type="KinematicBody2D"]
collision_layer = 2
collision_mask = 15
script = ExtResource( 2 ) script = ExtResource( 2 )
[node name="sprite" type="Sprite" parent="."] [node name="sprite" type="Sprite" parent="."]

View File

@ -1,45 +1,59 @@
[gd_scene load_steps=6 format=2] [gd_scene load_steps=8 format=2]
[ext_resource path="res://scenes/city.tscn" type="PackedScene" id=1] [ext_resource path="res://scenes/city.tscn" type="PackedScene" id=1]
[ext_resource path="res://scenes/market.tscn" type="PackedScene" id=2] [ext_resource path="res://scenes/market.tscn" type="PackedScene" id=2]
[ext_resource path="res://scenes/btnAdd.tscn" type="PackedScene" id=3] [ext_resource path="res://scenes/btnAdd.tscn" type="PackedScene" id=3]
[ext_resource path="res://scripts/main.gd" type="Script" id=4] [ext_resource path="res://scripts/main.gd" type="Script" id=4]
[ext_resource path="res://sprites/background.jpg" type="Texture" id=5] [ext_resource path="res://sprites/background.jpg" type="Texture" id=5]
[ext_resource path="res://sprites/spawn.png" type="Texture" id=6]
[ext_resource path="res://scenes/moneyframe.tscn" type="PackedScene" id=7]
[node name="Node2D" type="Node2D"] [node name="Node2D" type="Node2D"]
script = ExtResource( 4 ) script = ExtResource( 4 )
[node name="bringman_parent" type="Node2D" parent="."] [node name="ParallaxBackground" type="ParallaxBackground" parent="."]
scale = Vector2( 0.86, 0.86 )
transform = Transform2D( 0.86, 0, 0, 0.86, 0, 0 )
[node name="btnAdd" parent="." instance=ExtResource( 3 )] [node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"]
position = Vector2( 271, 964 ) motion_mirroring = Vector2( 612, 601 )
__meta__ = {
"_edit_group_": true
}
[node name="Sprite" type="Sprite" parent="ParallaxBackground/ParallaxLayer"]
texture = ExtResource( 5 )
centered = false
__meta__ = {
"_edit_group_": true
}
[node name="bringman_parent" type="Node2D" parent="."]
[node name="city_parent" type="Node2D" parent="."] [node name="city_parent" type="Node2D" parent="."]
[node name="city4" parent="city_parent" instance=ExtResource( 1 )] [node name="city4" parent="city_parent" instance=ExtResource( 1 )]
position = Vector2( 468, 803 ) position = Vector2( 468, 803 )
scale = Vector2( 0.4, 0.4 )
[node name="city5" parent="city_parent" instance=ExtResource( 1 )] [node name="city5" parent="city_parent" instance=ExtResource( 1 )]
position = Vector2( 487, 164 ) position = Vector2( 483, 233 )
scale = Vector2( 0.6, 0.6 )
[node name="city6" parent="city_parent" instance=ExtResource( 1 )] [node name="city6" parent="city_parent" instance=ExtResource( 1 )]
position = Vector2( 134, 691 ) position = Vector2( 134, 691 )
scale = Vector2( 0.3225, 0.3225 ) scale = Vector2( 0.3225, 0.3225 )
[node name="city1" parent="city_parent" instance=ExtResource( 1 )]
position = Vector2( 77, 492 )
scale = Vector2( 0.236719, 0.236719 )
[node name="city2" parent="city_parent" instance=ExtResource( 1 )] [node name="city2" parent="city_parent" instance=ExtResource( 1 )]
position = Vector2( 177, 498 ) position = Vector2( 108, 435 )
scale = Vector2( 0.279687, 0.279687 ) scale = Vector2( 0.279687, 0.279687 )
[node name="city3" parent="city_parent" instance=ExtResource( 1 )] [node name="city3" parent="city_parent" instance=ExtResource( 1 )]
position = Vector2( 397, 372 ) position = Vector2( 440, 398 )
scale = Vector2( 0.588984, 0.588984 ) scale = Vector2( 0.588984, 0.588984 )
[node name="city7" parent="city_parent" instance=ExtResource( 1 )] [node name="city7" parent="city_parent" instance=ExtResource( 1 )]
position = Vector2( 269, 80 ) position = Vector2( 350, 151 )
scale = Vector2( 0.401485, 0.401485 ) scale = Vector2( 0.401485, 0.401485 )
[node name="city8" parent="city_parent" instance=ExtResource( 1 )] [node name="city8" parent="city_parent" instance=ExtResource( 1 )]
@ -47,23 +61,28 @@ position = Vector2( 89, 878 )
scale = Vector2( 0.681, 0.681 ) scale = Vector2( 0.681, 0.681 )
[node name="city9" parent="city_parent" instance=ExtResource( 1 )] [node name="city9" parent="city_parent" instance=ExtResource( 1 )]
position = Vector2( 94, 315 ) position = Vector2( 58, 174 )
scale = Vector2( 0.520999, 0.520999 ) scale = Vector2( 0.520999, 0.520999 )
[node name="market_parent" type="Node2D" parent="."] [node name="market_parent" type="Node2D" parent="."]
[node name="market1" parent="market_parent" instance=ExtResource( 2 )] [node name="market1" parent="market_parent" instance=ExtResource( 2 )]
position = Vector2( 110, 162 ) position = Vector2( 232, 265 )
scale = Vector2( 0.5, 0.5 )
[node name="market2" parent="market_parent" instance=ExtResource( 2 )] [node name="market2" parent="market_parent" instance=ExtResource( 2 )]
position = Vector2( 328, 615 ) position = Vector2( 437, 622 )
scale = Vector2( 0.5, 0.5 )
[node name="ParallaxBackground" type="ParallaxBackground" parent="."] [node name="market3" parent="market_parent" instance=ExtResource( 2 )]
follow_viewport_enable = true position = Vector2( 69, 582 )
scale = Vector2( 0.25, 0.25 )
[node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"] [node name="btnAdd" parent="." instance=ExtResource( 3 )]
motion_mirroring = Vector2( 612, 601 ) position = Vector2( 288, 975 )
scale = Vector2( 0.8, 0.8 )
texture = ExtResource( 6 )
[node name="Sprite" type="Sprite" parent="ParallaxBackground/ParallaxLayer"] [node name="moneyframe" parent="." instance=ExtResource( 7 )]
texture = ExtResource( 5 ) position = Vector2( 554, 22 )
centered = false scale = Vector2( 0.2, 0.2 )

View File

@ -7,6 +7,8 @@
radius = 80.604 radius = 80.604
[node name="KinematicBody2D" type="KinematicBody2D"] [node name="KinematicBody2D" type="KinematicBody2D"]
collision_layer = 4
collision_mask = 15
script = ExtResource( 2 ) script = ExtResource( 2 )
[node name="shape" type="CollisionShape2D" parent="."] [node name="shape" type="CollisionShape2D" parent="."]

View File

@ -0,0 +1,44 @@
[gd_scene load_steps=6 format=2]
[ext_resource path="res://sprites/stone_bg.jpg" type="Texture" id=1]
[ext_resource path="res://resources/digital-7 (mono).ttf" type="DynamicFontData" id=2]
[ext_resource path="res://sprites/money.png" type="Texture" id=3]
[ext_resource path="res://scripts/moneyframe.gd" type="Script" id=4]
[sub_resource type="DynamicFont" id=1]
size = 300
outline_size = 8
font_data = ExtResource( 2 )
[node name="Node2D" type="Node2D"]
script = ExtResource( 4 )
[node name="border" type="Polygon2D" parent="."]
color = Color( 0.258824, 0.258824, 0.258824, 1 )
polygon = PoolVector2Array( 0, 0, 0, 440, -1230, 440, -1230, 0 )
[node name="background" type="Sprite" parent="."]
position = Vector2( -616, 216 )
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( 103, 189, 1198, 412 )
[node name="label" type="Label" parent="."]
margin_left = -1048.0
margin_top = 16.0
margin_right = -48.0
margin_bottom = 336.0
custom_colors/font_color = Color( 0.356863, 0.568627, 0.0901961, 1 )
custom_colors/font_outline_modulate = Color( 0, 0, 0, 1 )
custom_fonts/font = SubResource( 1 )
text = "00.00"
align = 2
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="sprite" type="Sprite" parent="."]
position = Vector2( -1264, 208 )
scale = Vector2( 1.20885, 1.20885 )
texture = ExtResource( 3 )

View File

@ -3,11 +3,13 @@ extends KinematicBody2D
export (NodePath) var city export (NodePath) var city
export (NodePath) var market export (NodePath) var market
export (NodePath) var company export (NodePath) var company
export (NodePath) var moneyframe
export (Vector2) var spawn export (Vector2) var spawn
var speed_spawn = 500 var speed_spawn = 400
var speed_phys = 5 var speed_phys = 5
var speed_phys_max = 550
var dest = 0 var dest = 0
var current_target = null var current_target = null
@ -28,8 +30,10 @@ func _ready():
func state_next(): func state_next():
velocity = Vector2.ZERO velocity = Vector2.ZERO
oldNodePosHitAngle = null oldNodePosHitAngle = null
current_target = null
dest+=1 dest+=1
func _process(delta): func _process(delta):
if dest == 0: if dest == 0:
move_to_pos(spawn, delta) move_to_pos(spawn, delta)
@ -52,7 +56,8 @@ func _process(delta):
wait_final-=delta wait_final-=delta
if wait_final <= 0: state_next() if wait_final <= 0: state_next()
elif dest == 8: elif dest == 8:
remove_and_skip() get_node(moneyframe).incMoney()
queue_free()
func move_to_node(np, delta): func move_to_node(np, delta):
@ -90,6 +95,7 @@ func move_to_pos(pos, delta):
if angle_prev != angle_post: if angle_prev != angle_post:
state_next() state_next()
func radius(): func radius():
return get_node("sprite").texture.get_width()*get_node("sprite").transform.get_scale().x/2 return get_node("sprite").texture.get_width()*get_node("sprite").transform.get_scale().x/2
@ -99,6 +105,9 @@ func _physics_process(delta):
velocity = move_and_slide(velocity, Vector2(0, -1)) velocity = move_and_slide(velocity, Vector2(0, -1))
if velocity.length() > speed_phys_max:
velocity = velocity.normalized() * speed_phys_max
if current_target != null: if current_target != null:
var slide_count = get_slide_count() var slide_count = get_slide_count()
if slide_count: if slide_count:

View File

@ -7,10 +7,15 @@ onready var btnAdd = get_node("btnAdd")
onready var city_parent = get_node("city_parent") onready var city_parent = get_node("city_parent")
onready var market_parent = get_node("market_parent") onready var market_parent = get_node("market_parent")
onready var bringman_parent = get_node("bringman_parent") onready var bringman_parent = get_node("bringman_parent")
onready var money_frame = get_node("moneyframe")
onready var button_diam = btnAdd.texture.get_width()*btnAdd.transform.get_scale().x onready var button_diam = btnAdd.texture.get_width()*btnAdd.transform.get_scale().x
func _ready():
randomize()
func _input(event): func _input(event):
if event is InputEventMouseButton and event.button_index == BUTTON_LEFT && event.pressed: if event is InputEventMouseButton and event.button_index == BUTTON_LEFT && event.pressed:
if (event.position - btnAdd.position).length() < button_diam/2: if (event.position - btnAdd.position).length() < button_diam/2:
@ -27,13 +32,14 @@ func spawn():
var vec_start = Vector2(0, 1).rotated(rot) var vec_start = Vector2(0, 1).rotated(rot)
var diag = sqrt(2*pow(button_diam/2, 2))
bm.position = btnAdd.position + (vec_start * -(button_diam/2 - bm.radius())) bm.position = btnAdd.position + (vec_start * -(button_diam/2 - bm.radius()))
bm.spawn = btnAdd.position + (vec_start * -(button_diam/2 + bm.radius())) bm.spawn = btnAdd.position + (vec_start * -(diag + bm.radius()))
bm.market = market.get_path() bm.market = market.get_path()
bm.city = city.get_path() bm.city = city.get_path()
bm.company = btnAdd.get_path() bm.company = btnAdd.get_path()
bm.moneyframe = money_frame.get_path()
print("spawn", bm.position)
bringman_parent.add_child(bm) bringman_parent.add_child(bm)

View File

@ -0,0 +1,51 @@
extends Node2D
var money_display = 0.0
var money_target = 0
onready var label = get_node("label")
var ticker_speed = 1
func incMoney():
money_target += 135
func _process(delta):
if updateMoney(delta):
renderMoney()
func updateMoney(delta):
if money_display == money_target:
return false
var diff = money_target - money_display
if diff < 2:
money_display = money_target
return true
delta = diff * delta * ticker_speed
if abs(delta) >= abs(diff):
money_display = money_target
return true
money_display += delta
return true
func renderMoney():
var v = round(money_display)
var hundreds = floor(v / 100)
var cents = v - hundreds*100
var lblstr = str(hundreds).pad_zeros(2) + "." + str(cents).pad_zeros(2)
label.text = lblstr

BIN
Source/sprites/money.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/money.png-f2b607e016dd23c1a3607ef6dd0194bb.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/money.png"
dest_files=[ "res://.import/money.png-f2b607e016dd23c1a3607ef6dd0194bb.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
Source/sprites/spawn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/spawn.png-e6865f3969b873bcdd891604533cc71e.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/spawn.png"
dest_files=[ "res://.import/spawn.png-e6865f3969b873bcdd891604533cc71e.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
Source/sprites/stone_bg.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/stone_bg.jpg-6187fe90ad09616e8d04c9e92b74cda1.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/stone_bg.jpg"
dest_files=[ "res://.import/stone_bg.jpg-6187fe90ad09616e8d04c9e92b74cda1.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0