Skip to content

Commit

Permalink
upgrade to work with godot 4.3 beta 3
Browse files Browse the repository at this point in the history
  • Loading branch information
markim committed Jul 18, 2024
1 parent 24ab5d8 commit 4bc43e7
Show file tree
Hide file tree
Showing 79 changed files with 3,236 additions and 1,355 deletions.
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,22 @@ mono_crash.*.json
.directory
*~
*.import

# macOS-specific ignores
.DS_Store

# Godot 4+ specific ignores
.godot/

# Godot-specific ignores
.import/
export.cfg
export_presets.cfg

# Imported translations (automatically generated from CSV files)
*.translation

# Mono-specific ignores
.mono/
data_*/
mono_crash.*.json
4 changes: 2 additions & 2 deletions GameTemplate/Assets/Fonts/pixellocale_8.tres
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[gd_resource type="FontFile" load_steps=2 format=2]

[ext_resource path="res://Assets/Fonts/pixellocale-v-1-4.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://Assets/Fonts/pixellocale-v-1-4.ttf" type="FontFile" id=1]

[resource]
size = 8
Expand Down
11 changes: 7 additions & 4 deletions GameTemplate/Assets/Sounds/TestBeep.wav.import
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
[remap]

importer="wav"
type="AudioStreamSample"
path="res://.import/TestBeep.wav-d3be0e3d1ff487c414537f0fa6dc011c.sample"
type="AudioStreamWAV"
uid="uid://ctn7x3kcgkey6"
path="res://.godot/imported/TestBeep.wav-d3be0e3d1ff487c414537f0fa6dc011c.sample"

[deps]

source_file="res://Assets/Sounds/TestBeep.wav"
dest_files=[ "res://.import/TestBeep.wav-d3be0e3d1ff487c414537f0fa6dc011c.sample" ]
dest_files=["res://.godot/imported/TestBeep.wav-d3be0e3d1ff487c414537f0fa6dc011c.sample"]

[params]

Expand All @@ -17,5 +18,7 @@ force/max_rate=false
force/max_rate_hz=44100
edit/trim=true
edit/normalize=true
edit/loop=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0
2 changes: 1 addition & 1 deletion GameTemplate/Levels/Level.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extends Node2D

export (String, FILE, "*.tscn") var Next_Scene: String
@export var Next_Scene: String # (String, FILE, "*.tscn")

func _ready()->void:
Hud.visible = true
Expand Down
104 changes: 83 additions & 21 deletions GameTemplate/Levels/TestScene.tscn
Original file line number Diff line number Diff line change
@@ -1,40 +1,102 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=6 format=3 uid="uid://c25bqavugtpfj"]

[ext_resource path="res://Levels/Level.gd" type="Script" id=1]
[ext_resource path="res://addons/GameTemplate/Assets/Fonts/pixellocale_16.tres" type="DynamicFont" id=2]
[ext_resource path="res://icon.png" type="Texture" id=3]
[ext_resource path="res://Levels/player.gd" type="Script" id=4]
[ext_resource type="Script" path="res://Levels/Level.gd" id="1"]
[ext_resource type="FontFile" uid="uid://cj1os0is1qn2h" path="res://addons/GameTemplate/Assets/Fonts/pixellocale-v-1-4.ttf" id="2_xvw7o"]
[ext_resource type="Texture2D" uid="uid://cb0tbpriomwqd" path="res://icon.png" id="3"]
[ext_resource type="Script" path="res://Levels/player.gd" id="4"]

[sub_resource type="FontFile" id="FontFile_4wxgj"]
fallbacks = Array[Font]([ExtResource("2_xvw7o")])
cache/0/16/0/ascent = 0.0
cache/0/16/0/descent = 0.0
cache/0/16/0/underline_position = 0.0
cache/0/16/0/underline_thickness = 0.0
cache/0/16/0/scale = 1.0
cache/0/50/0/ascent = 0.0
cache/0/50/0/descent = 0.0
cache/0/50/0/underline_position = 0.0
cache/0/50/0/underline_thickness = 0.0
cache/0/50/0/scale = 1.0
cache/0/2/0/ascent = 0.0
cache/0/2/0/descent = 0.0
cache/0/2/0/underline_position = 0.0
cache/0/2/0/underline_thickness = 0.0
cache/0/2/0/scale = 1.0
cache/0/3/0/ascent = 0.0
cache/0/3/0/descent = 0.0
cache/0/3/0/underline_position = 0.0
cache/0/3/0/underline_thickness = 0.0
cache/0/3/0/scale = 1.0
cache/0/4/0/ascent = 0.0
cache/0/4/0/descent = 0.0
cache/0/4/0/underline_position = 0.0
cache/0/4/0/underline_thickness = 0.0
cache/0/4/0/scale = 1.0
cache/0/5/0/ascent = 0.0
cache/0/5/0/descent = 0.0
cache/0/5/0/underline_position = 0.0
cache/0/5/0/underline_thickness = 0.0
cache/0/5/0/scale = 1.0
cache/0/6/0/ascent = 0.0
cache/0/6/0/descent = 0.0
cache/0/6/0/underline_position = 0.0
cache/0/6/0/underline_thickness = 0.0
cache/0/6/0/scale = 1.0
cache/0/7/0/ascent = 0.0
cache/0/7/0/descent = 0.0
cache/0/7/0/underline_position = 0.0
cache/0/7/0/underline_thickness = 0.0
cache/0/7/0/scale = 1.0
cache/0/8/0/ascent = 0.0
cache/0/8/0/descent = 0.0
cache/0/8/0/underline_position = 0.0
cache/0/8/0/underline_thickness = 0.0
cache/0/8/0/scale = 1.0
cache/0/9/0/ascent = 0.0
cache/0/9/0/descent = 0.0
cache/0/9/0/underline_position = 0.0
cache/0/9/0/underline_thickness = 0.0
cache/0/9/0/scale = 1.0
cache/0/10/0/ascent = 0.0
cache/0/10/0/descent = 0.0
cache/0/10/0/underline_position = 0.0
cache/0/10/0/underline_thickness = 0.0
cache/0/10/0/scale = 1.0
cache/0/15/0/ascent = 0.0
cache/0/15/0/descent = 0.0
cache/0/15/0/underline_position = 0.0
cache/0/15/0/underline_thickness = 0.0
cache/0/15/0/scale = 1.0

[node name="Level" type="Node2D"]
script = ExtResource( 1 )
script = ExtResource("1")
Next_Scene = "res://MainMenu/MainMenu.tscn"

[node name="CanvasLayer" type="CanvasLayer" parent="."]

[node name="ColorRect" type="ColorRect" parent="CanvasLayer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
color = Color( 0.662745, 1, 0.537255, 1 )
color = Color(0.662745, 1, 0.537255, 1)

[node name="Button" type="Button" parent="CanvasLayer"]
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -53.0
margin_top = -21.0
margin_right = 55.0
margin_bottom = 19.0
custom_fonts/font = ExtResource( 2 )
offset_left = -53.0
offset_top = -21.0
offset_right = 55.0
offset_bottom = 19.0
theme_override_fonts/font = SubResource("FontFile_4wxgj")
text = "GO BACK"
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Sprite" type="Sprite" parent="CanvasLayer"]
position = Vector2( 156.129, 131.574 )
scale = Vector2( 0.5, 0.5 )
texture = ExtResource( 3 )
script = ExtResource( 4 )

[node name="Sprite2D" type="Sprite2D" parent="CanvasLayer"]
position = Vector2(156.129, 131.574)
scale = Vector2(0.5, 0.5)
texture = ExtResource("3")
script = ExtResource("4")

[connection signal="pressed" from="CanvasLayer/Button" to="." method="_on_Button_pressed"]
2 changes: 1 addition & 1 deletion GameTemplate/Levels/player.gd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
extends Sprite
extends Sprite2D

var speed = 2 * 60

Expand Down
64 changes: 30 additions & 34 deletions GameTemplate/MainMenu/DefaultButton.tscn
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=6 format=3 uid="uid://px4rxhrebsso"]

[ext_resource path="res://Assets/Fonts/pixellocale_8.tres" type="DynamicFont" id=1]
[ext_resource type="FontFile" path="res://Assets/Fonts/pixellocale_8.tres" id="1"]


[sub_resource type="StyleBoxFlat" id=1]
[sub_resource type="StyleBoxFlat" id="3"]
content_margin_left = 2.0
content_margin_right = 2.0
content_margin_top = 0.0
content_margin_right = 2.0
content_margin_bottom = 1.0
bg_color = Color( 0.0705882, 0.305882, 0.537255, 1 )
bg_color = Color(0.14902, 0.168627, 0.266667, 0)
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color( 1, 1, 1, 0 )
border_color = Color(0.0705882, 0.305882, 0.537255, 1)
corner_radius_top_left = 2
corner_radius_top_right = 2
corner_radius_bottom_right = 2
Expand All @@ -24,38 +23,34 @@ expand_margin_right = 2.0
expand_margin_bottom = 1.0
anti_aliasing = false

[sub_resource type="StyleBoxFlat" id=2]
[sub_resource type="StyleBoxFlat" id="4"]
content_margin_left = 2.0
content_margin_right = 2.0
content_margin_top = 0.0
content_margin_right = 2.0
content_margin_bottom = 1.0
bg_color = Color( 0.227451, 0.266667, 0.4, 1 )
bg_color = Color(0.14902, 0.168627, 0.266667, 1)
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color( 1, 1, 1, 0 )
corner_radius_top_left = 2
corner_radius_top_right = 2
corner_radius_bottom_right = 2
corner_radius_bottom_left = 2
border_color = Color(1, 1, 1, 0)
corner_detail = 1
expand_margin_left = 2.0
expand_margin_right = 2.0
expand_margin_bottom = 1.0
anti_aliasing = false

[sub_resource type="StyleBoxFlat" id=3]
[sub_resource type="StyleBoxFlat" id="1"]
content_margin_left = 2.0
content_margin_right = 2.0
content_margin_top = 0.0
content_margin_right = 2.0
content_margin_bottom = 1.0
bg_color = Color( 0.14902, 0.168627, 0.266667, 0 )
bg_color = Color(0.0705882, 0.305882, 0.537255, 1)
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color( 0.0705882, 0.305882, 0.537255, 1 )
border_color = Color(1, 1, 1, 0)
corner_radius_top_left = 2
corner_radius_top_right = 2
corner_radius_bottom_right = 2
Expand All @@ -66,35 +61,36 @@ expand_margin_right = 2.0
expand_margin_bottom = 1.0
anti_aliasing = false

[sub_resource type="StyleBoxFlat" id=4]
[sub_resource type="StyleBoxFlat" id="2"]
content_margin_left = 2.0
content_margin_right = 2.0
content_margin_top = 0.0
content_margin_right = 2.0
content_margin_bottom = 1.0
bg_color = Color( 0.14902, 0.168627, 0.266667, 1 )
bg_color = Color(0.227451, 0.266667, 0.4, 1)
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color( 1, 1, 1, 0 )
border_color = Color(1, 1, 1, 0)
corner_radius_top_left = 2
corner_radius_top_right = 2
corner_radius_bottom_right = 2
corner_radius_bottom_left = 2
corner_detail = 1
expand_margin_left = 2.0
expand_margin_right = 2.0
expand_margin_bottom = 1.0
anti_aliasing = false

[node name="DefaultButton" type="Button"]
margin_right = 36.0
margin_bottom = 15.0
offset_right = 36.0
offset_bottom = 15.0
size_flags_horizontal = 3
size_flags_vertical = 4
custom_styles/hover = SubResource( 1 )
custom_styles/pressed = SubResource( 2 )
custom_styles/focus = SubResource( 3 )
custom_styles/disabled = SubResource( 4 )
custom_styles/normal = SubResource( 4 )
custom_fonts/font = ExtResource( 1 )
theme_override_fonts/font = ExtResource("1")
theme_override_styles/focus = SubResource("3")
theme_override_styles/disabled = SubResource("4")
theme_override_styles/hover = SubResource("1")
theme_override_styles/pressed = SubResource("2")
theme_override_styles/normal = SubResource("4")
text = "Button"
__meta__ = {
"_edit_use_anchors_": false
}
18 changes: 9 additions & 9 deletions GameTemplate/MainMenu/MainMenu.gd
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
extends CanvasLayer

export (String, FILE, "*.tscn") var First_Level: String
@export var First_Level: String # (String, FILE, "*.tscn")

func _ready()->void:
get_tree().get_nodes_in_group("MainMenu")[0].grab_focus() #Godot doesn't have buttons auto grab_focus when noone has focus
MenuEvent.connect("Options", self, "on_options")
get_tree().get_nodes_in_group("MainMenu")[0].grab_focus()
MenuEvent.connect("OptionsSignal", on_options)

if OS.get_name() == "HTML5":
$"BG/MarginContainer/VBoxMain/HBoxContainer/ButtonContainer/Exit".visible = false
#Localization
SettingsLanguage.connect("ReTranslate", self, "retranslate")
SettingsLanguage.connect("ReTranslate", retranslate)
retranslate()

func on_options(value:bool)->void:
if !value && !MenuEvent.Paused:
if !value && !MenuEvent.Paused_val:
get_tree().get_nodes_in_group("MainMenu")[0].grab_focus()

func _on_NewGame_pressed()->void:
Game.emit_signal("NewGame")
Game.emit_signal("ChangeScene", First_Level)

func _on_Options_pressed()->void:
MenuEvent.Options = true
MenuEvent.Options_val = true

func _on_Exit_pressed()->void:
Game.emit_signal("Exit")

#Localization
func retranslate()->void:
find_node("NewGame").text = tr("NEW_GAME")
find_node("Options").text = tr("OPTIONS")
find_node("Exit").text = tr("EXIT")
find_child("NewGame").text = tr("NEW_GAME")
find_child("Options").text = tr("OPTIONS")
find_child("Exit").text = tr("EXIT")
Loading

0 comments on commit 4bc43e7

Please sign in to comment.