Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix documenting comments #138

Merged
merged 1 commit into from
Nov 10, 2024
Merged
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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ Additionally, for task organization, the project includes a simple [Kanban Tasks
> Due to an issues with a custom `AudioBusLayout` resource locations in Godot, I've kept the audio bus layout at its default location and name as [default_bus_layout.tres](default_bus_layout.tres).

> **NOTE:**
> This template is not recommended for beginners who may need a guidance.
> It serves as my personal project template and will continue to evolve as I develop my own game. Updates will be made until the project starts to go beyond the needs of a generic top-down shooter and into game-specific content.
> - This template is not recommended for beginners who may need a guidance.
> - It serves as my personal project template and will continue to evolve as I develop my own game. Updates will be made until the project starts to go beyond the needs of a generic top-down shooter and into game-specific content.
> - All assets are made by me and are free to be modified and used for inclusion in commercial products, but not sold as your creation.

![PREVIEW](addons/top_down/assets/images/project_preview.png)

Expand Down
1 change: 1 addition & 0 deletions addons/great_games_library/autoload/SoundManager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ extends Node

## During _ready will be created new SoundPlayers
@export var start_count:int = 10

## Name of the audio channel where sounds will be played
@export var audio_bus:StringName

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@ extends Node

## Emited when transmission is granted access
signal transmission_received(transmission_resource:TransmissionResource)

## Emitted to give option to validate transmission. transmission_resource.set_valid(true)
signal transmission_validate(transmission_resource:TransmissionResource)

@export var enabled:bool = true

## Sets TransmissionResource state to TRY_AGAIN next physics frame
@export var bypass:bool = false

## Will receive transmissions with this name. Only one receiver for each name.
@export var transmission_name:StringName

## Node used to create receiver chain
@export var area_receiver:AreaReceiver2D

## Resource node holds HealthResource
@export var resource_node:ResourceNode

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ signal denied
signal try_again(receiver:AreaReceiver2D)

@export var enabled:bool = true

## If transmission errors with state TRY_AGAIN, try sending next physics frame
@export var try_next_frame:bool = true

## Data that will be transmitted
@export var transmission_resource:TransmissionResource

## Node that creates transmission connection
@export var area_transmitter:AreaTransmitter2D

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ enum ErrorType {
FAILED}

@export var transmission_name:StringName

## State of transmission process
@export var state:ErrorType = ErrorType.NONE

## Receiving end might decide that transmission is invalid and processing will be cancelled.
@export var valid:bool = true

Expand Down
4 changes: 4 additions & 0 deletions addons/great_games_library/nodes/DebugPausing/DebugPausing.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@ extends Node
## Pressing this the game will pause or move one frame
## WARNING: Physics nodes have settings about stopped processing
@export var frame_input:InputEvent

## Hold this and press frame input to release
@export var release_input:InputEvent

## Node which process_mode will be affected
@export var stopped_node:Node

## Action Name for one frame pause input
const frame_action:StringName = "DebugPauseFrame"

## Action Name for release input
const release_action:StringName = "DebugPauseRelease"

## Inner state, if enabled the processing is stopped and allowed to move by one frame
var enabled:bool

## State when waiting for one frame
var waiting_frame:bool = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ extends Node
@export var tilemap_layer:TileMapLayer
@export var astargrid_resource:AstarGridResource
@export var obstacle_shape:Shape2D

## Custom tile data name of PackedVector2Array for collider offsets
@export var data_name:String = "collider_offset"
@export_flags_2d_physics var collision_layer:int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ extends Line2D

@export var position_node:Node2D
@export var astargrid_resource:AstarGridResource

## How close to be to a point to look up next one
@export var reached_distance:float = 6.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ extends Node

@export var tilemap_layer:TileMapLayer
@export var astargrid_resource:AstarGridResource

## set bigger AStar region on each side
@export var grow_region:int = 1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ extends Resource

## Reference to a SaveableResource
@export var resource:SaveableResource

## Marks resource to be duplicated when a new ResourceNode is created
@export var make_unique:bool
@export_multiline var description:String
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## WARNING: Currently incomplete.
## This is going to be a replacement physics body
class_name RigidCharacterBody2D
extends CharacterBody2D

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ extends SaveableResource

## Recommended to use default_bus_layout on project root, because Godot has some bug creating new in that place.
@export var audio_bus_layout:AudioBusLayout

## values["bus_name"] = {volume = volume, db = db}
## db is stored in case there's a need to look it up
@export var values:Dictionary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ extends Resource
@export_range (0.0, 360.0) var angleto:float = 360.0
@export var camera_reference:ReferenceNodeResource
@export var tween_resource:TweenValueResource

## It can be shared between category or every screenshake for a global toggle
@export var enabled_settings:BoolResource

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ signal scene_changed
## Using file path to a scene no not cause cyclic reference when including in scenes.
## Scene file will be loaded when instancing scene for the first time
@export var scene_path:String

## Reference to a node that will be used as a parent.
@export var parent_reference_resource:ReferenceNodeResource

## After first instance crewation a scene file is cached
var scene:PackedScene

## Collect references of all active instances
var active_list:Array[Node]

## Inactive scenes with a PoolNode are put in the list, to pull out when a new one is needed, instead of instancing every time.
var pool_list:Array[Node]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ signal pool_requested

## Mark nodes to trigger _ready() every time scene is added to the tree
@export var ready_nodes:Array[Node]

## AnimationPlayers that needs to be stopped and autoplay aniation played each time entering the tree
@export var animation_player_list:Array[AnimationPlayer]

## GPUParticles2D that has to be reset every time entering tree and remove previous particles from memory
@export var particle2d_list:Array[GPUParticles2D]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ extends Node

## Node to be assigned to Reference resource
@export var reference_node:Node

## Reference resource that will be referencing a Node. If `reference_resource_path` is not empty it will overwrite resource.
@export var reference_resource:ReferenceNodeResource

## If not empty it will overwrite resource.
@export var reference_resource_path:String

## Initializes only if node is able to process in a tree
@export var process_only:bool = false

## Reference is removed when node exits tree
@export var until_tree_exit:bool = true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ extends SaveableResource
## Requires to have a resource_name - used for dictionary lookup
@export var save_list:Array[SaveableResource]

##

var name_dictionary:Dictionary
var is_initialized:bool

Expand Down Expand Up @@ -34,4 +34,3 @@ func prepare_load(_data:Resource)->void:
if !name_dictionary.has(item.resource_name):
continue
name_dictionary[item.resource_name].prepare_load(item)

Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ signal resource_saved
signal resource_loaded

@export_group("SaveableResource")

## Allows to detect older save data information
@export var version:int

## Resets instead of loading and isn't saved
@export var not_saved:bool

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ func get_sound()->AudioStream:
else:
index = (index +1) % sound_list.size()
return sound_list[index]

Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ func play()->void:
if debug:
pass
sound.play_managed()

Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,37 @@ extends Resource

## Lowest random pitch
@export var pitch_min:float = 1.0

## Highest random pitch
@export var pitch_max:float = 1.0

## Volume of a played sound
@export_range(-80.0, +24.0) var volume:float = 0.0

## Time interval when sound is not played again
@export var retrigger_time:float = 0.032

## Pitch increase when repeated fast
@export var pitch_add:float = 0.0

## How fast pitch cooldown drops
@export var pitch_cooldown:float

## TODO: forgot the meaning in the code
@export var pitch_return:float

## Audio sample used
@export var sound:AudioStream

## keep track of trigger time
var last_play_time:float

## time since last trigger
var delta:float

## Audio player assigned to use this resource
var sound_player:SoundPlayer

## keep track of the pitch
var pitch:float

Expand Down
1 change: 1 addition & 0 deletions addons/great_games_library/static/GameMath/GameMath.gd
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
## WARNING: Not everything is working properly. Some functions are quick not-tested code ports.
extends Node
class_name GameMath

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class_name PhysicsHelper
extends Node

## Create a physics body with a single function call that shows the needed information in one place.
## Create a physics body with a single function call that shows all needed information in one place.
static func body_create_2d(space:RID, collision_layer:int, collision_mask:int, shape:Shape2D, transform:Transform2D, body_mode:PhysicsServer2D.BodyMode, instance_id:int)->RID:
var body:RID = PhysicsServer2D.body_create()
PhysicsServer2D.body_set_space(body, space)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
## WARNING: Not implemented yet
class_name VerletIntegration
extends Node

Expand Down
3 changes: 3 additions & 0 deletions addons/top_down/scripts/actor/MoverTopDown2D.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ extends Node

## Way to disable functionality at _ready
@export var enabled:bool = true

## Node that is doing the physical movement
@export var character:CharacterBody2D

## Used for faking angled perspective movement
@export var axis_multiplier_resource:Vector2Resource
@export var resource_node:ResourceNode


## Virtual buttons to react to
var input_resource:InputResource

## Stats for movement
var actor_stats_resource:ActorStatsResource

Expand Down
3 changes: 2 additions & 1 deletion addons/top_down/scripts/actor/Player/PlayerJuice.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ func _ready()->void:
var _health_resource:HealthResource = resource_node.get_resource("health")
if _health_resource != null:
_health_resource.damaged.connect(on_damaged)


func on_damaged()->void:
assert(screen_flash_command.node != null, "reference is not set")
# TODO: find a way to expose what functions are available
screen_flash_command.command("play", ["white_flash"])
player_damage_shake.play()

Expand Down
2 changes: 2 additions & 0 deletions addons/top_down/scripts/actor/SpriteFlip.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ class_name SpriteFlip
extends Node

@export var resource_node:ResourceNode

## Node that is used for flipping visuals horizontally
@export var flip_node:Node2D

enum FlipType {WALK_DIR, AIM_DIR}

## Choose sprite flipping is related to walking or aiming
@export var flip_type:FlipType

Expand Down
1 change: 0 additions & 1 deletion addons/top_down/scripts/actor/bots/BotInput.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ extends Node2D
signal input_update

@export var enabled:bool = true
## Commands the movement
@export var axis_multiplier_resource:Vector2Resource
@export var attack_distance:float = 16.0
@export var resource_node:ResourceNode
Expand Down
1 change: 1 addition & 0 deletions addons/top_down/scripts/actor/bots/TargetAim.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ extends Node

@export var bot_input:BotInput
@export var target_finder:TargetFinder

## just point attack direction to the same direction as walking.
@export var aim_walking_direction:bool

Expand Down
4 changes: 4 additions & 0 deletions addons/top_down/scripts/actor/bots/TargetDirection.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ extends Node
@export var bot_input:BotInput
@export var raycast:RayCast2D
@export var tile_navigation:TileNavigationGetter

## Value used to change recalculation cooldown
@export var retarget_distance:float = 16.0
@export var straight_path_distance:float = 16.0 * 5.0
Expand All @@ -13,11 +14,14 @@ extends Node

## From bot to target
var target_direction:Vector2

## Track targets position
var last_target_position:Vector2

## Time last navigation update happened
var last_update_time:float
var navigation_cooldown:float = 1.0

## Used to control navigation around corners
var allow_straight_path:bool = false

Expand Down
2 changes: 2 additions & 0 deletions addons/top_down/scripts/actor/player/PlayerInput.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ class_name PlayerInput
extends Node

@export var enabled:bool = true

## Used for getting mouse local position
@export var position_node:Node2D

## Offset aim to the body to shoot at shadow collider (feet position)
@export var aim_offset:Vector2
@export var resource_node:ResourceNode
Expand Down
2 changes: 2 additions & 0 deletions addons/top_down/scripts/damage/DamageResource.gd
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ signal damage_report(damage:DamageResource)

## An information for a damage report
@export var is_critical:bool = false

## Exploiting that array is shared reference
## it will collect all same generation hits
@export var hit_list:Array

## pre-calculated value
@export var total_damage:float
## TODO: include information from source character
Expand Down
1 change: 1 addition & 0 deletions addons/top_down/scripts/game/PersistentData.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ extends Node

@export var instance_resource_list:Array[InstanceResource]
@export var action_resource:ActionResource

## Hold any data. Main use is to keep resources in memory
@export var data:Dictionary

Expand Down
Loading