i am making a cards game and by getting positions in a if statement i can check if the slots are occupied but it won’t let me do it. please help
here’s the script:
extends Node2D
var canoccupyno = 0
var noofclicks = 4
var canclick = true
var occupied1 = false
var occupied2 = false
var occupied3 = false
var occupied4 = false
var roundended = false
func Occupyslot(objj):
if canoccupyno == 1:
objj.position.x = 254
objj.position.y = 360
elif canoccupyno == 2:
objj.position.x = 392
objj.position.y = 360
elif canoccupyno == 3:
objj.position.x = 253
objj.position.y = 442
elif canoccupyno == 4:
objj.position.x = 390
objj.position.y = 442
else:
pass
func _on_player_sword_button_pressed():
checkplacement($PlayerSwordButton)
func checkplacement(Card):
if noofclicks > 0:
canclick = true
noofclicks -= 1
canoccupyno += 1
Occupyslot(Card)
else :
print(noofclicks)
print(“canclick is not false”)
canclick = false
func _on_player_shield_button_pressed():
checkplacement($PlayerShieldButton)
func _on_player_king_button_pressed():
checkplacement($PlayerKingButton)
func _on_player_blank_button_pressed():
checkplacement($PlayerBlankButton)
func _on_player_sword_button_2_pressed():
checkplacement($PlayerSwordButton2)
func _on_player_shield_button_2_pressed():
checkplacement($PlayerShieldButton2)
var allocuupied = false
func arealloccupied():
if $PlayerSwordButton.position = Vector2(254,360): #I want to check if all the cards are in the slots but it doesn’t allow me to check for position, it keeps giving me an error assignment not allowed in expression
func startround():
pass