[Python] is it possible to multiply a raylib vector2 with int?

Discussão em 'Python' iniciado por Stack, Fevereiro 4, 2025.

  1. Stack

    Stack Membro Participativo

    I want to do something like:

    from pyray import Vector2
    v2 = Vector2(1,2)
    print(v2 * 10)


    But I get:


    TypeError: unsupported operand type(s) for *: '_cffi_backend.__CDataOwn' and 'int'
    ​

    Same result if I multiple the vector with a float.

    Is there a way to do this operation in raylib? I know I can do

    v2 = Vector2(1,2)
    print(v2.x * 10)
    print(v2.y * 10)


    but it's a bit annoying to write 2 lines instead of 1.

    Continue reading...

Compartilhe esta Página