Author Topic: 2D games  (Read 2344 times)

Offline Fencer

  • byte
  • *
  • Posts: 21
    • View Profile
    • http://BrainKing.com
2D games
« on: November 23, 2012, 06:20:36 pm »
Hi guys,

I am quite new to jPCT-AE and my question is, can it be used for 2D games as well? (displaying sprites, transformation, collision detection etc.)  I am currently developing a 2D game for Android but it becomes laggy on standard SurfaceView when several thousand objects are shown (FPS drops below 10) and I would like to avoid to call OpenGL methods directly (it's quite a mess to me), so a good engine that encapsulates them would be handy.

Or is it possible to make a 3D scene and set a camera to simulate a 2D view? (cubes would be projected to squares etc.)

Thanks for any help.
Filip

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: 2D games
« Reply #1 on: November 23, 2012, 08:26:38 pm »
Displaying isn't a problem. You can (ab)use scaled blits by using the blit-methods in FrameBuffer to render sprites. Transformations have to be done by yourself, but that's easy in 2D. Collision detection is another story. jPCT-AE's collision detection methods are not suitable for the 2D case, so you would have to do it yourself...but that's the same when using the standard Android SDK, so it might not be an issue. It shouldn't be too hard to port the rendering part of your game over from Bitmaps (or whatever you are using ATM) to Textures and blitting.
However, i'm not sure if jPCT-AE is the best choice for this task. It might be worth a try though.