Cant get play button to work on game menu

Hi,

I’m trying to create the game called Blackout, its a pretty old school game that most are familiar with,

Quick brief!

The concept is simple the users uses the paddle moving it side to side at the bottom of the screen to keep a moving ball in play and to break the bricks at the top of the screen thereby accumulating points and progressing to the next level after all bricks have been broken,

The problem I’m having is simple, iv coded about half of the game,

I can get the main menu to appear, however I can’t seem to get the “Play” button to work! (Kicks rock)

Iv been trying to crack this for numerous hours yet have not managed to crack it, I’m pretty new to programing and this is my first game,

Iv include some of the code from my main.lua file,

I anyone could point me in the right direction or offer a possible solution it would be greatly appreciated,

I think the issue may be with the listener for the “play” button?

I don’t receive any errors

Should you require any additional information please let me know,

 

Apologies if this I not the correct place to post this, this seemed like the best place, however if it needs to be moved to a better suited location, please let me know

Again, I appreciate any help and your time,

Kind regards,

Jamal

Please find latest the error I am receiving,

Iv tried changing a few things but I cant figure out what the error means, any suggestions?

Jamal,

I see in your ‘function main’ you set your event listener for the button image (which will call ‘loadGame’), BUT then you have a line of code  just under that ‘loadGame()’, and this calls that function directly and immediately …

It gets called as soon as ‘function main’ executes.  That call does not send an ‘event’ table to that function, thus the error message that ‘event’ is nil.  Remove that line, and it should correct that error.

However, as you are very new, there are possibly other issues in the code … so if you continue to have errors, I think posting the full main.lua will be helpful  … that is if it is not to large.  At least we would need to see the top section of main, that is not visible in the sample you sent.

Here is a tutorial I found on the internet.  I searched the internet quickly and found this breakout-game tutorial. I did not have time to watch it myself, but it is newer then others I found on the internet and I think it could be helpful to you:

http://www.dailymotion.com/video/x2w4t7l

good luck

Bob

Please find latest the error I am receiving,

Iv tried changing a few things but I cant figure out what the error means, any suggestions?

Jamal,

I see in your ‘function main’ you set your event listener for the button image (which will call ‘loadGame’), BUT then you have a line of code  just under that ‘loadGame()’, and this calls that function directly and immediately …

It gets called as soon as ‘function main’ executes.  That call does not send an ‘event’ table to that function, thus the error message that ‘event’ is nil.  Remove that line, and it should correct that error.

However, as you are very new, there are possibly other issues in the code … so if you continue to have errors, I think posting the full main.lua will be helpful  … that is if it is not to large.  At least we would need to see the top section of main, that is not visible in the sample you sent.

Here is a tutorial I found on the internet.  I searched the internet quickly and found this breakout-game tutorial. I did not have time to watch it myself, but it is newer then others I found on the internet and I think it could be helpful to you:

http://www.dailymotion.com/video/x2w4t7l

good luck

Bob