posted to: Your first practice

Built-in type error

Hi, am I completely mad or should this not be throwing an error?

  • Nathan Lovato replied

    You need to remove the dot. To create a vector2 value, you write Vector(x_value, y_value). For example, in your case, it should be:

    Vector2(200, 0)

    The dot is used to access functions and variables on a given value or type, as in Array.new() (the function to create a new array).

    But to create a Vector2, you don't need to access a function. Just like creating a number, you don't need to access a function. Why? Some value types like whole numbers, decimal numbers, and Vector2 are basic building blocks built into the programming language, allowing you to create them more directly than some others.