aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gamemode/hud/games/connectthedots.lua23
1 files changed, 16 insertions, 7 deletions
diff --git a/gamemode/hud/games/connectthedots.lua b/gamemode/hud/games/connectthedots.lua
index c5aea2a..b0cdaf9 100644
--- a/gamemode/hud/games/connectthedots.lua
+++ b/gamemode/hud/games/connectthedots.lua
@@ -154,31 +154,40 @@ Game.AddRegDot = function(spelltab)
--Pick a random distance from this dot to the screen edge, and put a dot there, but at least 20 pixels
local rand = 0
- local totop = fd[1]+20
- local toleft = fd[0]+20
- local tobot = ScrH() - totop - 40
- local toright = ScrW() - toleft - 40
+ local totop = fd[1]
+ local toleft = fd[0]
+ local tobot = ScrH() - totop
+ local toright = ScrW() - toleft
--If we're in the first quadrent
if(position > 0 and position <= 90) then
--pick a distnce between us and the closer edge
local closer = math.min(totop,toright)
+ print("Closer edge is " .. closer)
rand = math.random(20,closer)
elseif(position > 90 and position <= 180) then
local closer = math.min(totop,toleft)
+ print("Closer edge is " .. closer)
rand = math.random(20,closer)
elseif(position > 180 and position <= 270) then
local closer = math.min(toleft,tobot)
+ print("Closer edge is " .. closer)
rand = math.random(20,closer)
else
local closer = math.min(tobot,toright)
+ print("Closer edge is " .. closer)
rand = math.random(20,closer)
end
print("And at a distance of " .. rand)
-
- local xpos = (math.cos(position)*rand)
- local ypos = (math.sin(position)*rand)
+ local cosmul = math.cos(math.rad(position))
+ --Remember that screens are funny, with 0,0 in the UPPER left hand corner, this tricked me up for the longest time...
+ local sinmul = -math.sin(math.rad(position))
+ print("Cosine mul is " .. cosmul)
+ print("Sine mul is " .. sinmul)
+
+ local xpos = (cosmul*rand)+fd[0]
+ local ypos = (sinmul*rand)+fd[1]
print("I think I should add a dot at " .. xpos .. "," .. ypos)
local newdot = {}