View difference between Paste ID: PU7hFY08 and y7kAtDXW
SHOW: | | - or go back to the newest paste.
1
tfm.exec.disableAutoNewGame(true)
2
tfm.exec.disableAfkDeath(true)
3
tfm.exec.disableAutoShaman(true)
4
tfm.exec.disableAutoScore(disable)
5
tfm.exec.newGame("@6385854")
6
7
8
tx=0
9
ty=0
10
tangle=0
11
rx=0
12
ry=0
13
14
function eventChatCommand(name,message)
15
if message=="skip"  then
16
        tfm.exec.setGameTime (0 , true )
17
end
18
if message=="respawn"  then
19
     tfm.exec.respawnPlayer(name)
20
end
21
if message=="long" then
22
	tfm.exec.setGameTime(9999, true)
23
end
24
if message=="clear" then
25
	for id, object in pairs(tfm.get.room.objectList) do 
26
	tfm.exec.removeObject(id) 
27
	end
28
end
29
end
30
31
32
function eventNewPlayer(name)
33
    for _, k in pairs({40, 83, 32}) do
34
            tfm.exec.bindKeyboard(name, k, true, true)
35
    end
36
    system.bindMouse(name,true)
37
	tfm.exec.setPlayerScore(name, 100, false)
38
end
39
 
40
function eventKeyboard(player, key, down, x, y)
41
        if key==40 or key==83 then
42
		if tfm.get.room.playerList[player].isFacingRight==true then
43
            		tfm.exec.addShamanObject(35, x+15, y, 0, 30, 0, false)
44
		elseif tfm.get.room.playerList[player].isFacingRight==false then
45
			tfm.exec.addShamanObject(35, x-15, y, 180, -30, 0, false)
46
		end
47
        end
48-
local tx=tfm.get.room.playerList[player].x
48+
49-
local ty=tfm.get.room.playerList[player].y
49+
50-
local tangle=(180/math.pi)*math.atan2((y-ty),(x-tx))
50+
51-
local rx=x-tx
51+
52-
local ry=y-ty
52+
53
function eventMouse(player,x,y)
54
tx=tfm.get.room.playerList[player].x
55-
print(tangle)
55+
ty=tfm.get.room.playerList[player].y
56
tangle=(180/math.pi)*math.atan2((y-ty),(x-tx))
57-
        tfm.exec.addShamanObject(35, tx+20, ty, tangle, 30, ry/rx*30, false)
57+
rx=x-tx
58
ry=y-ty
59-
	tfm.exec.addShamanObject(35, tx-20, ty, tangle, -30, ry/rx*(-30), false)
59+
60
if math.abs(ry)>=math.abs(rx) then
61-
	tfm.exec.addShamanObject(35, tx, ty+15, tangle, 0, 30, false)
61+
	if ry<0 then
62
		rx=(rx/math.abs(ry))*30
63-
	tfm.exec.addShamanObject(35, tx, ty-15, tangle, 0, -30, false)
63+
		ry=-30
64
	elseif ry>0 then
65
		rx=(rx/math.abs(ry))*30
66
		ry=30
67
	end
68
elseif math.abs(rx)>math.abs(ry) then
69
	if rx<0 then
70
		ry=(ry/math.abs(rx))*30
71
		rx=-30
72
	elseif rx>0 then
73
		ry=(ry/math.abs(rx))*30
74
		rx=30
75
	end
76
end
77
78
79
80
81
if x>tx then
82
        tfm.exec.addShamanObject(35, tx+30, ty, tangle, rx, ry, false)
83
elseif x<tx then
84
	tfm.exec.addShamanObject(35, tx-30, ty, tangle, rx, ry, false)
85
elseif x==tx and y>ty then
86
	tfm.exec.addShamanObject(35, tx, ty+30, tangle, 0, 30, false)
87
elseif x==tx and y<ty then
88
	tfm.exec.addShamanObject(35, tx, ty-30, tangle, 0, -30, false)
89
end
90
end
91
 
92
function eventPlayerDied(name)
93
tfm.exec.setPlayerScore(name, -1, true)
94
tfm.exec.respawnPlayer(name)
95
end
96
97
98
for name in pairs(tfm.get.room.playerList) do
99
    eventNewPlayer(name)
100
end