Creating A Guide For An Already Existing Game

Hello, I want to create a guide for a game. This guide would only consist of menus, graphics, text etc. I started with Corona a few hours ago. I have a few questions:

  1. Is Corona the best way to go for me? I read that Corona is simple and easy to learn but has its cons. As my guide-app would be extremely simple (requires no physics etc.), I thought Corona was suiting

  2. I worked through the first beginning tutorials, but I’m not interest in making games at all. Are there specific tutoruials on how to make a “good menu”? My guide would be like that:

a) Main Menu: the buttons of each category (enemies, biomes etc.)

b) Optionally, in each category there can be sub-categories (further buttons)

c) Text and images shall be visible and well placed within the app

What I also need is

  • scrolling (if text is too long to display)

  • maybe “arrows” (<— , —>) to move to the next “page”

  • using images and placing them properly

What I already “know”

  • how to configure build.settings and config.lua (very limited knowledge, first tutorials)

  • how to work with images (very limited knowledge, first tutorials)

  • how to add text (very limited knowledge, first tutorials)

  • how to make a “tab” (extremely limited knowledge, skipped through a youtube video)

I’ve already skipped through a few videos, but I wanted to ask you for proper help first, so I don’t waste time in making my app

  1. Are there open source projects that I could use (as templates) to create my app? If so, I’d prefer for Corona, as it seem to be easy. If I need to use Java, Javascript, etc., it wouldn’t be too much of a problem either, because I’m probably going to (attempt to) learn these languaes sooner or later anyway

  2. Is there anything I need to be aware of to make my app working on both Android and iOS?

If you need further information/details, let me know. Thank you!

  1.  I think the answer to this is Yes.

  2. No, there really aren’t specific tutorials for making a ‘good menu’ since interface ‘goodness’ is subjective.  

  • There are plenty of examples (see the ones that come with Corona SDK).  (See video below re: Finding example code that comes with Corona.)
  • You can also search gitHub and other public repositories for Corona code and samples.
  1. Similar answer to #2 - See examples, gitHub, etc.

  2. No.  Your app will just work on all supported targets with minimal set up in build.settings

https://www.youtube.com/watch?v=MWHUul9NTEI

I think the best thing to do here is to begin mastering what your knowledge is limited in. You don’t have to worry too much about config.lua and build.settings (for now). But I’d say you need to master (or at least learn more about) text and image placement and learning about things such as anchors and opacity (which is not complicated). You’ll also need to learn about composer. The Corona API Documentation, holds all of this and more, here are a few guides to get you started. 

https://docs.coronalabs.com/api/type/DisplayObject/anchorX.html

https://docs.coronalabs.com/api/type/DisplayObject/anchorY.html

https://docs.coronalabs.com/api/library/composer/index.html

https://docs.coronalabs.com/api/library/display/newText.html

https://docs.coronalabs.com/api/library/display/newImageRect.html

Thanks, I’ll take a look and report if I need further help.

I’m back with a question. I read that I shouldn’t use global variables, as they can be “dangerous” and are slower (performance-wise) than local variables. How do I make/use constants in Corona?

You can use globals, but should avoid using them for everything.

Most variables should be local

local bob = 10

However, occasionally, it is nice or easiest to make a variable global so it is visible in all scopes:

\_G.fullw = display.actualContentWidth -- Now, anywhere in the game/code you can get the full width of the screen as: print( fullw )

Okay, actually I wanted to use my globals so I could change the font size/colour and similar stuff on one place. This reminds me on something else. Is there a list of variable-names that I must not use?

Sorry, there is not a list of reserved words for Lua + Corona SDK, but you can discover all current globals a
 
Put this at the top of main.lua to see all global names at the moment the code runs:

for k,v in pairs( \_G ) do print("Global name:" .. tostring(k) .. " value: " .. tostring(v) ) end

Lua Reserved Words are:

and break do else elseif end false for function if in local nil not or repeat return then true until while

Corona is a little harder to work out, but as you get more experienced you’ll just know.

It’s still better to make your own data module and store your “globals” there. Then all you do is require that module in each of your modules.

Please read: https://docs.coronalabs.com/tutorial/basics/globals/index.html if you haven’t already.

If you do choose to use globals, please make sure you prefix them with _G. so that you know you’re using a global and secondly name your variables in a way that you know it’s yours. This is called namespacing. Modifying @roaminggamer’s suggestion above:

I would change:

\_G.fullw = display.actualContentWidth

to

\_G.myFullw = display.actualContentWidth

As far as I know fullw is safe, but you can never be sure.

Rob

Okay, I made a new “globals” module and requested it in each file. My new questions

  1. When I use text that can’t be modified/clicked, does it matter if I fill it with setFillColor or setTextColor?
  2. Should I rather use letterbox, zoomEven or other scaling?

I’m extremely confused about resolution, scaling and all that stuff - whether my images and text will be displayed the way I want or not (they won’t). I use the default 320 width and 480 height in my config file. To be honest, I don’t even understand what that really means. I’ve read through a few forum posts, documents and sample code but didn’t understand much as of now.

Generally constants are defined like this: THIS_IS_THE_SCREEN_WIDTH = 480

If your app is portrait then use letterbox scaling, if it is landscape the use zoomEven. 

This explains the difference between letterBox and zoomEven:

https://docs.coronalabs.com/guide/basics/configSettings/#scale

Let’s say it like that. What’s the recommended value for width and height in the config file? I use the “default” 320, 480. What’s the recommended width and height so I can display as much text/information to my guide?

The other issue I have is that I need a good example of an interface that works on any device. All I can take from the documentation is that you have different ways to use scaling and that you can have dynamic image selection by using imageSuffix. Is that it? Is there really nothing else that has to be done?

  1.  I think the answer to this is Yes.

  2. No, there really aren’t specific tutorials for making a ‘good menu’ since interface ‘goodness’ is subjective.  

  • There are plenty of examples (see the ones that come with Corona SDK).  (See video below re: Finding example code that comes with Corona.)
  • You can also search gitHub and other public repositories for Corona code and samples.
  1. Similar answer to #2 - See examples, gitHub, etc.

  2. No.  Your app will just work on all supported targets with minimal set up in build.settings

https://www.youtube.com/watch?v=MWHUul9NTEI

I think the best thing to do here is to begin mastering what your knowledge is limited in. You don’t have to worry too much about config.lua and build.settings (for now). But I’d say you need to master (or at least learn more about) text and image placement and learning about things such as anchors and opacity (which is not complicated). You’ll also need to learn about composer. The Corona API Documentation, holds all of this and more, here are a few guides to get you started. 

https://docs.coronalabs.com/api/type/DisplayObject/anchorX.html

https://docs.coronalabs.com/api/type/DisplayObject/anchorY.html

https://docs.coronalabs.com/api/library/composer/index.html

https://docs.coronalabs.com/api/library/display/newText.html

https://docs.coronalabs.com/api/library/display/newImageRect.html

Thanks, I’ll take a look and report if I need further help.

I’m back with a question. I read that I shouldn’t use global variables, as they can be “dangerous” and are slower (performance-wise) than local variables. How do I make/use constants in Corona?

You can use globals, but should avoid using them for everything.

Most variables should be local

local bob = 10

However, occasionally, it is nice or easiest to make a variable global so it is visible in all scopes:

\_G.fullw = display.actualContentWidth -- Now, anywhere in the game/code you can get the full width of the screen as: print( fullw )

Okay, actually I wanted to use my globals so I could change the font size/colour and similar stuff on one place. This reminds me on something else. Is there a list of variable-names that I must not use?

Sorry, there is not a list of reserved words for Lua + Corona SDK, but you can discover all current globals a
 
Put this at the top of main.lua to see all global names at the moment the code runs:

for k,v in pairs( \_G ) do print("Global name:" .. tostring(k) .. " value: " .. tostring(v) ) end

Lua Reserved Words are:

and break do else elseif end false for function if in local nil not or repeat return then true until while

Corona is a little harder to work out, but as you get more experienced you’ll just know.