+1 vote

I'm working on a card game and I want the cards in the players hand to be displayed horizontally. However the only way I know how to do this is with the "in range" function which I think limits me to having the cards lined up vertically. Here is my code any advice would be helpful:

for i in range(5):
    var card = card_scene.instance()
    card.position = Vector2(screen_size.x-140, 100 + i * 100)
in Engine by (18 points)

1 Answer

0 votes
Best answer

Range is a function that returns an array of numbers. It has nothing to do with x-axis or y-axis. Just put the i variable in the first parameter of vector2 instead of the second.

by (7,978 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.