How to dynamically choose external lua module

Hi Ed,

My bad :slight_smile: !

Debug mode fooled me :frowning:

You are right!

So for future reference I just make @1x physics lua file, and Corona expands this to @2x and @4x?
I do not have to make @2x and @4x physics lua files?

Did I got this right? :slight_smile:

Many many thanks!
Ivan

So for future reference I just make @1x physics lua file, and Corona expands this to @2x and @4x?
I do not have to make @2x and @4x physics lua files?

No, that’s not what I meant.  

  1. You’re using a tool to generate these files right?

  2. That tool generates 2X and 4X lua files?

  3. If 1 and 2 are yes, just:

  • let the tool generate the files,
  • include them in your project as you have been
  • code as if you’re only dealing with the 1x files.  i.e. Let Corona worry about selecting the right images from those you provided (from the tool).  Don’t worry if the @2x, @4x, etc Lua files are not used.

The only thing you care about here is getting the right:

  • graphic selected for the right resolution (I verified this is working).
  • physics body to wrap that shape (again I verified this).

Question: What triggered this whole conversation?  i.e. What made you think this wasn’t working the the first place?  Was it the use of ‘debug’ instead of ‘hybrid’ draw modes?

Also, remember my tip about modifying the 1/2/4 X images (during debug) so you can visually verify which one is being used.

I am using Texture packer and Physics editor (yes 1 and 2).

Whole conversation was triggered by use of debug mode, and the fact that Corona never used @2x and @4x lua files.

Thanks Ed! :slight_smile: