Rob, I took my code out of composer and built for Android, but I still get the Runtime Error on my device. What I don’t understand is it’s saying floor1 is a nil value. “floor1” is a local variable that isn’t placed into a function. It’s in the main chunk. I’m gonna send the code in a PM (I’d rather not post it for everyone to see). Would you mind looking at it?
EDIT: There doesn’t seem to be an option to PM you on your page. How else can I show you?
Here is the top part of my code, up until floor1:
– Add physics
local composer = require( “composer” )
local gameUI = require(“gameUI”)
local ragdogLib = require “ragdogLib”;
local physics = require(“physics”)
– physics.setDrawMode(“hybrid”)
– physics.setDrawMode(“debug”)
physics.setDrawMode(“normal”)
physics.start()
physics.gravity = 15
– Forward references
local myPlayer
– Set Variables
local xMin = display.screenOriginX
local yMin = display.screenOriginY
local xMax = display.contentWidth - display.screenOriginX
local yMax = display.contentHeight - display.screenOriginY
local _W = display.contentWidth
local _H = display.contentHeight
local centerX = display.contentCenterX
local centerY = display.contentCenterY
local rand = math.random
local randColor = math.random(0, 255)/255
local dragBody = gameUI.dragBody
–[[local background = display.newImageRect(“bg1.png”, display.contentWidth, display.contentHeight)
background.x = display.contentWidth*0.5
background.y = display.contentHeight*0.5
]]–
– Let’s set the level up here
local background = display.newImage(“full-background.png”, centerX, centerY)
background.x = _W/2
background.y = _H/2
local floor1 = display.newImage("/images/Items/springboardUp.png", 80, 30)
floor1.x = 400
floor1.y = centerY + 80
floor1:setFillColor(0, 0, 1)
physics.addBody(floor1, “kinematic”, {radius = 10})
floor1.rotation = 50
floor1.name = “floor1”
floor1.isPlatform = true
The error is where floor1.x is defined.
floor1 is only called one more time… and that’s in a function to transition floor1 back and forth across the screen. Here’s the code for that section:
function movePlatform2()
transition.to( floor1, {time = 5000, x = 400, onComplete = movePlatform } )
end
function movePlatform()
transition.to( floor1, {time = 5000, x = 40, onComplete = movePlatform2 } )
end