Star explorer- changing graphics

Hi,

I completed the Star Explorer app and it was great!

I am trying to replace the images. all PNG files. A cat shooting lasers to water droplets.

I have changed the background to white and the text to black. This works on the menu.lua.

Problem 1: THe text changing to black does not work on the high scores nor the game.lua scenes.

Problem 2:  the cat image does not come up. I have put the image in the folder, and have a gameObject with the cat on there.

Problem 3: The laser does not work 

I havent really changed the code but change the images, background image from black to white and the text colour white to black. Why do they not work??

Hi Sandy and welcome to the Community forums.

Are there any errors in your console log? Corona automatically opens a log window that errors, warnings and messages you choose to print() show up.

Next we are going to need to see code.  You can copy/paste the code into your post, but before you paste it in, click the blue <> button in the row of buttons with Bold, Italic, etc. and paste the code into the popup window. 

So for #1, show us the code where you’re creating the text and trying to change the color.

For #2, show us the code where you’re trying to create and position the cat.

For #3, you will need to provide a better description as to how the laser is not working. Is it not firing at all? (Could be related to #2) Is it firing, but not hitting anything?  Details are important.

Thanks

Rob

The reason the sprites don’t work is probably because of the section where you added the old sprites: asteroids, laser, etc. had a table with different sizes of your sprites, I recommend you zip up the code, and add it to your reply via the ‘More Reply Options’ button.

Hi @sandy.bansal,

As Rob says, we at least need to see any error/warning messages output in the Corona Console. That will likely identify the issue immediately.

Take care,

Brent

Thanks for the tips.

Instead of posting snippets of the code, is there anywhere I can upload the files?

github?

ok- im good at almost everything - but not all! I need instructions please!! :slight_smile:

You can upload to DropBox, Google Drive, etc. and post a URL here.

Rob

https://github.com/

just click on sign up - fill out the info and select public repositories (it’ll be free)

Once you have your account created, youll then want to create a new project (there should be steps to follow when you first create your account, but if not then let me know and ill give you more details)

Once you create a new project, just select the buttons to upload all your files, and then you can share that will us and we can download it and try it on our machines (there is ALOT more functionality possible with github but for basic use it works aswell).

For ex, my project im working on right now -> https://github.com/BOCreations/ChristadelphianHymnBook 

Let me know if you need anymore info, github is really well set up, so everything should be relatively intuitive to set up.

EDIT - if link wont work on click, try copying and pasting it into browser, its being weird for me

Thank you Rob.

https://drive.google.com/drive/folders/0B3jynNEHN3gTd1Y4aTR5VVRuSlk?usp=sharing

Thank you.

I created the account- but how do I upload the files?

The link you sent as an example goes to a 404 page.

Here is the link to on my Google drive.

Sandyx

https://drive.google.com/drive/folders/0B3jynNEHN3gTd1Y4aTR5VVRuSlk?usp=sharing

Lets talk about your cat. It appears you’re trying to read it from an image sheet but you’re trying to get the 4th image in the image sheet. This message should show in your console log window:

WARNING: Supplied frameIndex(4) exceeds image sheet’s maximum frameIndex (3). Value will be clamped.

You expect your cat to be in that image sheet as the 4th item.  However when you define the image sheet:

local sheetOptions = { frames = { { -- 1) waterdrop x = 0, y = 0, width = 102, height = 85 }, { -- 2) lasercat x = 0, y = 265, width = 98, height = 79 }, { -- 5) halo-laser x = 98, y = 265, width = 14, height = 40 }, }, } local objectSheet = graphics.newImageSheet( "gameObjects1.png", sheetOptions )

You only define 3 frames in the imageSheet. Also if you look at your graphic, you have the water drop, the laser and an empty space in the 2nd position.

We could have solved this issue with just providing this information.

Your laser isn’t firing because it requires a tap handler on the cat. You can’t create the cat because of the above error.

Now for the text, I don’t see where you ever try and set the text color for the display objects created in the game scene. Color setting is on a per-object basis and your objects in menu are different than your objects in game.  Try this:

 -- Display lives and score livesText = display.newText( uiGroup, "Lives: " .. lives, 200, 80, native.systemFont, 36 ) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;livesText:setFillColor(0, 0, 0) --\<----- add this scoreText = display.newText( uiGroup, "Score: " .. score, 400, 80, native.systemFont, 36 ) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scoreText:setFillColor(0, 0, 0) --\<----- add this

Hope this helps you understand what’s going on.

Rob

since you got your google drive sharing working, you dont need the github to work, unless you want it in which case I will continue to explain how to set it up.

Also see my edit about the link given a 404

I do feel so so stupid!

Got the text black on both the game and the high scores. ( not the actual scores- cant see it where to do it)

I have a laser or a thick red line. Just when I thought I got it,   :(  :frowning:

is it my gameObject.png file?

Look for display.newText() in the module where the text isn’t showing and put a similar setFillColor() call just after you create the text object.

In your project you have both the red laser as a separate graphic and as part of the gameObject.png file. I didn’t closely look at your code, but I’m pretty sure you’re using the one from the image sheet.

Rob

I really appreciate what you guys are doing.

I thought I was good but I am absolutely crap!! :wacko:

I need help!!

I sorted the images. I get the water drops plus the cat attached to the water droplet.

I can not see the laser.

When the scene goes to the high scores, there is an odd fading out and then the scores are not black ink either.

Can someone please please please please help me? :smiley:

I just copied the code from the STAR Explorer. Just wanted to change the background (black to white), Change the ship to a cat, change the asteroids to water droplets and finally all the writing to black! :slight_smile:

Here is the link https://drive.google.com/drive/folders/0B3jynNEHN3gTZ3BUbWVDRUFSbU0?usp=sharing

I don’t understand, why are there two water droplets, two lasers, and two cats?

Also, you need to figure this out for yourself, we are here to help, not to work for you. If you don’t work it out, you will not learn.

Your problem is the images, you are not changing the size of the images appropriately.

I will give you some tutorials to help you out:

https://docs.coronalabs.com/guide/media/displayObjects/index.html

https://docs.coronalabs.com/guide/events/detectEvents/index.html

Trust me, most of us will not look at your entire project. (at least I won’t) please just post segments of your code, not entire files. 

To make the high scores black you forgot to change the color of the ‘thisScore’ variable. 

local thisScore = display.newText( sceneGroup, scoresTable[i], display.contentCenterX-30, yPos, native.systemFont, 36 ) thisScore:setFillColor(0,0,0) thisScore.anchorX = 0

thanks!!

I don’t have 2 of anything. Its a replica of the star explorer coding.