0
0
Fork 0

Make compass more precise

This commit is contained in:
Wuzzy 2017-01-09 02:03:09 +01:00
parent d28ec6f5e8
commit 07e824dcae
14 changed files with 6 additions and 16 deletions

View File

@ -21,8 +21,8 @@ minetest.register_globalstep(function(dtime)
local angle_north = math.deg(math.atan2(spawn.x - pos.x, spawn.z - pos.z))
if angle_north < 0 then angle_north = angle_north + 360 end
angle_dir = 90 - math.deg(dir)
local angle_relative = (angle_north - angle_dir) % 360
local compass_image = math.floor((angle_relative/30) + 0.5)%12
local angle_relative = (angle_north - angle_dir + 180) % 360
local compass_image = math.floor((angle_relative/11.25) + 0.5)%32
for j,stack in ipairs(player:get_inventory():get_list("main")) do
if minetest.get_item_group(stack:get_name(), "compass") ~= 0 and
@ -34,20 +34,10 @@ minetest.register_globalstep(function(dtime)
end
end)
local images = {
"compass_0.png",
"compass_1.png",
"compass_2.png",
"compass_3.png",
"compass_4.png",
"compass_5.png",
"compass_6.png",
"compass_7.png",
"compass_8.png",
"compass_9.png",
"compass_10.png",
"compass_11.png",
}
local images = {}
for frame=0,31 do
table.insert(images, "compass_compass.png^[verticalframe:32:"..frame)
end
local i
for i,img in ipairs(images) do

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB