Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/static_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: 📊 Static Checks
on:
push:
branches:
- development
pull_request:
branches:
- development

jobs:
static-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: Scony/godot-gdscript-toolkit@master
with:
version: "3.*"

- name: Formatting checks
run: gdformat --check .

- name: Linting checks
run: gdlint .

- name: Spelling checks
uses: codespell-project/actions-codespell@v2
with:
skip: ./addons
ignore_words_list: doubleclick
37 changes: 0 additions & 37 deletions CONVENTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,6 @@ Avoid writing code that relies on a specific scene structure (like calling metho

Follow [GDScript's official style guide](http://docs.godotengine.org/en/latest/getting_started/scripting/gdscript/gdscript_styleguide.html).

### Order inside a .gd file

tool

extends

class_name

signal

onready var

enum

const

export var

var

lifecycle functions
_ready
_input
_unhandled_input
_process
_physics_process

instance functions

funcref callbacks

signal callbacks

setters/getters (in pairs if needed, setter before getter)

static functions

## Naming conventions

### Directories
Expand Down
1 change: 1 addition & 0 deletions project/assets/effects/explosion/DeathExplosion.gd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
extends Node2D


func free():
queue_free()
48 changes: 39 additions & 9 deletions project/assets/effects/trails/Trail.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,34 @@ const WAIT_TIME = 4
const OIL_OPACITY = .7
const OIL_SCALE = .4

var can_collide = false

onready var sprite = $Oil
onready var tween = $Tween

var can_collide = false

func _ready():
$Timer.wait_time = WAIT_TIME
$Timer.start()
sprite.frame = randi() % sprite.hframes
tween.interpolate_property(sprite, "modulate", Color(1, 1, 1, 0), Color(1, 1, 1, OIL_OPACITY), .5,
Tween.TRANS_LINEAR, Tween.EASE_IN)
tween.interpolate_property(sprite, "scale", Vector2(.2, .2), Vector2(OIL_SCALE, OIL_SCALE), .5,
Tween.TRANS_QUAD, Tween.EASE_IN_OUT)
tween.interpolate_property(
sprite,
"modulate",
Color(1, 1, 1, 0),
Color(1, 1, 1, OIL_OPACITY),
.5,
Tween.TRANS_LINEAR,
Tween.EASE_IN
)
tween.interpolate_property(
sprite,
"scale",
Vector2(.2, .2),
Vector2(OIL_SCALE, OIL_SCALE),
.5,
Tween.TRANS_QUAD,
Tween.EASE_IN_OUT
)
tween.start()


Expand All @@ -27,12 +42,27 @@ func _on_Timer_timeout():
$KillTimer.wait_time = duration
$KillTimer.start()

tween.interpolate_property(sprite, "modulate", Color(1, 1, 1, OIL_OPACITY), Color(1, 1, 1, 0), duration,
Tween.TRANS_LINEAR, Tween.EASE_IN)
tween.interpolate_property(sprite, "scale", Vector2(OIL_SCALE, OIL_SCALE), Vector2(.2, .2), duration,
Tween.TRANS_QUAD, Tween.EASE_IN_OUT)
tween.interpolate_property(
sprite,
"modulate",
Color(1, 1, 1, OIL_OPACITY),
Color(1, 1, 1, 0),
duration,
Tween.TRANS_LINEAR,
Tween.EASE_IN
)
tween.interpolate_property(
sprite,
"scale",
Vector2(OIL_SCALE, OIL_SCALE),
Vector2(.2, .2),
duration,
Tween.TRANS_QUAD,
Tween.EASE_IN_OUT
)
tween.start()


func _on_KillTimer_timeout():
self.queue_free()

Expand Down
4 changes: 3 additions & 1 deletion project/assets/effects/water/Water.gd
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
tool
extends ColorRect


func _ready():
pass

func _on_Water_resized():

func refresh_rect_size():
$Waves.material.set_shader_param("rect_size", self.rect_size)
20 changes: 16 additions & 4 deletions project/autoload/Collision.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
extends Node

enum {PLAYER_ABOVE = 1, PLAYER_BELOW = 2, OBSTACLE = 4, FLOATING_OBSTACLE = 8,
TRAIL = 16, POWERUP = 32, HOOK = 64, CHECKPOINT = 128,
FINISH_LINE = 256, MEGAHOOK = 512, PULLABLE_OBJECT = 1024,
UNDERWATER_OBSTACLE = 2048, WHIRLPOOL = 4096, DEATHZONE = 8192}
enum {
PLAYER_ABOVE = 1,
PLAYER_BELOW = 2,
OBSTACLE = 4,
FLOATING_OBSTACLE = 8,
TRAIL = 16,
POWERUP = 32,
HOOK = 64,
CHECKPOINT = 128,
FINISH_LINE = 256,
MEGAHOOK = 512,
PULLABLE_OBJECT = 1024,
UNDERWATER_OBSTACLE = 2048,
WHIRLPOOL = 4096,
DEATHZONE = 8192
}
1 change: 0 additions & 1 deletion project/autoload/PauseFocus.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
extends Node
# Automatically pauses/unpauses the game based on window focus.


var _is_in_tree := false


Expand Down
13 changes: 6 additions & 7 deletions project/autoload/PauseManager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ extends Node
# Responsible for pausing and unpausing the game.
# Scripts that want to be involved with pausing/unpausing should join
# the "pause_sync" group and implement the following functions:
# _allow_set_pause() -> bool
# allow_set_pause() -> bool
# _on_set_pause(should_pause: bool) -> void


var _info := {}


# Return the info dictionary provided by the most recent caller
# of set_pause, which scripts may use as part of their
# _allow_set_pause or _on_set_pause implementations.
# allow_set_pause or _on_set_pause implementations.
func get_info() -> Dictionary:
return _info

Expand All @@ -23,20 +22,20 @@ func set_pause(should_pause: bool, info := {}) -> void:
return

_info = info
if not _allow_set_pause():
if not allow_set_pause():
return

get_tree().call_group("pause_sync", "_on_set_pause", should_pause)
get_tree().set_pause(should_pause)


# Return whether every member of pause_sync will allow set_pause to continue.
func _allow_set_pause() -> bool:
func allow_set_pause() -> bool:
for node in get_tree().get_nodes_in_group("pause_sync"):
if not node.has_method("_allow_set_pause"):
if not node.has_method("allow_set_pause"):
continue

if not node._allow_set_pause():
if not node.allow_set_pause():
return false

return true
28 changes: 18 additions & 10 deletions project/autoload/RoundManager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ extends Node

const DEBUG_KEYS = [KEY_PERIOD, KEY_SEMICOLON, KEY_J, KEY_K, KEY_L, KEY_I, KEY_SLASH]
const MATCH_POINTS = 5
const CHAR_COLOR = {"jackie" : Color(.7, 0, .4), "drill" : Color(.4, .4, .7),
"king" : Color(.9, .9, .25), "outsider" : Color(0, .8, 0)}
const CHAR_COLOR = {
"jackie": Color(.7, 0, .4),
"drill": Color(.4, .4, .7),
"king": Color(.9, .9, .25),
"outsider": Color(0, .8, 0)
}

var scores
var round_number
var round_winner
var gamemode # 'Arena' or 'Race'
var gamemode # 'Arena' or 'Race'
var device_map = []
var character_map = []
var movement_type_map = []
Expand All @@ -17,24 +21,28 @@ var players_total = 0

func get_device_name_from(event):
if event is InputEventKey or event is InputEventMouseButton:
if OS.is_debug_build() and\
((event is InputEventKey and event.scancode in DEBUG_KEYS) or\
(event is InputEventMouseButton and event.button_index == BUTTON_RIGHT)):
if (
OS.is_debug_build()
and (
(event is InputEventKey and event.scancode in DEBUG_KEYS)
or (event is InputEventMouseButton and event.button_index == BUTTON_RIGHT)
)
):
return "test_keyboard"

return "keyboard"

if event is InputEventJoypadButton or event is InputEventJoypadMotion:
return str("gamepad_", event.device)

return "invalid_device"


func get_match_winner():
for i in range(players_total):
if scores[i] >= MATCH_POINTS:
return i

return -1


Expand Down
18 changes: 11 additions & 7 deletions project/autoload/Sound.gd
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
extends Node

const BATTLE_MUSIC = [
preload("res://assets/sound/bgm/battle_1.ogg"),
preload("res://assets/sound/bgm/battle_2.ogg"),
preload("res://assets/sound/bgm/battle_3.ogg")
]

onready var battle_bgm = $BattleBGM
onready var menu_bgm = $MenuBGM
onready var tween = $Tween

const BATTLE_MUSIC = [preload("res://assets/sound/bgm/battle_1.ogg"),
preload("res://assets/sound/bgm/battle_2.ogg"),
preload("res://assets/sound/bgm/battle_3.ogg")]

func _ready():
randomize()
Expand All @@ -26,15 +29,16 @@ func stop_ambience():


func fade_out(track, next_track = null, duration = 1.0):
tween.interpolate_property(track, "volume_db", null, -80, duration,
Tween.TRANS_LINEAR, Tween.EASE_IN)
tween.interpolate_property(
track, "volume_db", null, -80, duration, Tween.TRANS_LINEAR, Tween.EASE_IN
)
tween.start()

yield(tween, "tween_completed")
track.stop()
track.volume_db = 0
_on_set_pause(false)

if next_track:
next_track.play()

Expand Down
Loading