Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
some help
#3
@Yannici: Was, wenn dann aber schon alles voll ist da? Tongue

@Sinner:
Before I joined the TWLan Dev, I wrote a little script for myself and it looked similar to this:
PHP Code:
// Given variables: // $direction = direction in which the village should be created // $villages = amount of villages // Coord-System is like in Tribalwars // So, the main idea is to find a circle where the village is created on $radius = sqrt($villages); if($direction == "nw" || $direction == "sw") { $x = rand(0, -1); } else { $x = rand(0, 1); } // Now we have a horizontal value and need the vertical one $y = cos(asin($x)); // But it will always be positive, so we have to make another check if($direction == "se" || $direction == "sw") { $y *= (-1); } // All we have to do now is multiply x and y with the radius and add the center coords of the map $x *= $radius; $y *= $radius; $x += 500; $y += 500; $x = round($x); $y = round($y); // And then of course check if this coords are free ;)

Greetings
Molt
Reply


Messages In This Thread
some help - by sinner - 02.07.2011, 00:42
RE: Game developing hotfix help - by Yannici - 02.07.2011, 01:52
RE: Game developing hotfix help - by Molt - 02.07.2011, 08:00
RE: Game developing hotfix help - by Yannici - 02.07.2011, 10:53
RE: Game developing hotfix help - by sinner - 02.07.2011, 10:30
RE: Game developing hotfix help - by Molt - 02.07.2011, 10:47



Users browsing this thread: 1 Guest(s)