Desenvolvendo para Android na AndEngine com Eclipse


Esse tutorial mostra como utilizar a AndEngine, para desenvolver jogos para Android, utilizando o Eclipse

O primeiro a se fazer é baixar a AndEngine, dê uma olhada nesse post para saber como baixar a engine:

http://www.andengine.org/forums/tutorials/getting-started-with-andengine-t11.html

Agora que você já baixou vamos a um passo a passo para a utilização

Fase 1 – Eclipse
O Eclipse é a recomendação da Google para o desenvolvimento com Android e além disso vem com plugins que facilitam em muito a nossa vida facilitando muito setar o ambiente de desenvolvimento, criar o seu Virtual Android Device/Emulator.

Antes de mais nada certifique-se que tem o eclipse instalado, caso contrário, baixe e  o instale
http://www.eclipse.org/downloads/

Fase 2 – Instalando e configurando o Android SDK

O próximo passo é instalar o sdk do android ( que não vou abordar aqui, o link abaixo mostra bem como instalar)

http://developer.android.com/sdk/installing.html

É importante seguir os passos direitinho não pulando etapas pois para ter o sistema setado e funcional são necessários todos os passos.

Após instalar o SDK abra o SDK Manager da pasta Android SDK Tools como administrador, é importante ser como adminstrador senão não será instalado corretamente, e mande instalar.

Tome cuidado com quais pacotes vai instalar senão pode ter uma instalação grandinha, opte por escolher algumas versões do android não todas, eu escolhi o 2.1 e 2.2

Agora só mais alguns passos para o sucesso :

  1. Abra o Eclipse
  2. Clique em Windows -> Preferences
  3. Clique na orelha Android
  4. Na caixa onde diz SDK Location procure onde foi instalado o seu SDK ( no meu PC foi em C:\Program Files (x86)\Android\android-sdk-windows)
  5. Clique em Apply
  6. Reinicie o Eclipse
  7. Clique no icone com o símbolo do android que apareceu na barra de ferramentas, se abrir o Android SDK and AVD Manager deu tudo certo.
  8. Clique em Virtual device e crie um device para a simulação

Com esse passo já é possível desenvolver para Android.

Fase 3 –  Instalando a AndEngine

A AndEngine é distribuída com o Mercurial como controle de versão, que é parecido com o SVN que já falei em outro post aqui mas com algumas peculiaridades que talvez depois fale. O Mercurial tem um plugin para o Eclipse que permite a sincronização fácil e imediata sem muitos problemas.

Baixe e instale o plugin
http://www.javaforge.com/project/HGE

Agora vamos ao que viemos, baixar e instalar uns exemplos da AndEngine, onde tem muito material criando várias features da engine, bem como alguns jogos legais que você pode aprender bastante observando
Para baixar os exemplos da AndEngineTo siga os passos abaixo:

1. File -> New Project
2. Selecione  Clone Existing Mercurial Repository na pasta Mercurial
3. No campo URL cole o seguinte link:
https://andengineexamples.googlecode.com/hg/
4. Aperte Next. Aparecerá então uma tela mostrando o que vai ser baixado
5. Aperte Next e então Finish.

Agora você já tem a AndEngine instalada no seu sistema.

Caso não consiga ver o projeto no Workspace, então importe o projeto selecionando File -> Import -> Existing Projects Into Workspace.

Fase 4 – Criando um Hello World

Agora que vc já instalou tudo direitinho é óbvio que vai querer ver algo que você mesmo fez funcionado, então vamos lá.

Crie um projeto do tipo Android. Escolha o nome “HelloWorld” ( eu sei que essa parte é ridícula mas é pra homogeneizar o post )

Agora temos que importar o AndEngine Library para o nosso projeto, para que possamos usar as suas funcionalidades.

Siga esses passos:

1. Botão direito no nome do seu projeto
2. Selecione New -> Folder e crie uma pasta chamada lib
3. Abra o projeto de exemplos da AndEngineOpen e vá até a pasta lib
4. Copie o andengine.jar
5. Cole na sua pasta lib

Agora temos que adicionar a Library ao Project Build Path. Siga os passos abaixo:

1. Abra a sua pasta lib
2. Botão direito no andengine.jar
3. Selecione Build Path -> Add To Build Path

Pronto, tudo setado e configurado, agora vamos a um código base.
Abra o arquivo principal do seu projeto que no nosso caso é o HelloWorld.java, apague tudo menos a parte dos packages no topo do arquiv0 e cole isso:

public class HelloWorld extends BaseGameActivity {
	// ===========================================================
	// Constants
	// ===========================================================

	private static final int CAMERA_WIDTH = 720;
	private static final int CAMERA_HEIGHT = 480;

	// ===========================================================
	// Fields
	// ===========================================================

	private Camera mCamera;

	// ===========================================================
	// Constructors
	// ===========================================================

	// ===========================================================
	// Getter & Setter
	// ===========================================================

	// ===========================================================
	// Methods for/from SuperClass/Interfaces
	// ===========================================================

	@Override
	public Engine onLoadEngine() {
		this.mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
		return new Engine(new EngineOptions(true, ScreenOrientation.LANDSCAPE, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), this.mCamera));
	}

	@Override
	public void onLoadResources() {
	}

	@Override
	public Scene onLoadScene() {
		this.mEngine.registerUpdateHandler(new FPSLogger());

		final Scene scene = new Scene(1);
		scene.setBackground(new ColorBackground(0, 0, 0.8784f));

		return scene;
	}

	@Override
	public void onLoadComplete() {

	}

	// ===========================================================
	// Methods
	// ===========================================================

	// ===========================================================
	// Inner and Anonymous Classes
	// ===========================================================
}

Antes de dar um build tenha certeza de ter adicionado a seguinte linha no seu AndroidManifest.xml

<uses-permission android:name=“android.permission.WAKE_LOCK”/>

Precione Ctrl+Shift+O para resolver as pendências de pacotes. Assim que compilar direito rode e você verá no seu emulador uma tela azul que é o princípio da sua grande aventura no mundo dos jogos android

  1. #1 by us agency car insurance Secaucus NJ on 15 de janeiro de 2017 - 7:38 am

    BlazeCustoms / Yes I am here in Japan, you must download some 3D games from the network but now they sell 3D games in stores such as Call of Duty Black Ops, Gran Turismo, Crysis 2 and more.

  2. #2 by cheap sr22 insurance Jamaica NY on 15 de janeiro de 2017 - 8:47 am

    Jihaa, onnittelut Stormin tytölle ;D Heh, hämärä letti on ihanan hämärä.Trenssihelmistä papukaijamerkki, mahtava termi nimittäin – ennen tuota uudempaa kommenttiasi olin ihan äimänä että mikä hiivatti on trenssihelmi, ikinä kuullutkaan. Hahaa!Se Blascon nudepuna rokkaa, kun pohja on kunnossa. Tässä meikissä käytettiin kiiltoa, esittele myöhemmin noi tuotteet.Ele, ne kauheat, raapivat hiusjutut eivät palaa takaisin minun elämääni. Kai.Kyllä mä ennenkin olen käyttänyt poskipunaa, mutta ihan väärässä mestassa, i guess.

  3. #3 by look auto insurance San Luis Obispo CA on 15 de janeiro de 2017 - 8:51 am

    there only was ONE Jack Gartside! Only Jack went bone fishing in FL – got off the plane, went to the Salvation Army store, picked up some used sneakers (Gartside flats slippers), a few pairs of shorts, an S Shirt (he was too cheap to buy a T Shirt!) and he was ready to go!We will all miss you – you kept the sport real.

  4. #4 by non owners car insurance quotes Butler PA on 15 de janeiro de 2017 - 9:03 am

    You know what, I’m very much inclined to agree.

  5. #5 by webcam models on 15 de janeiro de 2017 - 9:18 am

    here are some hyperlinks to internet sites that we link to simply because we feel they’re worth visiting

  6. #6 by auto owners insurance Scottsdale AZ on 15 de janeiro de 2017 - 9:20 am

    Great insight! That’s the answer we’ve been looking for.

  7. #7 by affordable auto insurance Schaumburg IL on 15 de janeiro de 2017 - 1:07 pm

    Silvio a galera aqui perto da minha casa adorava wwe; Se voce conseguir por wwe novamente na tv mais felis do brasil, o sbt vai ter uma grande audiencia.

  8. #8 by auto insurance quotes Prairieville LA on 15 de janeiro de 2017 - 2:06 pm

    linked to Tasty Tuesdays, Slightly Indulgent Tuesdays, Allergy Free Wednesday, Real Food Wednesday, Simple Lives Thursday « Don’t Be Disposable (A Challenge) » Ditch the Lawnmower. Get a Reel

  9. #9 by Stores and Inventory Management Qatar on 15 de janeiro de 2017 - 2:21 pm

    Hello! I just would like to give a huge thumbs up for the great info you have here on this post. I will be coming back to your blog for more soon.

  10. #10 by non owners car insurance quotes Tulsa OK on 15 de janeiro de 2017 - 5:07 pm

    Adonias, nova pesquisa Presidente Dutra será divulgada nos proximos dias. E essa é verdadeira e vai supreender muita gente. Rapaz ia mulher boa de voto!!!Resposta: Se estiver registrada no cartório eleitoral, publico aqui.

  11. #11 by cheapest car insurance Northville MI on 15 de janeiro de 2017 - 6:29 pm

    If I remember the story, it’s not the common people rioting in the street who work out the true nature of the stars; it’s narrated or recounted or the action is set amongst a group of astronomers and university professors, and they have already theorised about what the possibilities are, based on the tales preserved in myth and religious belief.So it’s not like they’re suddenly starting from nothing and come to the realisation of the truth.

  12. #12 by cheap non owners insurance in Peoria AZ on 15 de janeiro de 2017 - 6:35 pm

    I po co prowokujesz religinie na temacie w którym o kościele sie nie mówi? Ty chyba nie umiesz żyć bez jakiegokolwiek kontaktu z katolicyzmem, jak kobita która krytykuje tego kto ją fascynuje a którego zaloty zarazem odrzuca

  13. #13 by us agency car insurance Metuchen NJ on 15 de janeiro de 2017 - 6:52 pm

    Yup, that’ll do it. You have my appreciation.

  14. #14 by http://autoinsurancend.info/AL/Alexander-City/affordable-car-insurance/ on 15 de janeiro de 2017 - 8:34 pm

    Howdy. Very cool web site!! Man .. Excellent .. Wonderful .. I’ll bookmark your site and take the feeds also…I am happy to locate numerous helpful info here in the post. Thank you for sharing..

  15. #15 by cheap car insurance quotes Northville MI on 16 de janeiro de 2017 - 12:37 am

    Hey guys! Great campaign! I didn’t get to meet Moses, but I hope him the best. I took the liberty of forwarding the info to my friends with big hearts.Question: Do we have to sign up with the Beta-dropcash-thingy to contribute? It’s a little unclear and I want to assure everybody that you are trustworthy and safe fellows. Please get back to me so I can flow some dough. . .

  16. #16 by adidas yeezy boost 350 on 16 de janeiro de 2017 - 1:51 am

  17. #17 by cheap auto insurance Land O Lakes FL on 16 de janeiro de 2017 - 2:36 am

    Super informative writing; keep it up.

  18. #18 by yeezy boost 350 v2 2017 on 16 de janeiro de 2017 - 7:57 am

  19. #19 by low income car insurance dmv Eugene OR on 16 de janeiro de 2017 - 8:07 am

    Eric Sykes observed:So Assange is going to run for a seat in the Australian Senate…that should cheer up question time…..Wrong House for that. It might add to the amusement in Senate Estimates or other committees though …

  20. #20 by non owners car insurance quotes Rock Island IL on 16 de janeiro de 2017 - 9:01 am

    It’s a real pleasure to find someone who can think like that

  21. #21 by http://autoinsurancend.info/FL/Tallahassee/car-insurance-rates/ on 16 de janeiro de 2017 - 9:25 am

    I am going for any Conversation Research course at school of Los angeles… were checking out the power connected with writing a blog. Your blog appears to be actually fill up all of the areas of a great blog site that we possess discussed at school. We are genuinely publishing the essay or dissertation quickly which enables it to be bringing up to this.

  22. #22 by http://carinsurancelit.top/WI/cheap-full-coverage-car-insurance/ on 16 de janeiro de 2017 - 9:53 am

    Ppl like you get all the brains. I just get to say thanks for he answer.

  23. #23 by cheap car insurance quotes Kings Mountain NC on 16 de janeiro de 2017 - 11:06 am

    Superb information here, ol’e chap; keep burning the midnight oil.

  24. #24 by direct auto insurance Snellville GA on 16 de janeiro de 2017 - 11:46 am

    What a beautiful quilt, Kim! I like them soft and tattered, too! The blue is so pretty…I'm finding myself attracted to it again in the house! You got a great price on it, too!

  25. #25 by full coverage car insurance Morrow GA on 16 de janeiro de 2017 - 2:10 pm

    Times are changing for the better if I can get this online!

  26. #26 by kredit vermittlung privat finanz telefonnummer on 16 de janeiro de 2017 - 3:53 pm

    You got to push it-this essential info that is!

  27. #27 by Car Insurance Quotes Online on 16 de janeiro de 2017 - 5:18 pm

    We wanna start a website regarding fantasy sports activities. I have lots of ideas to get content..

  28. #28 by http://besterkreditvergleich.net/free-federal-kredit-report-öffnen.html on 16 de janeiro de 2017 - 5:24 pm

    I actually wanted to post a small message to be able to express gratitude to you for the lovely tips and tricks you are showing here. My long internet look up has at the end been compensated with incredibly good ideas to share with my two friends. I would declare that we readers are extremely blessed to dwell in a notable site with very many brilliant individuals with useful plans. I feel rather grateful to have come across your entire weblog and look forward to so many more cool moments reading here. Thank you again for a lot of things.

  29. #29 by kredit bearbeitungsgebühr zinsen berechnen on 16 de janeiro de 2017 - 5:37 pm

    Life is short, and this article saved valuable time on this Earth.

  30. #30 by kredit online für rentner on 16 de janeiro de 2017 - 7:09 pm

    I hate my life but at least this makes it bearable.

  31. #31 by how to anal on 16 de janeiro de 2017 - 7:52 pm

    here are some links to web sites that we link to due to the fact we feel they may be worth visiting

  32. #32 by kartu kredit tarik tunai on 16 de janeiro de 2017 - 7:55 pm

    Buenas tardes necesitaria saber el precio de las entradas para ver el 15 de diciembre del 2012 SABINA – SERRAT en la Bombonera y de que manera las puedo obtener.Aguardo respuesta , muchas gracias.

  33. #33 by Classic Vibrator on 16 de janeiro de 2017 - 9:43 pm

    Here are a few of the websites we suggest for our visitors

  34. #34 by Car Insurance Quotes Online on 16 de janeiro de 2017 - 10:25 pm

    Hello There. I found your weblog the use of msn. This is a really smartly written article. I will make sure to bookmark it and come back to learn more of your useful info. Thanks for the post. I will definitely return.

  35. #35 by berechnung kreditzins formel ändern on 16 de janeiro de 2017 - 10:47 pm

    point. Historically speaking, Russian women had a good status even in Kievan Rus (relative to other civilizations that is).@LR,You fail to note that 95% of your comments are either from a) the LR collective (or yourself) and b) enraged Russian patriots / Russophiles.Sublime Oblivion´s last blog post..

  36. #36 by fidium kredit antrag ändern on 16 de janeiro de 2017 - 10:53 pm

    Way to go on this essay, helped a ton.

  37. #38 by immobilienkredit check on 17 de janeiro de 2017 - 12:44 am

    Actually, under bankruptcy laws, anything you earn AFTER filing for bankruptcy is free and clear. If you earn it before, it goes to pay down the debts. THAT’S why she held off for a month until she signed the thing. It would be interesting to know from a legal perspective what was the earning trigger – when the contract was drawn up or when it was signed.

  38. #39 by Health Clinic on 17 de janeiro de 2017 - 1:53 am

    You made some clear points there. I did a search on the subject and found most people will consent with your blog.

  39. #40 by http://besteronlinekredit.pw/yen-kredit-aufnehmen.html on 17 de janeiro de 2017 - 1:53 am

    Your post is a timely contribution to the debate

  40. #41 by kredit harz 4 schufafrei seriös on 17 de janeiro de 2017 - 2:15 am

    3e153 on 1f6d24bNearly all of whatever you point out is supprisingly appropriate and it makes me wonder why I had not looked at this in this light previously. This particular article really did switch the light on for me personally as far as this subject matter goes. Nonetheless there is actually just one factor I am not necessarily too comfortable with so while I attempt to reconcile that with the actual main idea of the issue, let me observe exactly what all the rest of your subscribers have to point out.Nicely done.

  41. #42 by シャネル時計 ベルト amazon on 17 de janeiro de 2017 - 3:22 am

    スーパーコピーブランド優良店、
    偽物時計n級品海外激安通販専門店!
    ロレックス、ウブロをはじめとした、様々なスーパーコピー時計の販売・サイズ調整をご 提供しております。
    スーパーブランドコピーなら当店で!
    シャネル時計 ベルト amazon http://kopii.net/products/p1/7/1/index.htm

  42. #43 by スーパーコピー 財布 韓国 on 17 de janeiro de 2017 - 3:23 am

    オメガスーパーコピー
    日本的な人気と信頼を得ています。
    安心、安全にお届けします
    日本では手に入らない商品も、全て卸売りします。
    価格、品質、自信のある商品を取り揃えておりますので
    スーパーコピー 財布 韓国 http://giginza.com/alone/detail-17.html

  43. #44 by カルティエ 結婚指輪 ラブ dvd on 17 de janeiro de 2017 - 3:23 am

    ブランドコピー品激安通販店

    弊社スーパーコピー時計激安通販偽物販売ショップ!
    メンズ時計専門店をご覧頂き誠にありがとうございます。
    豊富な品数を備えているほか、スーパーコピーの最新入荷を追い求め
    その最新作品のコピー品を提供する一方
    スーパーコピー品の供給を保証することができます。
    超人気高級ウブロ・ロレックス・オメガ・フランクミュラー・カルティエ等提供してあげます!
    ブランド時計専門店はお客様がご安心に購入いただけるように
    最高ランクの『スーパーコピー』
    N級品のみを扱っており、取扱い販売をさせていただいております。

    海外スーパーコピーのスーパーコピー バッグ、アクセサリー
    スーパーコピー時計、貴金属の(リサイクル品)のスーパーコピー販売・買取

    ホームページ上でのご注文は24時間受け付けております
    カルティエ 結婚指輪 ラブ dvd http://kopi356.com/category-68-b0.html

  44. #45 by Kayaking on 17 de janeiro de 2017 - 3:47 am

    We are a group of volunteers and starting a new scheme in our community. Your site provided us with valuable info to work on. You’ve done an impressive job and our whole community will be thankful to you.

  45. #46 by Dining Table Sets on 17 de janeiro de 2017 - 4:38 am

    Thank you for another magnificent post. Where else could anyone get that type of information in such a perfect manner of writing? I’ve a presentation subsequent week, and I’m on the look for such info.

  46. #47 by kredit von scotland on 17 de janeiro de 2017 - 4:44 am

    Good site! I truly love how it is easy on my eyes and the data are well written. I’m wondering how I might be notified whenever a new post has been made. I have subscribed to your feed which must do the trick! Have a great day! “A crime which is the crime of many none avenge.” by Lucan.

1 171 172 173
(não será publicado)