mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-12-20 20:33:11 +01:00
Badges when you don't use cards
This commit is contained in:
parent
e87e29a3ed
commit
aed852122b
10 changed files with 278 additions and 12 deletions
134
images/cli-badge.svg
Normal file
134
images/cli-badge.svg
Normal file
|
@ -0,0 +1,134 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<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:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="200.60274mm"
|
||||
height="162.44856mm"
|
||||
viewBox="0 0 200.60273 162.44856"
|
||||
version="1.1"
|
||||
id="svg8"
|
||||
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07, custom)"
|
||||
sodipodi:docname="cli-badge.svg">
|
||||
<defs
|
||||
id="defs2">
|
||||
<inkscape:path-effect
|
||||
effect="spiro"
|
||||
id="path-effect857"
|
||||
is_visible="true"
|
||||
lpeversion="1" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient847">
|
||||
<stop
|
||||
style="stop-color:#eaea75;stop-opacity:1"
|
||||
offset="0"
|
||||
id="stop843" />
|
||||
<stop
|
||||
style="stop-color:#cdcd2a;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop845" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient839">
|
||||
<stop
|
||||
style="stop-color:#4d4d4d;stop-opacity:1"
|
||||
offset="0"
|
||||
id="stop835" />
|
||||
<stop
|
||||
style="stop-color:#666666;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop837" />
|
||||
</linearGradient>
|
||||
<inkscape:path-effect
|
||||
effect="spiro"
|
||||
id="path-effect835"
|
||||
is_visible="true"
|
||||
lpeversion="1" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient839"
|
||||
id="linearGradient841"
|
||||
x1="13.158374"
|
||||
y1="127.7835"
|
||||
x2="33.370918"
|
||||
y2="112.74454"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient847"
|
||||
id="linearGradient849"
|
||||
x1="9.2756014"
|
||||
y1="111.48958"
|
||||
x2="35.202553"
|
||||
y2="131.35478"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.70000001"
|
||||
inkscape:cx="198.11743"
|
||||
inkscape:cy="291.04449"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:document-rotation="0"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1705"
|
||||
inkscape:window-height="2125"
|
||||
inkscape:window-x="4284"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:snap-bbox="true"
|
||||
inkscape:bbox-paths="true"
|
||||
inkscape:snap-bbox-midpoints="true"
|
||||
inkscape:bbox-nodes="true"
|
||||
inkscape:snap-bbox-edge-midpoints="true" />
|
||||
<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(163.63879,28.856826)">
|
||||
<g
|
||||
id="g863"
|
||||
transform="matrix(6.5548501,0,0,6.5548501,-205.32919,-742.08205)">
|
||||
<rect
|
||||
style="fill:url(#linearGradient841);fill-opacity:1;stroke:url(#linearGradient849);stroke-width:2.13742;stroke-linecap:square"
|
||||
id="rect833"
|
||||
width="28.466291"
|
||||
height="22.645536"
|
||||
x="7.4289465"
|
||||
y="109.87749"
|
||||
ry="4.1035032" />
|
||||
<path
|
||||
style="fill:none;stroke:#e6e66b;stroke-width:2;stroke-linecap:square;stroke-opacity:1"
|
||||
d="m 12.185462,114.30885 2.574512,2.70257 -2.605448,2.53179"
|
||||
id="path855"
|
||||
inkscape:path-effect="#path-effect857"
|
||||
inkscape:original-d="m 12.185462,114.30885 c 0.933001,0.92888 2.574512,2.70257 2.574512,2.70257 0,0 -1.708652,1.78309 -2.605448,2.53179"
|
||||
sodipodi:nodetypes="ccc" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 4 KiB |
34
images/cli-badge.svg.import
Normal file
34
images/cli-badge.svg.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/cli-badge.svg-d681319a61408aabc3551843085f21db.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://images/cli-badge.svg"
|
||||
dest_files=[ "res://.import/cli-badge.svg-d681319a61408aabc3551843085f21db.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
|
|
@ -136,6 +136,7 @@ func try_play(full_command):
|
|||
var terminal = $"../../../..".terminal
|
||||
terminal.send_command(full_command)
|
||||
#yield(terminal, "command_done")
|
||||
game.used_cards = true
|
||||
$PlaySound.play()
|
||||
var particles = preload("res://scenes/card_particles.tscn").instance()
|
||||
particles.position = position
|
||||
|
|
21
scenes/cli_badge.gd
Normal file
21
scenes/cli_badge.gd
Normal file
|
@ -0,0 +1,21 @@
|
|||
extends TextureRect
|
||||
|
||||
export var active = true setget _set_active
|
||||
export var sparkling = true setget _set_sparkling
|
||||
|
||||
|
||||
func _ready():
|
||||
_set_sparkling(sparkling)
|
||||
|
||||
func _set_active(new_active):
|
||||
active = new_active
|
||||
if active:
|
||||
self.modulate = Color(1, 1, 1)
|
||||
else:
|
||||
self.modulate = Color(0.2, 0.2, 0.2)
|
||||
sparkling = false
|
||||
|
||||
func _set_sparkling(new_sparkling):
|
||||
sparkling = new_sparkling
|
||||
if $Particles2D:
|
||||
$Particles2D.emitting = sparkling
|
45
scenes/cli_badge.tscn
Normal file
45
scenes/cli_badge.tscn
Normal file
|
@ -0,0 +1,45 @@
|
|||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://images/cli-badge.svg" type="Texture" id=1]
|
||||
[ext_resource path="res://scenes/cli_badge.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="Curve" id=2]
|
||||
_data = [ Vector2( 0, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ]
|
||||
|
||||
[sub_resource type="CurveTexture" id=3]
|
||||
curve = SubResource( 2 )
|
||||
|
||||
[sub_resource type="ParticlesMaterial" id=1]
|
||||
emission_shape = 2
|
||||
emission_box_extents = Vector3( 20, 20, 1 )
|
||||
flag_disable_z = true
|
||||
spread = 180.0
|
||||
gravity = Vector3( 0, 0, 0 )
|
||||
initial_velocity = 75.0
|
||||
initial_velocity_random = 0.47
|
||||
orbit_velocity = 0.0
|
||||
orbit_velocity_random = 0.0
|
||||
scale = 7.25
|
||||
scale_curve = SubResource( 3 )
|
||||
color = Color( 0.913725, 0.913725, 0.447059, 1 )
|
||||
|
||||
[node name="CLIBadge" type="TextureRect"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
rect_min_size = Vector2( 45, 0 )
|
||||
size_flags_stretch_ratio = 0.0
|
||||
texture = ExtResource( 1 )
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Particles2D" type="Particles2D" parent="."]
|
||||
show_behind_parent = true
|
||||
position = Vector2( 21.7701, 14.5133 )
|
||||
z_index = 1
|
||||
amount = 3
|
||||
randomness = 0.34
|
||||
process_material = SubResource( 1 )
|
|
@ -6,6 +6,7 @@ var fake_editor
|
|||
|
||||
var dragged_object
|
||||
var energy = 2
|
||||
var used_cards = false
|
||||
|
||||
var current_chapter = 0
|
||||
var current_level = 0
|
||||
|
@ -28,7 +29,7 @@ func copy_script_to_game_env(name):
|
|||
global_shell.run("chmod u+x '%s'" % (tmp_prefix + name))
|
||||
|
||||
func _initial_state():
|
||||
return {"history": [], "solved_levels": [], "received_hints": []}
|
||||
return {"history": [], "solved_levels": [], "received_hints": [], "cli_badge": []}
|
||||
|
||||
func save_state():
|
||||
var savegame = File.new()
|
||||
|
|
|
@ -32,16 +32,28 @@ func reload():
|
|||
level_list.add_child(l)
|
||||
|
||||
for level in chapter.levels:
|
||||
var hb = HBoxContainer.new()
|
||||
|
||||
var b = Button.new()
|
||||
b.text = level.title
|
||||
b.align = HALIGN_LEFT
|
||||
b.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
|
||||
b.connect("pressed", self, "load", [chapter_id, level_id])
|
||||
var slug = chapter.slug + "/" + level.slug
|
||||
if slug in game.state["solved_levels"]:
|
||||
b.set("custom_colors/font_color", Color(0.1, 0.8, 0.1, 1))
|
||||
b.set("custom_colors/font_color_hover", Color(0.1, 0.8, 0.1, 1))
|
||||
b.set("custom_colors/font_color_pressed", Color(0.1, 0.8, 0.1, 1))
|
||||
level_list.add_child(b)
|
||||
|
||||
hb.add_child(b)
|
||||
#
|
||||
var badge = preload("res://scenes/cli_badge.tscn").instance()
|
||||
hb.add_child(badge)
|
||||
badge.active = slug in game.state["cli_badge"]
|
||||
badge.sparkling = false
|
||||
|
||||
level_list.add_child(hb)
|
||||
level_id += 1
|
||||
|
||||
chapter_id += 1
|
||||
|
|
|
@ -52,5 +52,9 @@ text = "Reload"
|
|||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="Button2"]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
[connection signal="pressed" from="Button" to="." method="back"]
|
||||
[connection signal="pressed" from="Button2" to="." method="reload"]
|
||||
|
|
|
@ -50,7 +50,8 @@ func _process(delta):
|
|||
var length = _hint_client_connection.get_u32()
|
||||
var message = _hint_client_connection.get_string(length)
|
||||
game.notify(message)
|
||||
|
||||
if game.used_cards:
|
||||
$Menu/CLIBadge.active = false
|
||||
|
||||
func load_chapter(id):
|
||||
game.current_chapter = id
|
||||
|
@ -61,6 +62,9 @@ func load_level(level_id):
|
|||
level_congrats.hide()
|
||||
level_description.show()
|
||||
game.current_level = level_id
|
||||
game.used_cards = false
|
||||
$Menu/CLIBadge.active = true
|
||||
$Menu/CLIBadge.sparkling = false
|
||||
|
||||
AudioServer.set_bus_mute(AudioServer.get_bus_index("Master"), true)
|
||||
|
||||
|
@ -169,12 +173,14 @@ func show_win_status(win_states):
|
|||
level_description.hide()
|
||||
level_congrats.show()
|
||||
$SuccessSound.play()
|
||||
if not game.state.has("solved_levels"):
|
||||
game.state["solved_levels"] = []
|
||||
var slug = levels.chapters[game.current_chapter].slug + "/" + level.slug
|
||||
if not slug in game.state["solved_levels"]:
|
||||
game.state["solved_levels"].push_back(slug)
|
||||
game.save_state()
|
||||
if not game.used_cards and not slug in game.state["cli_badge"]:
|
||||
game.state["cli_badge"].push_back(slug)
|
||||
game.save_state()
|
||||
$Menu/CLIBadge.sparkling = true
|
||||
|
||||
#func repopulate_levels():
|
||||
# levels.reload()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=12 format=2]
|
||||
[gd_scene load_steps=13 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/terminal.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://scenes/main.gd" type="Script" id=2]
|
||||
|
@ -9,11 +9,12 @@
|
|||
[ext_resource path="res://fonts/big.tres" type="DynamicFont" id=7]
|
||||
[ext_resource path="res://sounds/success.wav" type="AudioStream" id=8]
|
||||
[ext_resource path="res://scenes/cursor.gd" type="Script" id=9]
|
||||
[ext_resource path="res://scenes/cli_badge.tscn" type="PackedScene" id=10]
|
||||
|
||||
[sub_resource type="CircleShape2D" id=2]
|
||||
[sub_resource type="CircleShape2D" id=1]
|
||||
radius = 1.0
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=1]
|
||||
[sub_resource type="StyleBoxFlat" id=2]
|
||||
content_margin_left = 10.0
|
||||
content_margin_right = 10.0
|
||||
content_margin_top = 5.0
|
||||
|
@ -189,7 +190,7 @@ collision_layer = 524288
|
|||
collision_mask = 0
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Cursor/Area2D"]
|
||||
shape = SubResource( 2 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="Menu" type="HBoxContainer" parent="."]
|
||||
margin_left = 3.86392
|
||||
|
@ -246,12 +247,19 @@ __meta__ = {
|
|||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="NextLevelButton" type="Button" parent="Menu"]
|
||||
[node name="CLIBadge" parent="Menu" instance=ExtResource( 10 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 169.0
|
||||
margin_right = 286.0
|
||||
margin_right = 214.0
|
||||
margin_bottom = 39.0
|
||||
|
||||
[node name="NextLevelButton" type="Button" parent="Menu"]
|
||||
margin_left = 222.0
|
||||
margin_right = 339.0
|
||||
margin_bottom = 39.0
|
||||
focus_mode = 0
|
||||
custom_styles/hover = SubResource( 1 )
|
||||
custom_styles/hover = SubResource( 2 )
|
||||
custom_styles/normal = ExtResource( 4 )
|
||||
enabled_focus_mode = 0
|
||||
text = "Next level"
|
||||
|
|
Loading…
Reference in a new issue