I am using Godot 4.6.stable.
I recently added GDMaim to obfuscate the code of my game and it breaks a segment of my code.
In the main menu, when you press the play button, the game crashes when I activate GDMaim. I tried to exclude the entire main menu script from obfuscation and that did absolutely nothing.
The main menu works perfectly fine without the GDMaim addon.
Here is a video demonstrating the issue.
If you know how to fix this while still being able to obfuscate the code of the game, I would really be grateful for help.
If this helps, here is the main menu script.
extends Node2D
#SCREEN ONE IS THE MAIN SCREEN
#SCREEN TWO IS THE CONTROLS SCREEN
#SCREEN THREE IS THE "ARE YOU SURE" SCREEN FOR RESETTING YOUR PROGRESS
#SCREEN FOUR IS THE SETTINGS SCREEN
#SCREEN FIVE IS THE VOLUME SCREEN
@onready var anim : AnimationPlayer = $AnimationPlayer
@onready var s : Label = $Start
@onready var c : Label = $controls
@onready var rp : Label = $"Reset Progress"
@onready var q : Label = $Quit
@onready var se : Label = $Settings
@onready var y : Label = $Yes
@onready var n : Label = $No
@onready var cam : Camera2D = $Camera2D
#SCREEN FOUR BUTTONS
@onready var vol : Label = $Volume
@onready var rs : Label = $Resize
@onready var bfstm : Label = $Back # stands for Back From Settings To Main (screen)
#SCREEN FIVE BUTTONS
@onready var m : Label = $Music
@onready var mv : Label = $MusicValue
@onready var mk : Sprite2D = $"Music Slider/Knob"
var music_bus : int = AudioServer.get_bus_index("Music")
@onready var sfx : Label = $SFX
@onready var SFXv : Label = $"SFX value"
@onready var SFXk : Sprite2D = $"SFX Slider/Knob"
var sfx_bus : int = AudioServer.get_bus_index("SFX")
@onready var b2s : Label = $Back2Settings
var yes : bool = false
var config : ConfigFile = ConfigFile.new()
# wb = which button
var wb : int = 1
# ws = which screen
var ws : int = 1
func _ready() -> void:
var err : Error = config.load("user://save.cfg")
wb = 1
ws = 1
if err == OK:
var zm : float = config.get_value("zoom","zoom", .14)
var SFX : float = config.get_value("lv","sfx", 1)
var Music : float = config.get_value("lv","music", 1)
cam.zoom.x = zm/.127
cam.zoom.y = zm/.127
mk.position.x = Music * 200 - 200
SFXk.position.x = SFX * 200 - 200
func _on_start_pressed() -> void:
var err : Error = config.load("user://save.cfg")
if err == OK:
var lv : float = config.get_value("lv","num", 0)
if lv == 0:
get_tree().change_scene_to_file("res://Scenes/lv0.tscn")
elif lv == 1:
get_tree().change_scene_to_file("res://Scenes/lv1.tscn")
elif lv == 2:
get_tree().change_scene_to_file("res://Scenes/lv2.tscn")
elif lv == 3:
get_tree().change_scene_to_file("res://Scenes/lv3.tscn")
elif lv == 3.5:
get_tree().change_scene_to_file("res://Scenes/mofcs.tscn")
else:
config.set_value("lv", "num", 0)
config.save("user://save.cfg")
get_tree().change_scene_to_file("res://Scenes/lv0.tscn")
func _process(_delta: float) -> void:
if Input.is_action_just_pressed("w") and ws == 1:
if wb > 0:
wb-=1
if wb == 0:
wb = 5
if Input.is_action_just_pressed("s") and ws == 1:
if wb < 6:
wb+=1
if wb == 6:
wb = 1
if ws == 1:
if wb == 1:
s.modulate =Color(1,1,1)
c.modulate = Color(0,0,0)
rp.modulate = Color(0,0,0)
q.modulate = Color(0,0,0)
se.modulate = Color(0,0,0)
if wb == 2:
s.modulate =Color(0,0,0)
c.modulate = Color(1,1,1)
rp.modulate = Color(0,0,0)
q.modulate = Color(0,0,0)
se.modulate = Color(0,0,0)
if wb == 3:
s.modulate =Color(0,0,0)
c.modulate = Color(0,0,0)
rp.modulate = Color(1,1,1)
q.modulate = Color(0,0,0)
se.modulate = Color(0,0,0)
if wb == 4:
s.modulate =Color(0,0,0)
c.modulate = Color(0,0,0)
rp.modulate = Color(0,0,0)
q.modulate = Color(1,1,1)
se.modulate = Color(0,0,0)
if wb == 5:
s.modulate =Color(0,0,0)
c.modulate = Color(0,0,0)
rp.modulate = Color(0,0,0)
q.modulate = Color(0,0,0)
se.modulate = Color(1,1,1)
if Input.is_action_just_pressed("jump") and ws == 1:
if wb == 1:
_on_start_pressed()
if wb == 2:
anim.play("m-c")
await get_tree().create_timer(.1).timeout
ws = 2
if wb == 3:
anim.play("m-rc")
await get_tree().create_timer(.1).timeout
ws = 3
yes = false
if wb == 4:
get_tree().quit()
if wb == 5:
anim.play("m-s")
await get_tree().create_timer(.1).timeout
ws = 4
wb = 3
if Input.is_action_just_pressed("jump") and ws == 2:
anim.play("c-m")
await get_tree().create_timer(.1).timeout
ws = 1
#THIS IS FOR SCREEN 3
if Input.is_action_just_pressed("w") and ws == 3 and yes == true:
yes = false
await get_tree().create_timer(.1).timeout
if Input.is_action_just_pressed("w") and ws == 3 and yes == false:
yes = true
await get_tree().create_timer(.1).timeout
if Input.is_action_just_pressed("s") and ws == 3 and yes == true:
yes = false
await get_tree().create_timer(.1).timeout
if Input.is_action_just_pressed("s") and ws == 3 and yes == false:
yes = true
await get_tree().create_timer(.1).timeout
if yes == false:
n.modulate = Color(1,1,1)
y.modulate = Color(0,0,0)
if yes == true:
n.modulate = Color(0,0,0)
y.modulate = Color(1,1,1)
if Input.is_action_just_pressed("jump") and ws == 3 and yes == false:
anim.play("rc-m")
ws = 1
if Input.is_action_just_pressed("jump") and ws == 3 and yes == true:
anim.play("rc-m")
ws = 1
config.set_value("lv", "num", 0)
config.set_value("lv", "checkpoint", 0)
config.save("user://save.cfg")
#THIS IS FOR SCREEN 4
if ws == 4:
if wb == 3:
vol.modulate = Color(0,0,0)
rs.modulate = Color(0,0,0)
bfstm.modulate = Color(1,1,1)
if wb == 2:
vol.modulate = Color(0,0,0)
rs.modulate = Color(1,1,1)
bfstm.modulate = Color(0,0,0)
if wb == 1:
vol.modulate = Color(1,1,1)
rs.modulate = Color(0,0,0)
bfstm.modulate = Color(0,0,0)
if Input.is_action_just_pressed("w"):
if wb > 0:
wb-=1
if wb == 0:
wb = 3
if Input.is_action_just_pressed("s"):
if wb < 4:
wb+=1
if wb == 4:
wb = 1
if Input.is_action_just_pressed("jump"):
if wb == 3:
anim.play("s-m")
await get_tree().create_timer(.1).timeout
ws = 1
wb = 5
if wb == 2:
get_tree().change_scene_to_file("res://Scenes/cameraZoom.tscn")
if wb == 1:
anim.play("s-v")
ws = 5
wb = 3
await get_tree().create_timer(.1).timeout
#FOR SCREEN FIVE, VOLUME SCREEN
# FORMULA FOR X POS OF KNOBS y is the noise value
#y * 200 - 200 = x
var Music : float = config.get_value("lv","music", 1)
var SFX : float = config.get_value("lv","sfx", 1)
mk.position.x = Music * 200 - 200
SFXk.position.x = SFX * 200 - 200
mv.text = str(Music)
SFXv.text = str(SFX)
if ws == 5:
if wb == 1:
m.modulate = Color(1,1,1)
mv.modulate = Color(1,1,1)
mk.scale = Vector2(.25,.25)
sfx.modulate = Color(0,0,0)
SFXv.modulate = Color(0,0,0)
SFXk.scale = Vector2(.15,.15)
b2s.modulate = Color(0,0,0)
if Input.is_action_just_pressed("w"):
wb = 3
await get_tree().create_timer(.1).timeout
if Input.is_action_just_pressed("s"):
wb = 2
await get_tree().create_timer(.1).timeout
#Changes volume
if Input.is_action_just_pressed("left"):
var new_music : float = clamp(Music - 0.1, 0.0, 2.0)
config.set_value("lv", "music", new_music)
AudioServer.set_bus_volume_db(music_bus, linear_to_db(new_music))
config.save("user://save.cfg")
if Input.is_action_just_pressed("right"):
var new_music : float = clamp(Music + 0.1, 0.0, 2.0)
config.set_value("lv", "music", new_music)
AudioServer.set_bus_volume_db(music_bus, linear_to_db(new_music))
config.save("user://save.cfg")
if wb == 2:
m.modulate = Color(0,0,0)
mv.modulate = Color(0,0,0)
mk.scale = Vector2(.15,.15)
sfx.modulate = Color(1,1,1)
SFXv.modulate = Color(1,1,1)
SFXk.scale = Vector2(.25,.25)
b2s.modulate = Color(0,0,0)
if Input.is_action_just_pressed("w"):
wb = 1
await get_tree().create_timer(.1).timeout
if Input.is_action_just_pressed("s"):
wb = 3
await get_tree().create_timer(.1).timeout
#Changes volume
if Input.is_action_just_pressed("left"):
var new_music : float = clamp(SFX - 0.1, 0.0, 2.0)
config.set_value("lv", "sfx", new_music)
AudioServer.set_bus_volume_db(sfx_bus, linear_to_db(new_music))
config.save("user://save.cfg")
if Input.is_action_just_pressed("right"):
var new_music : float = clamp(SFX + 0.1, 0.0, 2.0)
config.set_value("lv", "sfx", new_music)
AudioServer.set_bus_volume_db(sfx_bus, linear_to_db(new_music))
config.save("user://save.cfg")
if wb == 3:
m.modulate = Color(0,0,0)
mv.modulate = Color(0,0,0)
mk.scale = Vector2(.15,.15)
sfx.modulate = Color(0,0,0)
SFXv.modulate = Color(0,0,0)
SFXk.scale = Vector2(.15,.15)
b2s.modulate = Color(1,1,1)
if Input.is_action_just_pressed("jump"):
anim.play("v-s")
ws = 4
wb = 1
await get_tree().create_timer(.1).timeout
if Input.is_action_just_pressed("w"):
wb = 2
await get_tree().create_timer(.1).timeout
if Input.is_action_just_pressed("s"):
wb = 1
await get_tree().create_timer(.1).timeout