Problems with arguments being of the same type

I’ve attached my code below and and erros, i’m not sure how they came about nor how to fix them so any help would be greatly appreciated…


As you see in the error message, on line 56 you are trying to use the .x but it is not a vector3, but a number, i.e. a single value.

Check where you assign the self.velocityand make sure your types are consistent.

Please don’t share code as screenshots. Share it as text: How to get help

I managed to fix it by setting self.velocity to vmath.vector3(0,0,0) instead of 0. Do you know why this fixed it becuase i thought that vmath.vector3(0,0,0) is 0?

The length of vmath.vector3(0,0,0) is 0. A vector3 has three components (x,y,z). The number 0 doesn’t. So you can’t access the “x” property of a number, because there isn’t one.

5 Likes

i’ve got an issue where the attack animation doesn’t run until the player object leaves the collision box for the attack trigger, do you know how this happens/how to fix it?

Post a new thread and describe your issue in detail, including what you have tried already, what behaviour you are expecting, and what actually happens. Post your code as text!

2 Likes