Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setupPlayerPlacementCircle(float radius = -1.0, bool setPlayerLocation = false, int numberOfPlayers = cNumberNonGaiaPlayers, bool half = false, float locX = -1.0){
- //First select a random number within the radius
- float distanceConstant = (2.0*PI/numberOfPlayers);
- float startingXpoint = rmRandFloat(0.0, radius);
- if(locX != -1.0){
- startingXpoint = locX;
- }
- float startingZpoint = sqrt(Math_sqr(radius) - Math_sqr(startingXpoint));
- float angle = Math_atan(startingZpoint/startingXpoint);
- xA = startingXpoint + 0.5;
- zA = startingZpoint + 0.5;
- if(half){
- angle = angle + distanceConstant/2.0;
- xA = radius * Math_cos(angle) + 0.5;
- zA = radius * Math_sin(angle) + 0.5;
- }
- rmEchoInfo("angle = "+angle);
- if(numberOfPlayers > 1){
- xB = radius * Math_cos(angle + distanceConstant) + 0.5;
- zB = radius * Math_sin(angle + distanceConstant) + 0.5;
- }
- angle = angle + distanceConstant;
- if(numberOfPlayers > 2){
- xC = radius * Math_cos(angle + distanceConstant) + 0.5;
- zC = radius * Math_sin(angle + distanceConstant) + 0.5;
- }
- angle = angle + distanceConstant;
- if(numberOfPlayers > 3){
- xD = radius * Math_cos(angle + distanceConstant) + 0.5;
- zD = radius * Math_sin(angle + distanceConstant) + 0.5;
- }
- angle = angle + distanceConstant;
- if(numberOfPlayers > 4){
- xE = radius * Math_cos(angle + distanceConstant) + 0.5;
- zE = radius * Math_sin(angle + distanceConstant) + 0.5;
- }
- angle = angle + distanceConstant;
- if(numberOfPlayers > 5){
- xF = radius * Math_cos(angle + distanceConstant) + 0.5;
- zF = radius * Math_sin(angle + distanceConstant) + 0.5;
- }
- angle = angle + distanceConstant;
- if(numberOfPlayers > 6){
- xG = radius * Math_cos(angle + distanceConstant) + 0.5;
- zG = radius * Math_sin(angle + distanceConstant) + 0.5;
- }
- angle = angle + distanceConstant;
- if(numberOfPlayers > 7){
- xH = radius * Math_cos(angle + distanceConstant) + 0.5;
- zH = radius * Math_sin(angle + distanceConstant) + 0.5;
- }
- angle = angle + distanceConstant;
- if(numberOfPlayers > 8){
- xI = radius * Math_cos(angle + distanceConstant) + 0.5;
- zI = radius * Math_sin(angle + distanceConstant) + 0.5;
- }
- angle = angle + distanceConstant;
- if(numberOfPlayers > 9){
- xJ = radius * Math_cos(angle + distanceConstant) + 0.5;
- zJ = radius * Math_sin(angle + distanceConstant) + 0.5;
- }
- angle = angle + distanceConstant;
- if(numberOfPlayers > 10){
- xK = radius * Math_cos(angle + distanceConstant) + 0.5;
- zK = radius * Math_sin(angle + distanceConstant) + 0.5;
- }
- angle = angle + distanceConstant;
- if(numberOfPlayers > 11){
- xL = radius * Math_cos(angle + distanceConstant) + 0.5;
- zL = radius * Math_sin(angle + distanceConstant) + 0.5;
- }
- //Set Player Location
- if(setPlayerLocation){
- if(numberOfPlayers > 0){ rmSetPlayerLocation(1, xA, zA); }
- if(numberOfPlayers > 1){ rmSetPlayerLocation(2, xB, zB); }
- if(numberOfPlayers > 2){ rmSetPlayerLocation(3, xC, zC); }
- if(numberOfPlayers > 3){ rmSetPlayerLocation(4, xD, zD); }
- if(numberOfPlayers > 4){ rmSetPlayerLocation(5, xE, zE); }
- if(numberOfPlayers > 5){ rmSetPlayerLocation(6, xF, zF); }
- if(numberOfPlayers > 6){ rmSetPlayerLocation(7, xG, zG); }
- if(numberOfPlayers > 7){ rmSetPlayerLocation(8, xH, zH); }
- if(numberOfPlayers > 8){ rmSetPlayerLocation(9, xI, zI); }
- if(numberOfPlayers > 9){ rmSetPlayerLocation(10, xJ, zJ);}
- if(numberOfPlayers > 10){ rmSetPlayerLocation(11, xK, zK);}
- if(numberOfPlayers > 11){ rmSetPlayerLocation(12, xL, zL);}
- }
- }
- //Don't need else since it will exit upon true conditions - and now it aligns :D
- float rmGetPlayerXLoc(int player = 1){
- if(player == 1){ return(xA);}
- if(player == 2){ return(xB);}
- if(player == 3){ return(xC);}
- if(player == 4){ return(xD);}
- if(player == 5){ return(xE);}
- if(player == 6){ return(xF);}
- if(player == 7){ return(xG);}
- if(player == 8){ return(xH);}
- if(player == 9){ return(xI);}
- if(player == 10){ return(xJ);}
- if(player == 11){ return(xK);}
- if(player == 12){ return(xL);}
- }
- float rmGetPlayerZLoc(int player = 1){
- if(player == 1){ return(zA);}
- if(player == 2){ return(zB);}
- if(player == 3){ return(zC);}
- if(player == 4){ return(zD);}
- if(player == 5){ return(zE);}
- if(player == 6){ return(zF);}
- if(player == 7){ return(zG);}
- if(player == 8){ return(zH);}
- if(player == 9){ return(zI);}
- if(player == 10){ return(zJ);}
- if(player == 11){ return(zK);}
- if(player == 12){ return(zL);}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement