lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


or making three large tables

On Fri, Apr 6, 2012 at 1:58 PM, kingsley young <kingsleyyoung27@gmail.com> wrote:
I learn or knida learn about this in love2d.org and c# xna tutorials  but i'm not sure if corona sdk actually use this type of format in making their games because my game runs fine with out any updater the only thing remotely close to that in corona that i can think of is making groups and timers but i could be totally off with that one seeing that I am only a beginner at lua and programing  

On Fri, Apr 6, 2012 at 2:11 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> and when I used loops it would freeze the screen instead of
> slowing down
>
> oh i'm building this in the corona sdk
>

I don't know that one, but let's try …

Basically your game engine should have a main loop something
like this:

   update(dt)
   draw(...)  -- sets up the new screen but does not show it yet
   eventhandler(...)  -- check keyboard, mouse, joystick etc
   render()  -- finally show the screen

"update" gets told how much time has elapsed since the last
time it was called.  It's in here that you can put code like:

  delay=delay+dt
  if delay > too_long then pass=false; delay=0
  else pass=true
  end

Then in "draw" you skip everything if "pass" is on.

In "eventhandler" you check for slowdown and set "too_long"
to something positive, or set "too_long" back to if the slowdown
is cancelled.