Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
TntVirtualPad is overlaps other elements — Gideros Forum

TntVirtualPad is overlaps other elements

godwapgodwap Member
edited March 2014 in General questions
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

  • Screenshot.
    Joy.jpg
    812 x 539 - 233K
  • ar2rsawseenar2rsawseen Maintainer
    @godwap what do you mean under floor? As in what does the floor stand for in this situation?

    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:
    self:addChild(self.floor)
    and here:
    vPad = CTNTVirtualPad.new(self, "images/tntskinpad", PAD.STICK_SINGLE, PAD.BUTTONS_ONE, 20,1)
    :)
  • ar2rsawseen, no Level dont intentional, just typo
    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.

  • ar2rsawseenar2rsawseen Maintainer
    @godwap are you sure that vpad is below the floor?
    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? :)
  • @godwap

    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 ?

    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
Sign In or Register to comment.