summaryrefslogtreecommitdiff
path: root/pong/init.lua
diff options
context:
space:
mode:
authorFernando Carmona Varo <ferkiwi@gmail.com>2015-10-25 22:04:22 +0100
committerFernando Carmona Varo <ferkiwi@gmail.com>2015-10-25 22:04:44 +0100
commit23814830b04f778e6c2ca655d28644a39f4d3d2f (patch)
treec053d28fb766ed0411504e89fba4e02dd6b728c3 /pong/init.lua
parentd931770befaef90d296de67f0e68ca09c81f853b (diff)
Added pong ball
Diffstat (limited to 'pong/init.lua')
-rw-r--r--pong/init.lua15
1 files changed, 13 insertions, 2 deletions
diff --git a/pong/init.lua b/pong/init.lua
index 8c277df..b2ed3e1 100644
--- a/pong/init.lua
+++ b/pong/init.lua
@@ -1,3 +1,6 @@
+
+dofile(minetest.get_modpath("pong").."/ball.lua")
+
local blocks = {
{"floor","Floor"},
{"dash","Dash"},
@@ -113,7 +116,7 @@ minetest.register_node("pong:block",{
"pong_floor.png",
"pong_floor.png",
"pong_dash.png",
- },
+ },
drawtype = "normal",
paramtype = "light",
paramtype2 = "facedir",
@@ -121,6 +124,14 @@ minetest.register_node("pong:block",{
groups = {cracky = 1},
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local schem = minetest.get_modpath("pong").."/schems/pong.mts"
- minetest.place_schematic({x=pos.x,y=pos.y-1,z=pos.z},schem,0, "air", true)
+ pos.y = pos.y - 1
+ minetest.place_schematic(pos,schem,0, "air", true)
+
+ local ballpos = vector.add(pos, {x=9,y=1,z=4})
+ local ball = minetest.add_entity(ballpos, "pong:ball"):get_luaentity()
+
+ -- give to the ball the boundaries of the field
+ ball.minp = vector.add(pos, {x=1,y=0,z=1})
+ ball.maxp = vector.add(pos, {x=17,y=2,z=8})
end,
})