By Developers, For Developers

Historical errata for Create Mobile Games with Corona

PDF PgPaper PgTypeDescriptionFixed onComments
34TYPO

Double “want” on the second line, “Configuring the Framerate” par.:

“with each tick of Corona’s
clock, but we might want want more”

2013-06-21
42ERROR

The text references spriteAtlas.lua and myImageSheet.png, but neither of these files appear present in the code download package.

2013-06-21
18TYPO

print(“message”) will not automatically open the terminal in mac. From corona website looks like, you have to open “corona terminal” explicitly. opening “corona terminal” opens a new simulator and you should run your program through this simulator. then the message gets printed to this “corona terminal”

2013-06-21
39TYPO

Hi, in code folder there is no myImageSheet.png file

2013-06-21
38TYPO

or a big fracton of them

should be fraction

2013-06-21
57ERROR

the file “gamesprite.lua” which is used sequentially for the chapters, has behind the scenes modifications that prevent the examples from working if you start from the beginning. Namely, gamesprite.lua lines 12,13 add the created object to the spriteInstance variable, which allows the tapped event handler to function properly. I could not find any indication that any changes were made in the text.

Additional changes were present that caused a runtime exception as well:\t> display.remove( self.spriteInstance )
was removed in the InputAndMenus folder of the code from gamesprite.lua/removeSprite()

I would not expect to have to fix gamesprite.lua once it’s been written in the previous chapter.

2013-06-21
32ERROR

The book says to add the event listener in createScene() but it does not run if placed here. The code shows it in enterScene() and this works.

2013-09-03
35TYPO

the text says the default framerate is 60 but mine was 30. OSX 10.8.4

2013-09-03
35TYPO

the text mentions setting fps in config.lua but the code sample is for build.settings

2013-09-03
19SUGGEST

Would it be confusing to the target audience to point out that you can omit the parens from the call to print()?

2013-09-03
58ERROR

Why is this function called toggleDelete()? It should be named something like shouldDelete()

function Spaceship:shouldDelete()
— for now, dead ships should be deleted
— later there will be other reasons to delete a ship
return (not self.isAlive)
end

2013-09-03
59ERROR

Again with the toggleDelete() (sorry!)

Notice the mismatch here:

if (ships[i]:toggleDelete() == true) then
ships[i]:removeMe()

So, is it “delete” or “remove”?

And why are you comparing booleans to true?

2013-09-03
153ERROR

I eventually realized that DELETE_OOB was “out of bounds”; however I don’t see where this new version of toggleDelete() is used, or where those constants are defined.

My personal style is to not use elseif when the previous statement ends with a return. That is, if there’s no difference between elseif and just if, use if.

2013-09-03
158SUGGEST

I may have reported some of the page numbers incorrectly in my prior errata … I was using the printed page number (e.g., 153) rather than the actual page (e.g. 158 of 242).

2013-09-03
63SUGGEST

I think you could use more explanation/justification for the Storyboard API. It’s very useful as a way of organizing your game, as in “you don’t want enemy spaceships attacking your high scores (unless you really want that)” kind of thing.

2013-09-03
3TYPO

The third sentence after 1.1 A Word on Game Development begins with “It’s means”. Should be “It means”.

2014-01-08
41SUGGEST

Please don’t print the book like it is in B6.0 version. It still needs a lot of editorial work. Problems are mostly small, but there are many of them. It would be quite a substantial work to list them all, I don’t have time for that right now.

2014-01-08
31ERROR

When adding the background images for the Planet Defender game in chapters 2-3, it appears that the image is centered on the top left corner instead of center in the middle of the simulator.

The original code was:

local image = display.newImage( “images/space_background.jpg” )

The modified code is:

local image = display.newImage( “images/space_background.jpg”, 160, 240)

I believe this also occurs when the menu and game over scenes are added later in chapter 3.

2014-01-08
64TYPO

The text here indicates that 180 is three times the game’s frame rate, but since we changed it in the last chapter to 30 fps, three times that is 90 (not 180). The code on the same page is correct, since it uses 90.

2014-01-08
69TYPO

The page cites auxiliary.lua as the source of the removeTableRows function, but that file doesn’t exist. It is actually in arrayfuncs.lua.

2014-01-08
11ERROR

In the HelloCorona/main.lua code sample, setFillColor no longer uses values of 0 - 255, but now uses values from 0 - 1. If you change the line to:

rect:setFillColor( math.random(), math.random(), math.random() )

it will now properly generates random colors for the rectangles.

2014-01-08
2411ERROR

The mistake is in the main.lua code. setFillColor takes the rgb values from 0 to 1, not 0 to 255. So the correct call to this method should be something like:
newRectangle:setFillColor( math.random(255)/255, math.random(255)/255,
math.random(255)/255) otherwise all rectangles would be a kind of light grey (same color).
Please refer to the stack overflow question for details (which I took as a reference):
stackoverflow.com/questions/20085602/corona-sdk-setfillcolor-not-coloring-when-mix-colors
I hope it helps, cheers.

2014-01-08
43ERROR

Background image space_background.jpg displays in top left corner in Corona Simulator

Maybe the code in this page should be something like the following, in order to center the image:

local image = display.newImage( “images/space_background.jpg” )
image.x = display.contentWidth/2
image.y = display.contentHeight/2
group:insert( image )

please refer to stackoverflow.com/questions/20415463/image-displays-in-top-left-corner-in-corona-simulator

I hope it helps, cheers.

2014-01-08
56SUGGEST

This regards to the code available for download in sdcorona-code.tgz and sdcorona-code.zip. Many examples in the subdirectory ./code/SpritesExamples make the following method call mySprite:setReferencePoint( display.CenterReferencePoint ). In newer versions of the Corona simulator this leads to an error - I’m using Version 2013.2100 (2013.12.7).
‘setReferencePoint’ is deprecated in favor of anchorX and anchorY. Please refer to docs.coronalabs.com/api/type/DisplayObject/setReferencePoint.html.

2014-01-08
55SUGGEST

The hip > PLANET_RADIUS_SQ has been added in the spaceship update method before it is explained. The if test should not be in the middle version.

56SUGGEST

Where the local ships {} is added it may not be clear to a beginner that this should be with the rest of the locals. Conceptually it should be done in one of the events.

62TYPO

call removeMe() half way down ; it wasn’t written in the previous chapter, it was written immediately above the text.

61ERROR

The two planet radius tests are > and <. There is a small probability that the hip value might be equal to PLANET_RADIUS in which case it will neither advance nor be killed. Probably doesn’t matter but good practice.

62ERROR

When the ship is removed the event listener still exists, so the object will not be garbage collected.

64SUGGEST

“Corona’s template creation feature” - I can’t find it ? I copied one from the SDK. It might be better to copy the template to create game.lua rather than changing scenetemplate.lua itself.

65SUGGEST

A novice may think the eventListener should be added after the group=self.view line ?

68ERROR

When the lives variable is created it is done so as a global. It would be best and consistent for local lives to be declared at the module level.

69ERROR

wasKilled is compared against false, but earlier it was set to nil. In lua false ~= nil.

61TYPO

in tappedShip() event.target.object.wasKilled needs to be set to true, otherwise the game cannot distinguish between those ships ended by touching and those ended by landing.

62SUGGEST

toggleDelete is a bad choice of method name because it doesn’t do what it says it does. It would be better called ‘isShipDead’ for example.

72TYPO

Player sprites have changed - would be a good idea to have the same sprites files throughout. Life spacing is too small. Position is partly off the top. Group may be hidden behind the background image, requires a toFront call on the group.

34SUGGEST

Whilst the text does state that there needs to be a RemoveEventListener, otherwise tick will be called even when the scene has changed which could be fun … it never actually does this.

45TYPO

Should EnterFrame be changed to EnterScene? I guess the function name and the text name should be the same?

18SUGGEST

Corona updated the Storyboard API to Composer. In time they will phase out storyboard and/or possibly offer more features with Composer. Right now, it seems they have simplified some things with the new API and suggests developers to move forward with Composer.

27SUGGEST

When setting up classes, you explain the need for the ‘class.lua’ file but you don’t include it in the source as a require statement.

It is noted in Page 24 that you need to use the ‘require()’ function to include other Lua files to run their code but then this isn’t reiterated when setting up classes or included in the code snippet.

As a programmer taught using Object Oriented principles, it was confusing that such an important statement wasn’t made and that seemingly the only mention of the ‘require(“class”)’ line of code is in the ‘main.lua’ file from the downloadable source code.

Categories: