2
votes

My situation in a nutshell : http://i.imgur.com/wUpMgX5.jpg

This is my main.lua file: http://pastebin.com/1t2rhim1

Anything in main( ) starting in ---PLAYER--- does not show up when I try to play the .apk game on my Samsung Galaxy Note II. Everything is fine as I intended when I simulate it on the computer.

My game is basically a title screen, where I press on a word and then it jumps to displaying a background and draws out a D-Pad, 3 buttons, and 2 characters with their HP/MP bars, whereby it becomes a fighting game. However, only the background appears.

I've tried disabling the background, but the other images just do not appear.

I don't know if its because my Corona SDK is not the pro version, so there's a limit to how much I can draw, or,

There's issues based on the screen resolution, however I have been coding this game with a Galaxy SIII or Note II resolution in mind (1280 x 800), so the characters shouldn't be appearing off screen or anything.

--

And if that works, I don't understand how to have an infinitely updating loop. I am semi-familiar with Java, a bit less so with Python, and totally new to Lua. I want to modularize my code more as well.

How do I loop? I want to get an AI working, but currently that code is only run once. I tried putting a while-true-then loop at the end of my main function, but it crashed my simulator.

5
I have the same problem. Have you fixed it? can you please update your code or kindly add the solution as your own answerQadir Hussain
The culprit most of the time is naming your files in mixed case or having any uppercase in them. Just avoid uppercase at all. Even something like someBall.png might mess it up. As well, I have a subfolder called /images and I would refer to my sprite/image files as something like "/images/ball.png" but I tried taking all the first slashes out to "images/ball.png". I don't think this solved it but after a whole bunch of fixes it worked. The best way to go is to keep testing on your phone to make sure your simulator and phone are doing the same thing.Gary

5 Answers

1
votes

Not sure why your sprites wouldn't be showing, but not having the Pro version is NOT the problem. The free Starter Edition of Corona SDK can do everything the Pro version can do except in-app purchases.

I don't see anything wrong at first glance in your code, but did notice the files that load, like the background image, are stored in the root of your project, at the same level as main.lu -- while the sprites that don't load are down in subdirectories. First thing I'd do is check the names of those folders - are the folders Dennis and David actually capitalized the way you have it in you source? The simulator won't care, but the device will.

As far as the infinite loop goes, you can create a Runtime listener that can call a function every frame, like this:

Runtime:addEventListener("enterFrame", myUpdateFunc)

That myUpdateFunc function will be called 30 or 60 times per second, depending on how you have things set up in your config.lua file.

[EDIT: Looking again at how you're calling for the sprites, do you really mean to have the slash in front of Dennis, etc? Even if the case is correct, I'm not sure you mean what you're saying in that code. :)]

0
votes

Android and IOS are based off linux that means its case sensitive. Its a common problem that people don't care about the case when creating display object or playing files or just loading story board scenes. It means that the game will run fine on a windows system but it won't run properly in linux. Try checking the files you are referring in the code matches the file names in the project folder (check the case of the file name). Hope that would fix your problem.

0
votes

Make sure you you are not running into the typical problem of file name case sensitivity. The simulator ignores the case of the letters that make up the filenames, where the device is sensitive. This is easy to over look and miss. Check all filenames, not just images. Check your audio, your .lua files etc.

Also make sure to tether your device to your computer via the USB cord and use the "adb logcat" command and make sure you're not getting any errors on device.

0
votes

There are only 3 reasons for that:
1. file name case sensitivity
2. Texture memory is not supported for your device.
3. There is some error in the code.

All these can be checked by putting print statement and connecting your device to computer and see logs by using "adb logcat" command.

0
votes

Its because you created the background first. Move it to under the buttons and images and it should work.