텍스쳐 로딩
게임 화면
![](https://t1.daumcdn.net/cfile/tistory/117A04264CA2B33118)
//TextureAtlas atlas = new TextureAtlas(); /** * Here we’ll add the background texture to our atlas. * (note that it’s recommended to add the textures * in order of size, ie add the biggest one first, * and the smallest one last) */ background = new Texture("background.png"); atlas.insert( background ); bob = new Texture("bob.png"); atlas.insert( bob ); /** * * This marks the atlas as complete, meaning that after you call this, * you cannot add any more textures to the atlas. */ atlas.complete();
게임 화면
public GameScene() { /** * ‘super()’ to ‘super(1, 3)’, this means that * we’re only going to use 1 layer of sprites with 3 sprites on it. */ super(1,3); // TODO Auto-generated constructor stub background = new FixedBackground(Textures.background); setBackground(background); // Create the Bob sprites. bob1 = new Sprite(100, 220, Textures.bob.getWidth(), Textures.bob.getHeight()); bob1.setTexture(Textures.bob); bob2 = new Sprite(100, 180, Textures.bob.getWidth(), Textures.bob.getHeight()); bob2.setTexture(Textures.bob); bob3 = new Sprite(100, 260, Textures.bob.getWidth(), Textures.bob.getHeight()); bob3.setTexture(Textures.bob); // Add the Bob sprites to the first layer. add(0, bob1); add(0, bob2); add(0, bob3); } @Override public void onGameLoop() { // TODO Auto-generated method stub bob1.x += 1; if (bob1.x >= MainActivity.GAME_WIDTH) { bob1.x = 0; } bob2.rotate(2); } @Override public void onPause() { // TODO Auto-generated method stub } @Override public void onReady() { // TODO Auto-generated method stub bob3.moveTo(450, 100, 5000); } @Override public void onResume() { // TODO Auto-generated method stub }
'0.일반개발' 카테고리의 다른 글
Using Modifiers -- Rokon Game Engine (1) | 2010.09.29 |
---|---|
Using Touch Input -- Rokon Game Engine (0) | 2010.09.29 |
HelloWorld -- Rokon Game Engine (0) | 2010.09.29 |
Rokon is an open source (New BSD license) 2D OpenGL game engine for Android. (0) | 2010.09.29 |
GLSurfaceView.Renderer (0) | 2010.09.29 |