Jump to content




How to use coroutines for a game?


  • You cannot reply to this topic
2 replies to this topic

#1 __Kiwi

  • Members
  • 4 posts

Posted 04 May 2015 - 04:14 PM

Hello!

I'm working on my game. It have to render every 0.2 seconds and pull event as much as it can. How can I do this with Lua? I've read the tutorial on the lua.org and lua-users.org page but I cant't understand. :(

Can someone tell me how should I implement this?

(Sorry for my bad english.)

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 04 May 2015 - 04:35 PM

You don't need to use coroutines for this. Use one event handling loop to deal with user input and timer events to time your rendering. Check out the worm game that comes with ComputerCraft for an example.

#3 __Kiwi

  • Members
  • 4 posts

Posted 04 May 2015 - 05:29 PM

View PostLyqyd, on 04 May 2015 - 04:35 PM, said:

You don't need to use coroutines for this. Use one event handling loop to deal with user input and timer events to time your rendering. Check out the worm game that comes with ComputerCraft for an example.

Thank you for the fast reply. :D





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users