Having Astronaut Tutorial Errors (SOLVED)

I have been attempting to complete the Walking Astronaut Tutorial but I cannot get the guy to move with the arrow keys. I put in the code verbatim as advised in the text, but while attempting to run I receive this error: image

My code it’s referring to:

The astronaut does not respond at all to movement. Is there something missing?

Did you set self.dir = vmath.vector3() in the init function?
From the error it looks like self.dir is not a vector3.

1 Like

Hello, I am not really sure. Here is a screenshot of my init function for reference. I was advised to type it in exactly like this in the tutorial.

Okay, I think the tutorial might be a bit unclear. You have an init function inside another one.

local speed = 150 should go outside of the init function not inside any function.
So basically remove the outer init function from your code so it looks like this:

local speed = 150

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

Then your update and other functions go below that.

Alright, I made the edits an my code now looks like this:

After attempting to build, I am still unable to move and I have received another error message.

image

Would a full shot of my code so far help better?

Yeah if you could share all your code that would help to find the issue.

Alright, here it is:

Where I am currently at in the tutorial, I am supposed to have movement in 8 directions.

Sorry my bad, I made a mistake in the code I showed you. I’ve edited it now.
I said self.dir = vmath.vector() instead of self.dir = vmath.vector3().

If you add the ‘3’ after the vector it should work I think.

3 Likes

No worries, it works! The astronaut has now begun to move.
Thank you so much for the help! :smiley:

2 Likes

No problem. Happy to help :smile:

3 Likes