Attempting to create an advanced loop for games and programs