- Edited
I'm writing a simple Space Invaders clone (the '78 version) but I have no idea how to move the aliens.<br />This is my scene:<br /><img alt="k-I4WeoSk2P9Ti21j77CXXlB9NJy0hEljk3kjqqnjT4dl0size1600x1200size_mode3" src="https://photos-1.dropbox.com/t/2/AACweMaLTpq_RfuoC_KWO9K7-FIoIQr33juRp5gCkpsHZw/12/219380198/png/32x32/1/_/1/2/Senza%20titolo-1.png/EKW4_6QBGOYlIAIoAg/k-I4WeoSk2P9Ti21j77CXXlB9NJy0hEljk3kjqqnjT4?dl=0&size=1600x1200&size_mode=3" title="Image: https://photos-1.dropbox.com/t/2/AACweMaLTpq_RfuoC_KWO9K7-FIoIQr33juRp5gCkpsHZw/12/219380198/png/32x32/1/_/1/2/Senza%20titolo-1.png/EKW4_6QBGOYlIAIoAg/k-I4WeoSk2P9Ti21j77CXXlB9NJy0hEljk3kjqqnjT4?dl=0&size=1600x1200&size_mode=3"><br /><br />And this is my scene tree:<br />
<br />&nbsp; &nbsp; Node2d<br />&nbsp; &nbsp; ---Enemies (Node2)<br />&nbsp; &nbsp; ------Alien1<br />&nbsp; &nbsp; ------Alien2<br />&nbsp; &nbsp; ------Alien3<br />&nbsp; &nbsp; ------AlienN<br /><br /><br />And this is the part of the code where i work with the aliens:<br />
<br />if alien_time &gt; 1:<br />&nbsp; &nbsp; for alien in get_node(&quot;Enemies&quot;).get_children():<br /> <a rel="nofollow" target="_blank">#move</a> alien and check the position<br />&nbsp; &nbsp; alien_time = 0<br />else:<br />&nbsp; &nbsp; alien_time += delta<br /><br /><br />I would like to move all the aliens to the right until the reach the red line then they go down and then to the left until the red line and they have to repeat this until they collide with the green line.<br />I'm not sure how to do this,I can't get the last alien position because if the alien get killed it won't work.<br />I could get the "Enemies" node position and check if is near the red line or not.<br />Any idea on how to make this work?