Code not displaying in Simulator. please help!

Hello,

  today is my first day using Corona, well coding in general. I have decided to get into game coding as a hobby. after a week or so doing research I choose Corona as my starting point. Today i downloaded the SDK and attempted to start working, however I immediately ran into an issue. I attempted to write the line of code that i will list below in sublime 3 and notepad++

local background = display.newImage(“bg.png”);

This was my attempt at loading a simple background that i had created in paint and saved into the project folder. when I ran the simulator the display remained black. I turn to you guys after hours of trying different codes. i have attempted everything from display.newText to display.newRect all failing to have the simulator load an object. I am running this on an old windows 7 laptop and will be be testing it on a different pc asap. Also I have confirmed that the simulator is working, as i am able to get print commands to function. If there is any feedback that you can provide please do!

  1. Is bg.png in the same folder as main.lua?  It must be (based on your code).

  2. Is it spelled bg.png including the case of the letters?  Cases must match.

  3. How big is this image?  What is the resolution?

  4. What error and/or warning messages are you getting in the console?

Note: Corona should work fine on a laptop running Win 7.

If you do not encounter any error messages, then your issue could lie in your “config.lua” file or perhaps you didn’t give the newImage, newText or newRect the correct coordinates.

I would recommend starting Corona SDK, then creating a blank new project. Then you will have all the necessary files in your project folder. Then simply insert the following single line of code:
 

local object = display.newRect(display.contentCenterX,display.contentCenterY,100,100)

That should give you a single white rectangle in the middle of your screen. If that works, try that code in your old project file. If it doesn’t work there, then most likely your config.lua is missing or has some errors in it.

If you do receive some error message when attempting to create those display objects, then you might simply be inserting the wrong values, or as roaminggamer pointed out, you may have misspelled the image’s file name or path as they are case sensitive.

This feels like it might be a driver error. If you can’t get a simple display.newRect() to display and you’re getting no errors in your console log, but print statements are showing up, then that seems very abnormal. We flag many display driver issues, but there could always be a quirky driver bug that makes us believe we are working.

I would look to see if there are any updated drivers for your graphics card.

Rob

  1. Is bg.png in the same folder as main.lua?  It must be (based on your code).

  2. Is it spelled bg.png including the case of the letters?  Cases must match.

  3. How big is this image?  What is the resolution?

  4. What error and/or warning messages are you getting in the console?

Note: Corona should work fine on a laptop running Win 7.

If you do not encounter any error messages, then your issue could lie in your “config.lua” file or perhaps you didn’t give the newImage, newText or newRect the correct coordinates.

I would recommend starting Corona SDK, then creating a blank new project. Then you will have all the necessary files in your project folder. Then simply insert the following single line of code:
 

local object = display.newRect(display.contentCenterX,display.contentCenterY,100,100)

That should give you a single white rectangle in the middle of your screen. If that works, try that code in your old project file. If it doesn’t work there, then most likely your config.lua is missing or has some errors in it.

If you do receive some error message when attempting to create those display objects, then you might simply be inserting the wrong values, or as roaminggamer pointed out, you may have misspelled the image’s file name or path as they are case sensitive.

This feels like it might be a driver error. If you can’t get a simple display.newRect() to display and you’re getting no errors in your console log, but print statements are showing up, then that seems very abnormal. We flag many display driver issues, but there could always be a quirky driver bug that makes us believe we are working.

I would look to see if there are any updated drivers for your graphics card.

Rob