Why TntVirtualPad under floor in this example?
Joystick = Core.class(Sprite)
function Joystick:init(Map, Level)
local function is32bit()
return string.dump(is32bit):byte(9) == 4
end
if is32bit() then
require("libs/tntvpad32")
else
require("libs/tntvpad64")
end
self.floor = Bitmap.new(Texture.new("images/bg.jpg"))
self.floor:setAnchorPoint(0, 1)
self.floor:setPosition(0, conf.height)
stage:addChild(self.floor)
-- setup Virutal Pad
vPad = CTNTVirtualPad.new(stage, "images/tntskinpad", PAD.STICK_SINGLE, PAD.BUTTONS_ONE, 20,1)
vPad:setTextures(PAD.COMPO_BUTTON1, "buttona.png")
vPad:setJoyStyle(PAD.COMPO_LEFTPAD, PAD.STYLE_MOVABLE)
vPad:setJoyAsAnalog(PAD.COMPO_LEFTPAD, false)
vPad:setJoyAsAnalog(PAD.COMPO_RIGHTPAD, true)
--vPad:setICade(false)
vPad:start()
--level = Level()
vPad:addEventListener(PAD.LEFTPAD_EVENT, self.leftJoy, self)
vPad:addEventListener(PAD.BUTTON1_EVENT, self.jump, self)
end
function Level:leftJoy(e)
end
function Level:jump(e)
end
Comments
Also at first your class is called Joystick and then Level, is it intentional?
Also if you are creating a scene or layer, then you usually should add everything to this layer by providing self, instead of stage
like here:
Thank for explanation about self, but problem remains.
floor is not floor, just name for example, instead of him i load TiledMap layer.
I called Joystick from main.lua, in Joystick i first add floor and then add vPad, but why vPad below floor?
Sorry for my very bad english.
from the screenshot I see a button in the right bottom corner, which seems to be semi transparented
But currently I don't remember, maybe something is going on inside vpad?
if you send me a sample project i'll try to help. (maybe a tnt vpad bug?)
tried to change
self.floor:setAnchorPoint(0, 1)
self.floor:setPosition(0, conf.height)
to
self.floor:setAnchorPoint(0, 0)
self.floor:setPosition(0, 0)
and see what happen ?
www.tntengine.com