ymobe/rapanui

How to create ObjectPool, Pause & Resume Game, and Capture GroupLayer ?

phamquyhai opened this issue · 3 comments

With corona is easy !
with rapanui?

P/s:
groupLayer:saveImage("captureLayer.png")

and

sceneGame:pause()
sceneGame:resume()

if Moai and Rapanui there that I do not know, please show me?

Hi KaKaVip,

  1. Object Pool:
    We have no object pools in RapaNui, since for small games it is not needed because all images are cached and for complex games you may want to create your own optimized pool.
    Luckily it won't be so hard, in lua to create an object pool.
    I usually create a script with functions like "reserve" (put objects in pool table), "unreserve" (clear objects), "getObject" (get an unused object from pool set it as used), "returnObject"(return an object into pool set it as unused ), "init" (sets object to reserve and other internal to script things).
    I cannot explain it better at the moment.

  2. saveImage
    we have no "saveImage" methods at the moment. I know that something like that could be done with Moai's copyRect but I'm not sure.

  3. game pause, resume.
    we have not pause or resume either. I don't know if Moai has something similar we could wrap in RapaNui, sorry.

Thank MattiaFortunati,

1, thank information
2, i found function writePNG in Moai ^^
3, how do I pause the game now? i like type RNFactory.Pause() or RNMain.....Pause()

Thank you very much !

sorry, can I ask one more thing ^^

How do make loading scene? with Rapanui event?

Nice!

Unfortunately RapaNui has not any function to pause/resume the game at the moment.

How do make loading scene? with Rapanui event?

Check director
https://github.com/ymobe/rapanui/tree/master/rapanui-samples/director
for more information about handling scenes in RapaNui.