War battles tutorial issue - movement script


#21

Yes, I saw that as well. And it’s either self.dir or self.speed that is nil. Using print() to figure out which one is your next step. Once you know which variable it is you need to figure out why it’s nil. Could it be that you forgot to initialise it in the init() function as is done in the tutorial? Perhaps you have some error in your on_input() function? Do you see any error in the console, prior to the error message?


#22

Hmm, it must be the init, I deleted it thinking, as later in the tutorial, the init isn’t present in the code example, then one of the other code functions replaces it or something like that. Later today I’ll put the init string back in and let you know what happens.


#23

Yep, that’s surely it!


#24

Okay, now the rockets don’t play the explosion animation, they move correctly, but when they reach the distance theryre supposed to explode, three just rotate and stay still. The error I’m now getting is error:gameobject: instance unknown could my be found when displaying message’ play_animation" sent from main:/instance1#rocket


#25

Ok, so you’re sending a play_animation message to a sprite component on the rocket and the URL part of the msg.post() call doesn’t match what you’ve set in the editor for game object and component id. Read more about URLs in the manual and double check against the tutorial that you’ve named everything the same way.


#26

Thanks, I figured it out, whilst changing the code for collisions, I forgot to put a hash in front of the sprite XD