Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]

Code not displaying in Simulator. please help!
Started by Dan85hr Jul 29 2018 01:13 PM

3 replies to this topic
simulator display new first time code problem
This topic has been archived. This means that you cannot reply to this topic.
[TOPIC: post.html]


[GLOBAL: userInfoPane.html]
  • Observer

  • 1 posts
  • Corona SDK



  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!

[TOPIC: post.html]


[GLOBAL: userInfoPane.html]
  • Corona Geek

  • 7,587 posts
  • Corona SDK

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.

[TOPIC: post.html]

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 839 posts
  • Corona SDK

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.

[TOPIC: post.html]

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,922 posts
  • Enterprise

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.