android - How to change Scene / Camera starting position in AndEngine GLES1.0 -
i relatively new andengine , stuck in 1 problem. made sample demo game, in character can move left , right in game made of tiled. default, when game starts, scene/camera , character placed @ left side of screen. camera moves left edge of screen right side in landscape mode. below working code:
private boundcamera mcamera; @override public engine onloadengine() { this.mcamera = new boundcamera(-100, -100, camera_width, camera_height){ @override public void onapplyscenematrix(gl10 pgl) { glhelper.setprojectionidentitymatrix(pgl); glu.gluortho2d(pgl, (int)this.getminx(), (int)this.getmaxx(), (int)this.getmaxy(), (int)this.getminy()); } }; final engineoptions engineoptions = new engineoptions(true, screenorientation.landscape, new ratioresolutionpolicy(camera_width, camera_height), mcamera); engineoptions.gettouchoptions().setrunonupdatethread(true); engineoptions.setneedsmusic(true).setneedssound(true); // necessary in lot of applications define following // wake lock options in order disable device's display // turning off during gameplay due inactivity engineoptions.setwakelockoptions(wakelockoptions.screen_on); final engine engine = new engine(engineoptions); try { if (multitouch.issupported(this)) { engine.settouchcontroller(new multitouchcontroller()); if (multitouch.issupporteddistinct(this)) { } else { toast.maketext(this, "(multitouch detected, device might have problems distinguish between separate fingers.)", toast.length_long).show(); } } else { toast.maketext(this, "sorry device not support multitouch!\n\n(falling singletouch.)", toast.length_long).show(); } } catch (final multitouchexception e) { toast.maketext(this, "sorry android version not support multitouch!\n\n(falling singletouch.)", toast.length_long).show(); } return engine; }
i tried apply different values in new boundcamera()
constructor. nothing works. please guide me solve this. want start camera , scene right edge of screen in landscape mode.
in need make camera chase player. can by:
camera.setchaseentity(player);
just have @ andengine examples. has example serves need. follow link below download code well:
http://code.google.com/p/andengineexamples/
•tmxtiledmapexample
Comments
Post a Comment