Assertion Failed! Stack Traceback:...

I’m new and I’m just playing around with game development. Been staring at this for hours trying to figure out what I’m doing wrong but I just don’t see it.

   Corona_Runtime_Error.jpg

All I want to happen is when the jumper is tapped, he moves up on the y axis. I keep getting different errors when I move things around but here are how things are currently.

 – usuals

display.setStatusBar(display.HiddenStatusBar)

local centerX = display.contentCenterX

local centerY = display.contentCenterY

– forward references

local jumper

– preload audio

local function createPlayScreen( )

    local background = display.newImage(“snowBackground.jpg”)

        background.yScale = 1.3

        background.xScale = 1.3        

        background.x = centerX

        background.y = centerY

        background.alpha = 0

            transition.to ( background, { time=2000, alpha=1 } )

    jumper = display.newImage(“jumper.png”)

        jumper.xScale = .65

        jumper.yScale = .65

        jumper.x = centerX

        jumper.y = display.contentHeight +100

            transition.to ( jumper, { time=2000, y=display.contentHeight - 100} )

        

    local title = display.newImage(“titleG.png”)

        title.x = centerX

        title.xScale = .65

        

        title.alpha = 0

            

            transition.to ( title, { time=2000, alpha=1 } )

end

local function jumperTap( )

    

    jumper:addEventListener (  “tap”,  jumperJump  )

    

end    

local function startGame( )

end

local function planetDamage( )

end

local function hitPlanet( )

end

local function jumperJump(event)

    

    transition.to(  jumper,  { time=500,  y=100 }  )

    

end

createPlayScreen( )

jumperTap( )

Any and all help is greatly appreciated.

unfortunately the assertion statement doesn’t give you any reasonable feedback so you know what the issue is, e.g. “addEventListener: event listener must be a function”.

but i’d look at the the addEventListener line here:

local function jumperTap( ) jumper:addEventListener ( "tap", jumperJump ) end 

you might want to try and forward-declare ‘jumperJump’ as you have done for ‘jumper’.

-- at top of module local jumperJump -- anywhere else jumperJump = function( event ) ... rest end

cheers, dmc

The assertion message is telling you there is a problem in the function starting on line 45 and the EventListener. “jumperJump” is undefined because it doesn’t exist yet. Adding the forward reference should fix the problem.

unfortunately the assertion statement doesn’t give you any reasonable feedback so you know what the issue is, e.g. “addEventListener: event listener must be a function”.

but i’d look at the the addEventListener line here:

local function jumperTap( ) jumper:addEventListener ( "tap", jumperJump ) end 

you might want to try and forward-declare ‘jumperJump’ as you have done for ‘jumper’.

-- at top of module local jumperJump -- anywhere else jumperJump = function( event ) ... rest end

cheers, dmc

The assertion message is telling you there is a problem in the function starting on line 45 and the EventListener. “jumperJump” is undefined because it doesn’t exist yet. Adding the forward reference should fix the problem.