Skip to content

Instantly share code, notes, and snippets.

View mrhewitt's full-sized avatar

Mark Hewitt mrhewitt

View GitHub Profile
@mrhewitt
mrhewitt / README.md
Created September 26, 2025 11:40
Simple sprite hit flash shader

How to use:

  1. Create new shader material in your Sprite2D, add a shader, paste code or save shader file and quick load it
  2. flash_color is final color sprite will brighten too
  3. flash_value is amount to interpolate between original color and flash color, 0 is unchanged and 1 is full flash

Add an animation player or similar to your sprite, create an animation, and use shader flash_value as key frame, start at 0, next time stamp set to 1, and next time stamp set it back to 0, playing this animation will create flash effect

WIP - just my notes for now ...
[assumes you already have all Android tools installed and can build a standard Android export]
[1] Clone Godot repository
[2] Switch to branch of your version
git checkout 4.4.1-stable
[3] Install latest Python
@mrhewitt
mrhewitt / radial_menu.gd
Last active August 7, 2025 12:04
Radial menu example for Udemy question, quick and dirty
extends Control
class_name RadialMenu
# size to which radial menu will expand
@export var radius: float = 120
# how long it takes to expand/contract
@export var expand_time: float = 0.4
@onready var menu_items: Node = %MenuItems
@onready var control_button: Button = $ControlButton
@mrhewitt
mrhewitt / screenshot.gd
Created July 23, 2025 22:47
Take a screenshot in a Godot project
extends Node
# make sure it can run even when game is paused
func _ready() -> void:
process_mode = Node.PROCESS_MODE_ALWAYS
# take a screenshot the moment the action is _released_
# do this so we can hold it in to prep for the moment we want to capture then release
func _input(event: InputEvent) -> void:
if OS.is_debug_build() && Input.is_action_just_released('screenshot'):
@mrhewitt
mrhewitt / .gitignore
Last active July 24, 2025 11:12
My Godot project .gitignore template
# Godot 4+ specific ignores
.godot/
/android/
/addons
/assets
/scratch-pad
/bin
*.tmp
@mrhewitt
mrhewitt / audio_play_time_component.gd
Created July 15, 2025 11:22
Update Croptails AudioPlayTime component to randomize
extends Timer
@export var audio_stream_player_2D: AudioStreamPlayer2D
@export var min_wait_time: int = 1
@export var max_wait_time: int = 10
func _ready() -> void:
randomize_wait_time()