Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func targetingMyCards(card, target_node):
- var goodPosition: bool
- if card.get_node("Card/BattleType").texture == preload("res://infantry token-1.png.png") and target_node.get_node("Card/BattleType").texture == preload("res://spearman token -1.png.png"):
- goodPosition = true
- elif card.get_node("Card/BattleType").texture == preload("res://spearman token -1.png.png") and target_node.get_node("Card/BattleType").texture == preload("res://cavalry token-1.png.png"):
- goodPosition = true
- elif card.get_node("Card/BattleType").texture == preload("res://cavalry token-1.png.png") and target_node.get_node("Card/BattleType").texture == preload("res://infantry token-1.png.png"):
- goodPosition = true
- else:
- goodPosition = false
- print (card, "GP", goodPosition)
- if goodPosition == false and int(card.get_node("Card/MovCard").text) >= 0 and pos < 35: # looks to the right for a better position
- get_new_target_card_right(target_node)
- print("looking right")
- var betterPosition: bool
- if card.get_node("Card/BattleType").texture == preload("res://infantry token-1.png.png") and target_node.get_node("Card/BattleType").texture == preload("res://spearman token -1.png.png"):
- betterPosition = true
- elif card.get_node("Card/BattleType").texture == preload("res://spearman token -1.png.png") and target_node.get_node("Card/BattleType").texture == preload("res://cavalry token-1.png.png"):
- betterPosition = true
- elif card.get_node("Card/BattleType").texture == preload("res://cavalry token-1.png.png") and target_node.get_node("Card/BattleType").texture == preload("res://infantry token-1.png.png"):
- betterPosition = true
- print(card, "BP", betterPosition)
- if betterPosition == true:
- get_back_node(target_node)
- if target_node.get_node("Card").visible == false:
- moveEnemyCard(card, target_node)
- print("I moved")
- elif goodPosition == false and int(card.get_node("Card/MovCard").text) >= 0 and pos > 31:
- var betterPosition: bool
- get_new_target_card_left(target_node) # looks to the left for a better position
- print("looking left")
- if card.get_node("Card/BattleType").texture == preload("res://infantry token-1.png.png") and target_node.get_node("Card/BattleType").texture == preload("res://spearman token -1.png.png"):
- betterPosition = true
- elif card.get_node("Card/BattleType").texture == preload("res://spearman token -1.png.png") and target_node.get_node("Card/BattleType").texture == preload("res://cavalry token-1.png.png"):
- betterPosition = true
- elif card.get_node("Card/BattleType").texture == preload("res://cavalry token-1.png.png") and target_node.get_node("Card/BattleType").texture == preload("res://infantry token-1.png.png"):
- betterPosition = true
- if betterPosition == true:
- get_back_node(target_node)
- if target_node.get_node("Card").visible == false:
- moveEnemyCard(card, target_node)
- print("I moved")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement