Walking astronaut tutorial not playing the animations (SOLVED)

I’ve seen a few topics on this issue but none of them resolved my issue. Right after finishing the tutorial I get this error message:

ERROR:GAMESYS: Unable to play animation ‘left’ from texture ‘/_generated_294aab8e.texturec’ since it could not be found.

I will paste my code, but it should be exactly the same as the tutorial instructions.

local speed = 150

function init(self)
	msg.post(".","acquire_input_focus")
	self.dir = vmath.vector3()
	self.current_anim = nil
end

function final(self)
	-- Add finalization code here
	-- Remove this function if not needed
end

function update(self, dt)
	if vmath.length_sqr(self.dir) > 1 then
		self.dir = vmath.normalize(self.dir)
	end

	local p = go.get_position()
	go.set_position(p + self.dir * speed * dt)

	local anim = hash("idle")

	if self.dir.x > 0 then
		anim = hash("right")
	elseif self.dir.x < 0 then
		anim = hash("left")
	elseif self.dir.y > 0 then
		anim = hash("back")
	elseif self.dir.y < 0 then
		anim = hash("front")
	end

	if anim ~= self.current_anim then
		msg.post("#sprite", "play_animation", { id = anim })
		self.current_anim = anim
	end
	
	self.dir = vmath.vector3()
end

function on_message(self, message_id, message, sender)
	-- Add message-handling code here
	-- Remove this function if not needed
end

function on_input(self, action_id, action)
	if action_id == hash("front") then
		self.dir.y = -1
	elseif action_id == hash("back") then
		self.dir.y = 1
	elseif action_id == hash("left") then
		self.dir.x = -1
	elseif action_id == hash("right") then
		self.dir.x = 1
	end
end

function on_reload(self)
	-- Add reload-handling code here
	-- Remove this function if not needed
end

The atlas is also named correctly to “left” but I will post a screen:

Thanks!

Are you sure it is the correct atlas that is assigned to the sprite component?

I’m pretty sure. I actually didn’t have to do that part since it was done when first loading the tutorial. Is this correct?

Thanks!

Are there any other errors in the console?

Is there a space in front of the animation name? " left" ?

1 Like

Only when I use the keyboard arrows. Forward, Right, Back, Left. Same error message but it complains about the animation label.

ERROR:GAMESYS: Unable to play animation ‘back’ from texture ‘/_generated_294aab8e.texturec’ since it could not be found.
ERROR:GAMESYS: Unable to play animation ‘left’ from texture ‘/_generated_294aab8e.texturec’ since it could not be found.
ERROR:GAMESYS: Unable to play animation ‘right’ from texture ‘/_generated_294aab8e.texturec’ since it could not be found.
ERROR:GAMESYS: Unable to play animation ‘front’ from texture ‘/_generated_294aab8e.texturec’ since it could not be found.

WOW… 100% correct.

Thank you for your help, it is greatly appreciated.

I had made an HTML5 2D engine, but decided to check out what is out there. I had tried Cocos2d-x, their Creator, and didn’t like it all. I’m really liking how Defold is turning out, but I needed to figure out this issue. I’m glad it turned out to be a simple labeling error. Thank you again, Mathias_Westerdahl for spotting that; crazy eagle eyes.

I don’t have much experience with Lua, but programming languages are programming languages. I’ve been programming for over 18 years. I’m from Unreal Engine 3 and Unreal Engine 4. So, now you’re wondering, why not stick with Unreal Engine 4 for 2D? It’s a whole other beast to me. I’m so used to using it for 3D that it felt like learning everything new again for 2D, and then to have it all work with Facebook Instant… didn’t feel like it. I’d rather work with 2D in a dedicated engine.

Sorry for the rant/book. Thanks again everyone.

2 Likes