just starting

first problem
i make a folder
save a png-8 image in that folder
save a main.lua file in that folder with 1 line of code
local letterJ = display.newImage( “j.png” )

when i run it in simulator i get a blank screen [import]uid: 7911 topic_id: 2682 reply_id: 302682[/import]

Try running the Corona Terminal (it’s another icon in the Corona SDK folder), usually a blank screen in the simulator means that an error occurred and you can see what happened from the Terminal.

Do that and paste the terminal output here, could just be a simple syntax error. [import]uid: 7849 topic_id: 2682 reply_id: 7859[/import]

Oh wait, png-8?

I’ve had that problem as well… save as png-24 instead. Corona doesn’t like png-8.

I know png-24 outputs a higher file size, but there are tools that can compress it some (such as ImageOptim), but you’ll need to have only PngCrusher turned on to use ImageOptim (disable the other options such as AdvPng and others). [import]uid: 7849 topic_id: 2682 reply_id: 7860[/import]

Jon is correct. It needs to be png-24… or higher…

Carlos [import]uid: 24 topic_id: 2682 reply_id: 7861[/import]

Ok thanks I’ll try that but now when I try to .load my main.lua file it’s frayed out and won’t open [import]uid: 7911 topic_id: 2682 reply_id: 7862[/import]

@jstrahan: That’s strange, try closing and re-opening the app and trying to load main.lua again ( with your png-24 this time, of course). [import]uid: 7849 topic_id: 2682 reply_id: 7865[/import]

Tried restarting sim, resaving file, open file in two other text apps and resaving, moving file to desktop
If I right click on file I can’t open with sim
If I load sim I can’t load file
??? [import]uid: 7911 topic_id: 2682 reply_id: 7866[/import]

Oh, I know what the problem is.

The Corona simulator doesn’t load an individual main.lua file, instead, you have to create a directory and place the main.lua file within it (as well as your resources). Open the simulator, and open the DIRECTORY (folder) with your main.lua file in it and that should work.

I personally run everything with the Corona terminal so I can see if any errors happen (it’s extremely useful; essential, in my opinion). Applications -> Corona Game Edition -> Corona Terminal

I created an Automator app that opens the Corona Terminal so I can launch it from my Dock (I have A LOT of apps in my Applications folder). [import]uid: 7849 topic_id: 2682 reply_id: 7869[/import]

ok here we go

i have resaved my image as png-24 and png created a folder in the corona folder called lua test
inside the lua test folder i have main.lua and my image j.png-8, j2.png-24, j3.png
in the main.lua file still have the one line of code and i just changed the image file name in the
code to the png-24 then to the png file saved it went back to sim hit command r and nothing also
nothing in the terminal other then the login and file dir
then i try to goto the file menu of the sim to tryto reload main and its still grayed out [import]uid: 7911 topic_id: 2682 reply_id: 7875[/import]

Are your images named:

  • j.png-8
  • j2.png-24
  • j3.png

When I save PNG files in Photoshop, I have the PNG-24 option set, but my images are still just “.png”. That’s the only problem I can see off the top of my head.

It doesn’t sound like you have a whole lot to your program as of yet, so would you mind pasting your entire main.lua file here? Just wrap the code with: [blockcode] YOUR CODE HERE [/blockcode] so it’s easier to read.

That way I can better identify the problem. [import]uid: 7849 topic_id: 2682 reply_id: 7876[/import]

sorry for the delay internet went out for a bit

this is a direct copy and paste from the main.lua file

[blockcode]local letter_J = display.newImage ( “j2.png” )[/blockcode]

and the images are named png i just saved as
j1.png-8
j2.png-24
j3.png [import]uid: 7911 topic_id: 2682 reply_id: 7879[/import]

Try setting the coordinates of your object to the middle of the screen and let’s see what happens then:

letter_J.x = 160
letter_J.y = 240

Oh, also, Corona defaults the screen to black unless you draw a different color rectangle or place a background image there so if your PNG image is black then that could also be why it’s not showing up. [import]uid: 7849 topic_id: 2682 reply_id: 7880[/import]

it doesnt seem to be loading the main.lua file at all

i made a new main.lua file in a different folder in the corona folder with a different text editor

[blockcode]local bg1 = display.newRect( 0, 0, 320, 480 )
bg1:setFillColor ( 255, 255, 255 )
[/blockcode]

and it works

but if i change it to this
[blockcode]local bg1 = display.newRect( 0, 0, 320, 480 )
bg1:setFillColor ( 255, 0, 0 )
local letter_J = display.newImage ( “j2.png”, 160, 240 )
[/blockcode]
the display changes to red but the image will not show
j2.png was saved as a png-24 file from photoshop [import]uid: 7911 topic_id: 2682 reply_id: 7882[/import]

Here’s what I would do.

Grab a .png file from one of the included Corona samples and rename it to j2.png – backup and replace your old j2.png file.

Run the program again–if the image shows, then there’s a problem with your image. If it doesn’t show, try taking the underscore away from your variable name… I wouldn’t think that would make a difference, but I never have your problem and don’t use underscores in my variable names so that’s the only thing that stands out.

Let me know what happens when you switch the image out. [import]uid: 7849 topic_id: 2682 reply_id: 7884[/import]

If the sample image loads, and you’ve determined it’s a problem with your image file, then try this:

  1. Open the image in Photoshop

  2. Go to Image > Mode > RGB Color (if it was set to Index color, that could’ve been your problem)

  3. Save for Web & Devices as PNG-24 and try again. [import]uid: 7849 topic_id: 2682 reply_id: 7885[/import]

ok i got it i was in the middle of completly redoing my image from scratch when you posted so i finished it reloaded the file in the sim and it worked
not sure why just a resave to png-24 to a different dir and folder wouldnt work but i got it now thanks for all your help

@carlos
im trying my best to keep the twitter lang. to a min lol [import]uid: 7911 topic_id: 2682 reply_id: 7887[/import]

@jstrahan: Glad you got it working :slight_smile: [import]uid: 7849 topic_id: 2682 reply_id: 7892[/import]

thanks jonbeebe

i now have the image in center screen and rotating working on getting it to scale now from very small to normal size [import]uid: 7911 topic_id: 2682 reply_id: 7897[/import]

next
not a problem just a learning issue

[blockcode]local function animateJ( event )
local now = system.getTimer()
local elapsed = now - time
local rotationAngle = rotateAmount * (elapsed / 1000.0) * 100
local xsize = xsize + .2
local ysize = ysize + .2

time = now

letter_J.rotation = letter_J.rotation - rotationAngle
letter_J.xScale = xsize
letter_J.yScale = ysize

end
[/blockcode]
why wont my image scale
xsize and ysize start at 0.01 [import]uid: 7911 topic_id: 2682 reply_id: 7902[/import]

never mind i got it [import]uid: 7911 topic_id: 2682 reply_id: 7906[/import]