Added godmode hotkey

This commit is contained in:
2026-03-11 13:58:53 +11:00
parent 0914903084
commit a9f1fd48c9
5 changed files with 39 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
class_name BoxBoy extends CharacterBody2D class_name BoxBoy extends CharacterBody2D
@onready var _gameplayController = $/root/Scene/GameplayController
@onready var _sprite = $AnimatedSprite2D @onready var _sprite = $AnimatedSprite2D
const MOVE_FORCE: int = 300 #about 10 tiles horizontally (airborne arc) const MOVE_FORCE: int = 300 #about 10 tiles horizontally (airborne arc)
@@ -68,9 +69,12 @@ func _physics_process(_delta) -> void:
if abs(velocity.x) > MAX_MOVE_SPEED: if abs(velocity.x) > MAX_MOVE_SPEED:
velocity.x = MAX_MOVE_SPEED * sign(velocity.x) velocity.x = MAX_MOVE_SPEED * sign(velocity.x)
if _gameplayController.godmode and velocity.y > 0:
velocity.y = 0
#do the thing #do the thing
move_and_slide() move_and_slide()
print(velocity.y)
#animation stuff #animation stuff
func _on_animation_finished() -> void: func _on_animation_finished() -> void:

View File

@@ -0,0 +1,9 @@
extends Node
static var godmode: bool = false:
get:
return godmode
func _process(_delta: float) -> void:
if Input.is_action_just_pressed("controller_godmode"):
godmode = !godmode

View File

@@ -0,0 +1 @@
uid://b4nlbrxto0tjp

View File

@@ -19,6 +19,12 @@ run/main_scene="res://scene.tscn"
config/features=PackedStringArray("4.6", "Forward Plus") config/features=PackedStringArray("4.6", "Forward Plus")
config/icon="res://icon.svg" config/icon="res://icon.svg"
[display]
window/size/viewport_width=1280
window/size/viewport_height=720
window/subwindows/embed_subwindows=false
[input] [input]
input_right={ input_right={
@@ -38,6 +44,11 @@ input_jump={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null) "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
] ]
} }
controller_godmode={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":71,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
[rendering] [rendering]

File diff suppressed because one or more lines are too long