Skip to content

Commit

Permalink
Add git integration, arrow key controls, controller controls, and acc…
Browse files Browse the repository at this point in the history
…essible menu navigation
  • Loading branch information
AlnisS committed Apr 9, 2022
1 parent cc11531 commit 321d7f8
Show file tree
Hide file tree
Showing 16 changed files with 1,202 additions and 8 deletions.
21 changes: 21 additions & 0 deletions addons/godot-git-plugin/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2016-2022 The Godot Engine community

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.
1,062 changes: 1,062 additions & 0 deletions addons/godot-git-plugin/THIRDPARTY.md

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions addons/godot-git-plugin/git_api.gdnlib
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[general]

singleton=true
load_once=true
symbol_prefix="godot_"
reloadable=false

[entry]

OSX.64="res://addons/godot-git-plugin/osx/release/libgitapi.dylib"
Windows.64="res://addons/godot-git-plugin/win64/release/libgitapi.dll"
X11.64="res://addons/godot-git-plugin/x11/release/libgitapi.so"

[dependencies]

OSX.64=[ ]
Windows.64=[ ]
X11.64=[ ]
9 changes: 9 additions & 0 deletions addons/godot-git-plugin/git_api.gdns
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[gd_resource type="NativeScript" load_steps=2 format=2]

[ext_resource path="res://addons/godot-git-plugin/git_api.gdnlib" type="GDNativeLibrary" id=1]

[resource]
resource_name = "GitAPI"
class_name = "GitAPI"
library = ExtResource( 1 )
script_class_name = "GitAPI"
Binary file not shown.
7 changes: 7 additions & 0 deletions addons/godot-git-plugin/plugin.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[plugin]

name="Godot Git Plugin"
description="This plugin lets you interact with Git without leaving the Godot editor. More information can be found at https://github.com/godotengine/godot-git-plugin/wiki"
author="ChronicallySerious"
version="v1.2.3"
script="git_api.gdns"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added addons/godot-git-plugin/x11/release/libgitapi.so
Binary file not shown.
1 change: 1 addition & 0 deletions ball/GolfBall.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ surfaces/0 = {
}

[sub_resource type="SpatialMaterial" id=2]
resource_local_to_scene = true
flags_unshaded = true
flags_do_not_receive_shadows = true
flags_disable_ambient_light = true
Expand Down
2 changes: 2 additions & 0 deletions cart/Master.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ extends Spatial
var golf_ball_scene = preload("res://ball/GolfBall.tscn")

func _ready():
$PlayButton.grab_focus()
get_tree().paused = true

var time = 0.0
Expand Down Expand Up @@ -118,6 +119,7 @@ func _physics_process(delta):
score += delta * 100 / (golf_ball.target - golf_ball.transform.origin).length()

if gameover:
$EndScreen.show()
$EndScreen.modulate = Color(1.0, 1.0, 1.0, clamp(time - gameover_time, 0.0, 1.0))

if not gameover:
Expand Down
24 changes: 23 additions & 1 deletion cart/Master.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=14 format=2]
[gd_scene load_steps=15 format=2]

[ext_resource path="res://cart/GolfCart.tscn" type="PackedScene" id=1]
[ext_resource path="res://environment/Map.tscn" type="PackedScene" id=2]
Expand Down Expand Up @@ -29,6 +29,19 @@ font_data = ExtResource( 7 )
size = 40
font_data = ExtResource( 7 )

[sub_resource type="GDScript" id=13]
script/source = "extends Node

# this is a really hacky way of making the menu popups dismiss, but w/e

func _input(event):
if (event.is_action_pressed(\"ui_cancel\")
or event.is_action_pressed(\"ui_down\")
or event.is_action_pressed(\"ui_up\")):
get_node(\"../InstructionsPopup\").hide()
get_node(\"../CreditsPopup\").hide()
"
[node name="Master" type="Spatial"]
script = ExtResource( 5 )
Expand Down Expand Up @@ -122,6 +135,7 @@ __meta__ = {
}
[node name="EndScreen" parent="." instance=ExtResource( 6 )]
visible = false
modulate = Color( 1, 1, 1, 0 )
[node name="PlayButton" type="Button" parent="."]
Expand All @@ -132,6 +146,7 @@ margin_left = -133.0
margin_top = 38.0
margin_right = -27.0
margin_bottom = 84.0
focus_neighbour_bottom = NodePath("../InstructionsButton")
custom_colors/font_color_disabled = Color( 0.819608, 0.117647, 0.117647, 1 )
custom_colors/font_color_focus = Color( 0.819608, 0.117647, 0.117647, 1 )
custom_colors/font_color = Color( 0.819608, 0.117647, 0.117647, 1 )
Expand All @@ -151,6 +166,8 @@ margin_left = -133.0
margin_top = 91.0
margin_right = -27.0
margin_bottom = 137.0
focus_neighbour_top = NodePath("../PlayButton")
focus_neighbour_bottom = NodePath("../CreditsButton")
custom_colors/font_color_disabled = Color( 0.819608, 0.117647, 0.117647, 1 )
custom_colors/font_color_focus = Color( 0.819608, 0.117647, 0.117647, 1 )
custom_colors/font_color = Color( 0.819608, 0.117647, 0.117647, 1 )
Expand All @@ -170,6 +187,7 @@ margin_left = -133.0
margin_top = 144.0
margin_right = -27.0
margin_bottom = 190.0
focus_neighbour_top = NodePath("../InstructionsButton")
custom_colors/font_color_disabled = Color( 0.819608, 0.117647, 0.117647, 1 )
custom_colors/font_color_focus = Color( 0.819608, 0.117647, 0.117647, 1 )
custom_colors/font_color = Color( 0.819608, 0.117647, 0.117647, 1 )
Expand Down Expand Up @@ -273,6 +291,10 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="UIBodger" type="Node" parent="."]
pause_mode = 2
script = SubResource( 13 )
[connection signal="driver_hit" from="GolfCart" to="." method="_on_GolfCart_driver_hit"]
[connection signal="pressed" from="PlayButton" to="." method="_on_PlayButton_pressed"]
[connection signal="pressed" from="InstructionsButton" to="." method="_on_InstructionsButton_pressed"]
Expand Down
53 changes: 52 additions & 1 deletion project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@

config_version=4

_global_script_classes=[ ]
_global_script_classes=[ {
"base": "",
"class": "GitAPI",
"language": "NativeScript",
"path": "res://addons/godot-git-plugin/git_api.gdns"
} ]
_global_script_class_icons={
"GitAPI": ""
}

[application]
Expand All @@ -29,51 +35,96 @@ window/size/height=400
window/stretch/mode="viewport"
window/stretch/aspect="expand"

[gdnative]

singletons=[ "res://addons/godot-git-plugin/git_api.gdnlib" ]

[input]

ui_left={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
]
}
ui_right={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
]
}
ui_up={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
]
}
ui_down={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
]
}
steer_left={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":16777231,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
]
}
steer_right={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":16777233,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
]
}
gas={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":16777232,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":7,"axis_value":1.0,"script":null)
]
}
brake={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":16777234,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":6,"axis_value":1.0,"script":null)
]
}
jump={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":1,"pressure":0.0,"pressed":false,"script":null)
]
}
peek={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777237,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":3,"pressure":0.0,"pressed":false,"script":null)
]
}
camera_2={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777218,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
]
}
dash={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777238,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
]
}
freeze={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":70,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":2,"pressure":0.0,"pressed":false,"script":null)
]
}

Expand Down
6 changes: 0 additions & 6 deletions ui/EndScreen.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ font_data = ExtResource( 1 )
[node name="EndScreen" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}

[node name="ColorRect" type="ColorRect" parent="."]
anchor_right = 1.0
Expand Down Expand Up @@ -78,6 +75,3 @@ custom_colors/font_color_pressed = Color( 0.819608, 0.117647, 0.117647, 1 )
custom_fonts/font = SubResource( 3 )
text = "RETRY"
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
7 changes: 7 additions & 0 deletions ui/RetryButton.gd
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
extends Button

var was_visible = false

func _process(delta):
if !was_visible and is_visible_in_tree():
was_visible = true
grab_focus()

func _pressed():
get_tree().change_scene("res://cart/Master.tscn")

0 comments on commit 321d7f8

Please sign in to comment.