Hello Corona Community!
I am using the Joystick class from http://developer.anscamobile.com/code/joystick. I am trying to use the Joystick with the Director 1.4, however I’m receiving an attempt to index global ‘joystick’ (a nil value) error. Can someone help me with what I’m doing wrong?
Error
\Code\tileEngine.lua:61: in function \Code with Runtime error
\Code\tileEngine.lua:61: attemt to index global ‘joystick’ (a nil value) stack traceback:
Code
module(..., package.seeall)
new = function ()
------------------
-- Groups
------------------
local localGroup = display.newGroup()
-- Setup Environment
display.setStatusBar( display.HiddenStatusBar )
system.activate( "multitouch" )
local movieclip = require("movieclip")
-- Load Tile Engine
local tileEngine = require( "tileEngine" )
-- Generate Background
local background = tileEngine.newSurface( "background.png" , 2 , 2 , 1 , 1 , 0 )
localGroup:insert(background)
-- Generate Clouds
local clouds1 = tileEngine.newSurface( "clouds1.png" , 2 , 3 , 1 , 1 , 0 )
localGroup:insert(clouds1)
-- Load Plane
local plane = require( "plane" )
localGroup:insert(plane)
-- Generate More Clouds
local clouds2 = tileEngine.newSurface( "clouds2.png" , 2 , 5 , 1 , 0.8 , 0 )
localGroup:insert(clouds2)
-- Load Joystick Class
local joystickClass = require( "joystick" )
-- Add A New Joystick
joystick = joystickClass.newJoystick{
outerImage = "", -- Outer Image - Circular - Leave Empty For Default Vector
outerRadius = 60, -- Outer Radius - Size Of Outer Joystick Element - The Limit
outerAlpha = 0, -- Outer Alpha ( 0 - 1 )
innerImage = "joystickInner.png", -- Inner Image - Circular - Leave Empty For Default Vector
innerRadius = "", -- Inner Radius - Size Of Touchable Joystick Element
innerAlpha = 1, -- Inner Alpha ( 0 - 1 )
backgroundImage = "joystickDial.png", -- Background Image
background\_x = 0, -- Background X Offset
background\_y = 0, -- Background Y Offset
backgroundAlpha = 1, -- Background Alpha ( 0 - 1 )
position\_x = 25, -- X Position Top - From Left Of Screen - Positions Outer Image
position\_y = 335, -- Y Position - From Left Of Screen - Positions Outer Image
ghost = 155, -- Set Alpha Of Touch Ghost ( 0 - 255 )
joystickAlpha = 0.4, -- Joystick Alpha - ( 0 - 1 ) - Sets Alpha Of Entire Joystick Group
joystickFade = true, -- Fade Effect ( true / false )
joystickFadeDelay = 2000, -- Fade Effect Delay ( In MilliSeconds )
onMove = plane.planeControl -- Move Event
}
localGroup:insert(joystick)
------------------
-- MUST return a display.newGroup()
------------------
return localGroup
end
[import]uid: 14218 topic_id: 15402 reply_id: 315402[/import]
