added icons, auto hide map

master
Martin Felis 2021-07-21 22:46:26 +02:00
parent 362da4b75d
commit 93402b7723
9 changed files with 439 additions and 19 deletions

91
assets/map.svg Normal file
View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="256"
height="256"
viewBox="0 0 67.733332 67.733335"
version="1.1"
id="svg8"
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"
sodipodi:docname="map.svg">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.4"
inkscape:cx="-99.966435"
inkscape:cy="155.06188"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1916"
inkscape:window-height="1041"
inkscape:window-x="1920"
inkscape:window-y="37"
inkscape:window-maximized="0"
units="px" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-229.26665)">
<path
style="fill:#ff9955;stroke:#000000;stroke-width:1.26499999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 46.674891,251.36961 4.820727,-7.37746 -4.820727,7.37746 5.87993,6.41447 6.681737,-9.35444 -4.810852,-8.81989 -36.883193,-5.61266 -7.216277,6.94901 -0.8018089,17.63979 6.1471989,21.64883 -5.078121,-1.87089 -3.207234,5.61266 3.474504,6.41447 39.823159,0.80181 1.640232,-1.47621 3.705159,-3.33464 -1.336348,-9.35444 z"
id="path2209"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccccccccccc" />
<path
style="fill:#ff9955;stroke:#000000;stroke-width:1.26499999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 50.683934,291.19277 -2.586463,-7.79993 1.984375,-2.07887 -34.41022,-1.07925"
id="path2211"
inkscape:connector-curvature="0" />
<path
style="fill:#ffdd55;stroke:#000000;stroke-width:0.33137852px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 24.944,240.82515 -8.994559,6.86428 -4.142232,12.18999 3.550483,8.16611 8.521162,1.1835 2.130289,9.70465 12.545047,-1.53854 8.52116,-11.83494 -4.142232,-13.25515 -10.296404,0.11836 -3.66883,-12.90009 z"
id="path2213"
inkscape:connector-curvature="0" />
<path
style="fill:#aade87;stroke:#000000;stroke-width:0.36565837px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 25.055623,246.9605 c -1.958883,1.8283 -7.57435,10.96975 -7.57435,10.96975 l 2.481252,7.31318 8.096722,3.2648 2.611848,5.22369 10.708566,-4.70131 -0.391778,-10.31679 -11.230934,-1.56711 z"
id="path2215"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#ff0000;stroke-width:4.30000019;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 30.616072,259.39135 11.24479,12.28423"
id="path2217"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="fill:none;stroke:#ff0000;stroke-width:4.30000019;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 41.671875,260.61977 C 41.388392,261.18673 31.27753,271.39209 31.27753,271.39209"
id="path2219"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

34
assets/map.svg.import Normal file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/map.svg-ddafebeea8d021f5b8860c188ece7064.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/map.svg"
dest_files=[ "res://.import/map.svg-ddafebeea8d021f5b8860c188ece7064.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
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

123
assets/parrot.svg Normal file
View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="256"
height="256"
viewBox="0 0 67.733332 67.733335"
version="1.1"
id="svg8"
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"
sodipodi:docname="parrot.svg">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.35"
inkscape:cx="21.385478"
inkscape:cy="-70.621048"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1916"
inkscape:window-height="1041"
inkscape:window-x="1920"
inkscape:window-y="37"
inkscape:window-maximized="0"
units="px" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-229.26665)">
<path
style="fill:#ff0000;stroke:#000000;stroke-width:0.13028577px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 9.8632712,240.64955 2.8953868,-7.89651 6.843644,-2.10574 8.68616,2.63217 4.91042,13.91029 5.022985,6.48998 8.577103,11.13788 17.071695,8.58536 2.32105,3.3073 -10.79189,2.8954 9.47581,4.73791 -5.79078,4.47467 -10.791896,-4.47467 -14.476939,-5.26435 -11.073819,-16.34865 -6.298505,-4.70872 v -8.94937"
id="path817-7"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccccccccccc" />
<path
style="fill:#aa4400;stroke:#000000;stroke-width:0.13028577px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 16.443696,258.02187 0.02372,17.4412 6.650387,6.07902 8.329267,3.59114 5.605979,2.21663 -3.500237,0.73715 -6.500596,1.20431 -2.895383,7.10686 7.370075,-4.47469 3.400375,0.2687 -2.350246,2.30235 -1.273667,1.85301 4.211476,-0.72579 3.283601,-4.12891 4.967681,2.87361 0.832287,-2.31555 -2.572996,-2.46687 1.792856,-0.76578 0.630592,-5.01559 L 32.0182,265.39512"
id="path819-0"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccccccccccccc" />
<path
style="fill:#ffffff;stroke:#000000;stroke-width:0.13028577px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 14.810628,239.98199 2.790065,-4.14481 5.213204,3.95869 -6.328167,2.23347 z"
id="path823-9"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
style="fill:#803300;stroke:#000000;stroke-width:0.13028577px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 41.975754,281.44819 10.338571,9.34526 6.77053,-1.97519 -17.109101,-7.37007"
id="path825-3"
inkscape:connector-curvature="0" />
<path
style="fill:#d40000;stroke:#000000;stroke-width:0.42594221;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 19.091445,258.40813 2.512653,-9.12001 8.282454,1.02368 10.981235,15.54123 15.168988,8.56163 -14.703681,1.11674 9.492247,4.83919 -11.818781,3.62939 -8.282453,-7.16571 -1.023676,3.53632 z"
id="path829-6"
inkscape:connector-curvature="0" />
<path
style="fill:#1a1a1a;stroke:#000000;stroke-width:0.13028577px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 14.810628,239.98199 3.738805,-1.53688 4.264463,1.35076 -5.213203,-3.95869 z"
id="path831-0"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
style="fill:#ffcc00;stroke:#000000;stroke-width:0.13028577px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 9.8632712,240.64955 -6.777037,3.6052 -1.045722,6.39878 2.361809,4.7494 3.142638,0.95981 1.807845,-3.33424 2.6828108,-1.83704 6.501961,-3.09611 1.051101,-1.43385 -2.989447,0.3877 -3.002061,-1.62026 z"
id="path815-6"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccccc" />
<path
style="fill:#aa8800;stroke:#000000;stroke-width:0.13028577px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 9.3528042,253.0285 6.2953738,-0.71589 3.117553,-2.09387 0.822946,-3.55724 -1.051101,1.43385 -9.2007388,4.39897 z"
id="path833-2"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccc" />
<path
style="fill:#784421;stroke:#000000;stroke-width:0.13028577px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 57.851465,280.83589 8.56164,-1.25632 c 0,0 -1.90775,-2.60572 -2.28,-2.37307 -0.37224,0.23266 -8.73328,2.39918 -8.73328,2.39918 z"
id="path835-6"
inkscape:connector-curvature="0" />
<ellipse
style="opacity:1;fill:#1a1a1a;fill-opacity:1;stroke:#1a1a1a;stroke-width:0.26057157;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path837-1"
cx="18.055897"
cy="239.34993"
rx="1.5134983"
ry="1.2996348" />
<ellipse
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#1a1a1a;stroke-width:0.26057157;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path839-8"
cx="18.240177"
cy="238.88785"
rx="0.48039395"
ry="0.44272906" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.8 KiB

34
assets/parrot.svg.import Normal file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/parrot.svg-d7b6842ec6398f3afca3d8c35aac112b.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/parrot.svg"
dest_files=[ "res://.import/parrot.svg-d7b6842ec6398f3afca3d8c35aac112b.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
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

77
assets/shovel_button.svg Normal file
View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="256"
height="256"
viewBox="0 0 67.733332 67.733335"
version="1.1"
id="svg8"
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"
sodipodi:docname="shovel_button.svg">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.7"
inkscape:cx="223.62976"
inkscape:cy="-188.03254"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1916"
inkscape:window-height="1041"
inkscape:window-x="1920"
inkscape:window-y="37"
inkscape:window-maximized="0"
units="px" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-229.26665)">
<g
id="g2112"
transform="matrix(1.0541224,1.2697542,-1.2697542,1.0541224,32.730525,144.76534)"
style="fill:#cccccc;stroke:#808080">
<rect
y="42.597912"
x="35.340771"
height="6.8035736"
width="28.442703"
id="rect2106"
style="fill:#cccccc;fill-opacity:1;stroke:#808080;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<rect
y="38.81815"
x="54.52306"
height="14.2686"
width="17.103424"
id="rect2108"
style="fill:#cccccc;fill-opacity:1;stroke:#808080;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/shovel_button.svg-628a9bc45d5d05a53fcc9d2c20db78c8.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/shovel_button.svg"
dest_files=[ "res://.import/shovel_button.svg-628a9bc45d5d05a53fcc9d2c20db78c8.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
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=18 format=2]
[gd_scene load_steps=21 format=2]
[ext_resource path="res://scenes/World.gd" type="Script" id=1]
[ext_resource path="res://scenes/Grid.gd" type="Script" id=2]
@ -11,8 +11,11 @@
[ext_resource path="res://assets/boat.svg" type="Texture" id=9]
[ext_resource path="res://assets/shovel.svg" type="Texture" id=10]
[ext_resource path="res://assets/Yeah.png" type="Texture" id=11]
[ext_resource path="res://assets/shovel_button.svg" type="Texture" id=12]
[ext_resource path="res://scenes/SoundEffectsPlayer.gd" type="Script" id=13]
[ext_resource path="res://scenes/MusicPlayer.gd" type="Script" id=14]
[ext_resource path="res://assets/map.svg" type="Texture" id=15]
[ext_resource path="res://assets/parrot.svg" type="Texture" id=16]
[sub_resource type="DynamicFont" id=1]
size = 27
@ -293,36 +296,43 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Timer" type="Timer" parent="World/UI/IslandMap"]
[node name="VBoxContainer" type="VBoxContainer" parent="World/UI"]
anchor_left = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -115.0
margin_top = 92.0
margin_left = -128.0
rect_scale = Vector2( 0.5, 0.5 )
custom_constants/separation = 21
alignment = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MapButton" type="Button" parent="World/UI/VBoxContainer"]
margin_right = 115.0
margin_bottom = 100.0
margin_right = 291.0
margin_bottom = 262.0
rect_min_size = Vector2( 100, 100 )
text = "Map"
icon = ExtResource( 15 )
flat = true
[node name="BirdyButton" type="Button" parent="World/UI/VBoxContainer"]
margin_top = 121.0
margin_right = 115.0
margin_bottom = 221.0
margin_top = 283.0
margin_right = 291.0
margin_bottom = 545.0
rect_min_size = Vector2( 100, 100 )
text = "Birdy"
icon = ExtResource( 16 )
flat = true
[node name="DigButton" type="Button" parent="World/UI/VBoxContainer"]
margin_top = 242.0
margin_right = 115.0
margin_bottom = 342.0
margin_top = 566.0
margin_right = 291.0
margin_bottom = 828.0
rect_min_size = Vector2( 100, 100 )
text = "Dig"
icon = ExtResource( 12 )
flat = true
[node name="SuccessMessage" type="Control" parent="World/UI"]
anchor_left = 0.5
@ -344,9 +354,9 @@ anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -706.0
margin_left = -700.96
margin_top = -264.0
margin_right = 706.0
margin_right = 711.04
margin_bottom = 264.0
mouse_filter = 2
texture = ExtResource( 11 )

View File

@ -27,6 +27,7 @@ onready var BirdyButton = get_node("UI/VBoxContainer/BirdyButton")
onready var DigButton = get_node("UI/VBoxContainer/DigButton")
onready var BirdyTimer = get_node("Birdy/Timer")
onready var MapTimer = get_node("UI/IslandMap/Timer")
var Island = preload("Island.gd")
var SpringDamper = preload("res://SpringDamper.gd")
@ -58,6 +59,8 @@ var birdy_spring_v = Vector2.ZERO
var birdy_spring_xt = Vector2.ONE
var birdy_duration = 4.0
var map_duration = 4.0
signal digging_started
signal world_generation_triggered
signal wrong_digsite
@ -128,6 +131,9 @@ func _process(delta):
if bird_flying == true:
bird_flying = false
emit_signal("bird_flight_end")
if MapTimer.time_left == 0:
emit_signal("map_closed")
func draw_hex_path (path: Array, color: Color):
@ -428,15 +434,20 @@ func on_dig_stopped():
func on_treasure_found():
SuccessMessage.visible = true
# SuccessMessage.visible = true
pass
func on_map_opened():
BirdyButton.disabled = true
IslandMap.visible = true
MapTimer.one_shot = true
MapTimer.start(map_duration)
func on_map_closed():
BirdyButton.disabled = false
IslandMap.visible = false
func on_bird_flight_started():
@ -620,7 +631,11 @@ func _unhandled_input(event):
func _on_MapButton_pressed():
IslandMap.visible = !IslandMap.visible
if IslandMap.visible:
emit_signal("map_closed")
else:
emit_signal("map_opened")
func _on_BirdyButton_pressed():

View File

@ -45,7 +45,10 @@ func _physics_process(delta):
velocity = Vector2.ZERO
else:
velocity = r_to_target.normalized() * speed
if state == State.Digging:
velocity = Vector2.ZERO
position = position + velocity * delta
var tile = Globals.WorldToHex(position)
@ -71,7 +74,6 @@ func on_leave_island():
func on_dig_start():
print ("Start digging")
state = State.Digging
DigTimer.start(2.0)