What am I doing wrong?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By MarcMader

Ich bekomme in meinem Projekt folgende 3 Fehlermeldungen:

W 0:00:00.018 initialize: XOpenIM fehlgeschlagen
<C+±Quellcode>platform/x11/os_x11.cpp:195 @ initialize()

W 0:00:00.386 initialize: XCreateIC konnte xic nicht erstellen
<C+±Quellcode>platform/x11/os_x11.cpp:497 @ initialize()

E 0:00:00.650 get_node: Node not found: sprite.
<C+±Fehler> Bedingung “!node” ist wahr. Rückgabe: __null
<C+±Quellcode>scene/main/node.cpp:1381 @ get_node()
player.gd:6 @ _ready()

Übersetzt mit DeepL Translate: The world's most accurate translator (kostenlose Version)

Here is the source code of my project:

extends KinematicBody2D

export var speed = 10.0
export var tileSize = 32.0

onready var sprite = $sprite

var initpos = Vector2()
var dir = Vector2()
var facing = “down”
var counter = 0.0

var moving = false

func _ready():
initpos = position

func _process(delta):

if not moving:
	#set dir
	set_dir()
elif dir != Vector2():
	#move
	move(delta)
else:
	moving = false

if facing == "down":
	sprite.frame = 0
elif facing == "up":
	sprite.frame = 12
elif facing == "left":
	sprite.frame = 4
elif facing == "right":
	sprite.frame = 8

func set_dir(): #set moving
dir = get_dir()

if dir.x != 0 or dir.y != 0:
	
	if dir.x > 0:
		facing = "right"
	elif dir.x < 0:
		facing = "left"
	elif dir.y > 0:
		facing = "down"
	else:
		facing = "up"
		
	moving = true
	initpos = position

func get_dir(): #user input
var x = 0
var y = 0

if dir.y == 0:
	x = int(Input.is_action_pressed("ui_right")) - int(Input.is_action_pressed("ui_left"))
if dir.x == 0:
	y = int(Input.is_action_pressed("ui_down")) - int(Input.is_action_pressed("ui_up"))

return Vector2(x, y)

func move(delta): #move the player linearly
counter += delta * speed

if counter >= 1.0:
	position = initpos + dir + tileSize
	counter = 0.0
	moving = false
else:
	position = initpos + dir + tileSize + counter

Can anyone tell me what I did wrong?

If you still need screenshots, feel free to ask.

:bust_in_silhouette: Reply From: yrtv
onready var sprite = $sprite

This node is not found (probably don’t exist check the name).

I’m just getting started with programming, so I’m not that familiar with Godot yet. Can you also tell me what the following errors say after I fixed the previous one (the $Sprite command had to be capitalized):

W 0:00:00.012 initialize: XOpenIM failed
<C+±Quellcode>platform/x11/os_x11.cpp:195 @ initialize()
W 0:00:00.361 initialize: XCreateIC couldn’t create xic
<C+±Quellcode>platform/x11/os_x11.cpp:497 @ initialize()

I am from Germany, which is why I use the Godot Engine in the German language, which is why I will also translate the terms from my language for a better understanding of my problem:

Quellcode = Source code

Thanks in advance for your help.

MarcMader | 2021-02-10 08:22

If You are on Linux and using Wayland you will need to enable XWayland fot godot to work.

Please tell following

  1. Your distribution name and version.
  2. Display server used.

(Godot failed to create X11 input context )

yrtv | 2021-02-10 13:55

I use Elementary OS. The developers of this OS do not support Wayland and I do not have it installed.

So it must be another problem.

MarcMader | 2021-02-10 15:02

My display server is x11

MarcMader | 2021-02-10 15:03

I would love to show a picture of my problem, which I would have no problem with since I plan to release it under the GPL v3 anyway, but I can’t in this forum.

MarcMader | 2021-02-10 15:05

Run godot from terminal with --verbose and attach full output please.

yrtv | 2021-02-10 16:11

I don’t know if it’s important, so I’ll mention it first. I have the Godot engine as a flat.

My terminal gives the following message:

marcmader@Lenovo-ElementaryPad-e540:~$ flatpak run org.godotengine.Godot --verbose
Godot Engine v3.2.3.stable.flathub - https://godotengine.org
XInput: Refreshing devices.
XInput: No touch devices found.
WARNING: initialize: XOpenIM failed
At: platform/x11/os_x11.cpp:195.
Detecting GPUs, set DRI_PRIME in the environment to override GPU detection logic.
Only one GPU found, using default.
WARNING: initialize: XCreateIC couldn’t create xic
At: platform/x11/os_x11.cpp:497.
Failed loading custom cursor: size_bdiag
Failed loading custom cursor: size_fdiag
Using GLES3 video driver
OpenGL ES 3.0 Renderer: GeForce GT 740M/PCIe/SSE2
PulseAudio: detected 2 channels
PulseAudio: audio buffer frames: 512 calculated latency: 11ms

CORE API HASH: 17947557007960061372
EDITOR API HASH: 513236543915789544
Loading resource: res://.var/app/org.godotengine.Godot/config/godot/editor_settings-3.tres
EditorSettings: Load OK!
EditorSettings: Save OK!
Loaded builtin certs
Editing project: /home/marcmader/Pokemon Godot (::home::marcmader::Pokemon Godot)
EditorSettings: Save OK!
Godot Engine v3.2.3.stable.flathub - https://godotengine.org
XInput: Refreshing devices.
XInput: No touch devices found.
WARNING: initialize: XOpenIM failed
At: platform/x11/os_x11.cpp:195.
Detecting GPUs, set DRI_PRIME in the environment to override GPU detection logic.
Only one GPU found, using default.
WARNING: initialize: XCreateIC couldn’t create xic
At: platform/x11/os_x11.cpp:497.
Failed loading custom cursor: size_bdiag
Failed loading custom cursor: size_fdiag
Using GLES3 video driver
OpenGL ES 3.0 Renderer: GeForce GT 740M/PCIe/SSE2
PulseAudio: detected 2 channels
PulseAudio: audio buffer frames: 512 calculated latency: 11ms

CORE API HASH: 17947557007960061372
EDITOR API HASH: 513236543915789544
Loading resource: res://default_env.tres
Construct gdnative interface

Destruct gdnative interface

Class ‘BulletPhysicsDirectBodyState’ is not exposed, skipping.
Class ‘BulletPhysicsDirectSpaceState’ is not exposed, skipping.
Class ‘BulletPhysicsServer’ is not exposed, skipping.
Class ‘GDScriptNativeClass’ is not exposed, skipping.
Class ‘IP_Unix’ is not exposed, skipping.
Class ‘InputDefault’ is not exposed, skipping.
Class ‘Physics2DDirectBodyStateSW’ is not exposed, skipping.
Class ‘Physics2DDirectSpaceStateSW’ is not exposed, skipping.
Class ‘Physics2DServerSW’ is not exposed, skipping.
Class ‘ResourceImporterOGGVorbis’ is not exposed, skipping.
marcmader@Lenovo-ElementaryPad-e540:~$ Loading resource: /home/marcmader/.var/app/org.godotengine.Godot/config/godot/editor_settings-3.tres
EditorSettings: Load OK!
Loaded builtin certs
EditorSettings: Save OK!
Loading resource: res://Szenen/Charaktere/Player.tscn
Loading resource: res://Skripte/Spieler/player.gd
Loading resource: res://Sprites/Charaktere/Girl.png
Running: /app/bin/godot-bin --path /home/marcmader/Pokemon%20Godot --remote-debug 127.0.0.1:6007 --allow_focus_steal_pid 10 --position 448,240 res://Szenen/Charaktere/Player.tscn
Godot Engine v3.2.3.stable.flathub - https://godotengine.org
WARNING: initialize: XOpenIM failed
At: platform/x11/os_x11.cpp:195.
WARNING: initialize: XCreateIC couldn’t create xic
At: platform/x11/os_x11.cpp:497.
OpenGL ES 3.0 Renderer: GeForce GT 740M/PCIe/SSE2

MarcMader | 2021-02-10 16:51

Try official binaries from Download for Linux - Godot Engine
They are statically-linked and should work on any distro with glibc ( no musl libc but you are on Elementary OS ).

Probably flatpak sandboxing problem.

yrtv | 2021-02-10 18:46