Display total sale value above postie

This commit is contained in:
Olivier 'reivilibre' 2023-01-08 21:38:48 +00:00
parent fc762e6bfd
commit 40a2075779
8 changed files with 195 additions and 1 deletions

1
.gitattributes vendored
View File

@ -1,3 +1,4 @@
*.png filter=lfs diff=lfs merge=lfs -text
*.kra filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text
*.otf filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,123 @@
THE ATTACHED FONT IS A SUBSET OF GIDOLE.
Gidole is dual licensed - pick the one you prefer:
The MIT License (MIT)
Copyright (c) 2015 Andreas Larsen @larsenwork
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Copyright (c) 2015, Andreas Larsen @larsenwork
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

BIN
fonts/Gidolinya-Regular-SubsetOHLD52.otf (Stored with Git LFS) Normal file

Binary file not shown.

BIN
ui/coin.kra (Stored with Git LFS) Normal file

Binary file not shown.

BIN
ui/coin.png (Stored with Git LFS) Normal file

Binary file not shown.

35
ui/coin.png.import Normal file
View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/coin.png-4de1d7bdc6c695f71fe960914c2dff6f.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ui/coin.png"
dest_files=[ "res://.import/coin.png-4de1d7bdc6c695f71fe960914c2dff6f.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

View File

@ -97,14 +97,20 @@ func _on_Tween_tween_all_completed():
var sale_value_so_far = 0
func _update_sale_value():
# the 4 spaces give a gap for the coin symbol
$SaleValueLabel.text = "Total Sale Value:\n " + str(sale_value_so_far)
func _on_SaleArea_body_entered(body):
#print("SA enter ", body)
if body.is_in_group("saleable") and body.sale_value != null:
sale_value_so_far += body.sale_value
self._update_sale_value()
func _on_SaleArea_body_exited(body):
#print("SA exit ", body)
if body.is_in_group("saleable") and body.sale_value != null:
sale_value_so_far -= body.sale_value
self._update_sale_value()

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=14 format=2]
[gd_scene load_steps=17 format=2]
[ext_resource path="res://vehicles/postie_backramp.png" type="Texture" id=1]
[ext_resource path="res://vehicles/postie_back.png" type="Texture" id=2]
@ -9,6 +9,8 @@
[ext_resource path="res://sfx/backgate_open.wav" type="AudioStream" id=7]
[ext_resource path="res://sfx/backgate_closed.wav" type="AudioStream" id=8]
[ext_resource path="res://sfx/engine_start_and_drive.wav" type="AudioStream" id=9]
[ext_resource path="res://fonts/Gidolinya-Regular-SubsetOHLD52.otf" type="DynamicFontData" id=10]
[ext_resource path="res://ui/coin.png" type="Texture" id=11]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 28.9012, 1.69078 )
@ -22,6 +24,10 @@ extents = Vector2( 92.5, 1.5 )
[sub_resource type="RectangleShape2D" id=4]
extents = Vector2( 89, 47 )
[sub_resource type="DynamicFont" id=5]
size = 24
font_data = ExtResource( 10 )
[node name="Postie" type="Node2D"]
script = ExtResource( 5 )
@ -85,6 +91,20 @@ collision_mask = 16
position = Vector2( 136, 21 )
shape = SubResource( 4 )
[node name="SaleValueLabel" type="Label" parent="."]
margin_left = 43.0
margin_top = -82.0
margin_right = 204.0
margin_bottom = -25.0
custom_colors/font_color = Color( 0, 0.192157, 0.0196078, 1 )
custom_fonts/font = SubResource( 5 )
text = "Total Sale Value:
0"
[node name="Coin" type="Sprite" parent="."]
position = Vector2( 51, -39 )
texture = ExtResource( 11 )
[connection signal="tween_all_completed" from="Tween" to="." method="_on_Tween_tween_all_completed"]
[connection signal="body_entered" from="SaleArea" to="." method="_on_SaleArea_body_entered"]
[connection signal="body_exited" from="SaleArea" to="." method="_on_SaleArea_body_exited"]