This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to switch to a PackedScene | |
extends Node2D | |
@export var level_2_scene:PackedScene | |
func _on_level_2_button_pressed() -> void: | |
get_tree().change_scene_to_packed(level_2_scene) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Node2D | |
const FPS_DICTIONARY = { | |
0: 0, | |
1: 60, | |
2: 30, | |
} | |
func _ready() -> void: | |
set_max_fps_text() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Node2D | |
const MAX_HEALTH = 5 | |
var health = MAX_HEALTH | |
@onready var health_bar = $HealthBar | |
@onready var health_label = $HealthLabel | |
func _ready() -> void: | |
update_health_ui() | |
health_bar.max_value = MAX_HEALTH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Node2D | |
const MAX_HEALTH = 5 | |
var health = MAX_HEALTH | |
func _ready() -> void: | |
update_health_ui() | |
$HealthBar.max_value = MAX_HEALTH | |
func update_health_ui(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends CharacterBody2D | |
class_name Player | |
@export var weapon:PackedScene | |
const BULLET_SPEED = 400 | |
@export var fire_type := FireType.SINGLE | |
enum FireType { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Node2D | |
@onready var pickup_sfx:AudioStreamPlayer = $PickupSfx | |
@onready var music:AudioStreamPlayer = $Music | |
func _on_play_sfx_pressed() -> void: | |
pickup_sfx.play() | |
var music_pos = 0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Node2D | |
var times_pressed := 0 | |
var high_score := 0 | |
var playing := false | |
@onready var timer:Timer = $Gameplay/Timer | |
func _ready() -> void: | |
load_high_score() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Node2D | |
func _process(delta: float) -> void: | |
$TimeRemaining.text = "%s" % roundf($FlashTimer.time_left) | |
func _on_flash_timer_timeout() -> void: | |
toggle_icon_visibility() | |
func toggle_icon_visibility(): | |
if $Icon.visible: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Sprite2D | |
var rotating = true | |
signal rotating_toggled(is_rotating:bool) | |
func _ready() -> void: | |
rotating_toggled.emit(rotating) | |
func _process(delta: float) -> void: | |
if rotating: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hello, world! I'm from an external file. | |
And I'm a new line! |
NewerOlder