I’m new to Phaser and i’m making a game where the enemies, one at the time, are being spawned random at one of five y-positions(the y, positions are kept in an array [100, 200, 300, 400, 500]).
I’ve decided that the enemies can only be killed with the right combination of keys pressed at the same time on the keyboard. And i want the “right combination” to be different for each y-position.
Examle: If the Enemy are spawned at y:100, you can only kill it with ‘A’ and ‘S’,
If the Enemy are spawned at y:200, you can only kill it with ‘A’ and ‘D’, and so on.
Can anyone give me advice on how to keep track of the enemies positions and killing them with the right keycombo?
Maybe you could put the key combination into the array with the Y-position as an object and in the update function you would check if the key combo matches with the enemy visible (use setVisible()).