diff --git a/scripts/game.gd b/scripts/game.gd index 432b3f5..e906827 100644 --- a/scripts/game.gd +++ b/scripts/game.gd @@ -134,9 +134,11 @@ func _process(delta: float) -> void: if game_ended: var anyplayerkeypressed=false + var id=0 for p in Gamestate.getPlayers(): - if Input.is_action_pressed(Gamestate.userinput_prefix+str(p.id)): + if Input.is_action_pressed(Gamestate.userinput_prefix+str(id)): anyplayerkeypressed=true + id+=1 if anyplayerkeypressed and timer_close.time_left Array[Player]: class Player: var inputkey:int var color:Color - var id:int + var colori - func _init(key:int, i:int=-1): + func _init(key:int, pcolori:int=-1): inputkey=key - id=i + colori=pcolori var sat = 1.0 var val = 0.7 - if i<0: + if colori<0: color=Color.from_hsv(randf_range(0.0,1.0), sat,val,1.0) else: - color=Color.from_hsv(fmod(0.3*i,1.0), sat,val,1.0) - print("i is "+str(i)+" h="+str(fmod(0.3*i,1.0))+" assigned color "+str(color)) + color=Color.from_hsv(fmod(0.3*colori,1.0), sat,val,1.0) + print("i is "+str(colori)+" h="+str(fmod(0.3*colori,1.0))+" assigned color "+str(color)) func startGame():