Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

just starting
Started by jstrahan Oct 14 2010 10:56 AM

- - - - -
20 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

jstrahan

[GLOBAL: userInfoPane.html]
jstrahan
  • Corona Geek

  • 1,926 posts
  • Corona SDK

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
uid: 7911 topic_id: 2682 reply_id: 302682


[TOPIC: post.html]
#2

jonbeebe

[GLOBAL: userInfoPane.html]
jonbeebe
  • Contributor

  • 511 posts
  • Corona SDK

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.
uid: 7849 topic_id: 2682 reply_id: 7859


[TOPIC: post.html]
#3

jonbeebe

[GLOBAL: userInfoPane.html]
jonbeebe
  • Contributor

  • 511 posts
  • Corona SDK

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).
uid: 7849 topic_id: 2682 reply_id: 7860


[TOPIC: post.html]
#4

carlos m. icaza

[GLOBAL: userInfoPane.html]
carlos m. icaza
  • Corona Geek

  • 2,992 posts
  • Alumni

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

Carlos
uid: 24 topic_id: 2682 reply_id: 7861


[TOPIC: post.html]
#5

jstrahan

[GLOBAL: userInfoPane.html]
jstrahan
  • Corona Geek

  • 1,926 posts
  • Corona SDK

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
uid: 7911 topic_id: 2682 reply_id: 7862


[TOPIC: post.html]
#6

jonbeebe

[GLOBAL: userInfoPane.html]
jonbeebe
  • Contributor

  • 511 posts
  • Corona SDK

@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).
uid: 7849 topic_id: 2682 reply_id: 7865


[TOPIC: post.html]
#7

jstrahan

[GLOBAL: userInfoPane.html]
jstrahan
  • Corona Geek

  • 1,926 posts
  • Corona SDK

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
?????????
uid: 7911 topic_id: 2682 reply_id: 7866


[TOPIC: post.html]
#8

jonbeebe

[GLOBAL: userInfoPane.html]
jonbeebe
  • Contributor

  • 511 posts
  • Corona SDK

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).
uid: 7849 topic_id: 2682 reply_id: 7869


[TOPIC: post.html]
#9

jstrahan

[GLOBAL: userInfoPane.html]
jstrahan
  • Corona Geek

  • 1,926 posts
  • Corona SDK

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
uid: 7911 topic_id: 2682 reply_id: 7875


[TOPIC: post.html]
#10

jonbeebe

[GLOBAL: userInfoPane.html]
jonbeebe
  • Contributor

  • 511 posts
  • Corona SDK

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.
uid: 7849 topic_id: 2682 reply_id: 7876


[TOPIC: post.html]
#11

jstrahan

[GLOBAL: userInfoPane.html]
jstrahan
  • Corona Geek

  • 1,926 posts
  • Corona SDK

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
uid: 7911 topic_id: 2682 reply_id: 7879


[TOPIC: post.html]
#12

jonbeebe

[GLOBAL: userInfoPane.html]
jonbeebe
  • Contributor

  • 511 posts
  • Corona SDK

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.
uid: 7849 topic_id: 2682 reply_id: 7880


[TOPIC: post.html]
#13

jstrahan

[GLOBAL: userInfoPane.html]
jstrahan
  • Corona Geek

  • 1,926 posts
  • Corona SDK

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
uid: 7911 topic_id: 2682 reply_id: 7882


[TOPIC: post.html]
#14

jonbeebe

[GLOBAL: userInfoPane.html]
jonbeebe
  • Contributor

  • 511 posts
  • Corona SDK

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.
uid: 7849 topic_id: 2682 reply_id: 7884


[TOPIC: post.html]
#15

jonbeebe

[GLOBAL: userInfoPane.html]
jonbeebe
  • Contributor

  • 511 posts
  • Corona SDK

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.
uid: 7849 topic_id: 2682 reply_id: 7885


[TOPIC: post.html]
#16

jstrahan

[GLOBAL: userInfoPane.html]
jstrahan
  • Corona Geek

  • 1,926 posts
  • Corona SDK

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
uid: 7911 topic_id: 2682 reply_id: 7887


[TOPIC: post.html]
#17

jonbeebe

[GLOBAL: userInfoPane.html]
jonbeebe
  • Contributor

  • 511 posts
  • Corona SDK

@jstrahan: Glad you got it working :-)
uid: 7849 topic_id: 2682 reply_id: 7892


[TOPIC: post.html]
#18

jstrahan

[GLOBAL: userInfoPane.html]
jstrahan
  • Corona Geek

  • 1,926 posts
  • Corona SDK

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
uid: 7911 topic_id: 2682 reply_id: 7897


[TOPIC: post.html]
#19

jstrahan

[GLOBAL: userInfoPane.html]
jstrahan
  • Corona Geek

  • 1,926 posts
  • Corona SDK

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
uid: 7911 topic_id: 2682 reply_id: 7902


[TOPIC: post.html]
#20

jstrahan

[GLOBAL: userInfoPane.html]
jstrahan
  • Corona Geek

  • 1,926 posts
  • Corona SDK

never mind i got it
uid: 7911 topic_id: 2682 reply_id: 7906


[TOPIC: post.html]
#21

carlos m. icaza

[GLOBAL: userInfoPane.html]
carlos m. icaza
  • Corona Geek

  • 2,992 posts
  • Alumni

w00t

me
uid: 24 topic_id: 2682 reply_id: 7910



[topic_controls]
[/topic_controls]