Using range on the x-axis

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jbliss243

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)
	add_child(card)
	player_cards.append(card)
:bust_in_silhouette: Reply From: exuin

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.