Mobile Game Developer War 4: Online CampMGDW4 Online Camp #1Pengenalan J2ME, Eclipse, dan       Game Canvas
Mobile Game Developer War 4: Online Camp         Software pendukung• Java JDK  (http://www.oracle.com/technetwork/java/jav...
Mobile Game Developer War 4: Online Camp JDK – J2ME – dan Eclipse Pulsar• FAQ:  – Apakah saya bisa menggunakan JDK versi  ...
Mobile Game Developer War 4: Online Camp
Mobile Game Developer War 4: Online CampWorkspace Eclipse1.   Project Explorer        4.   Console and debugger2.   Work h...
Mobile Game Developer War 4: Online CampMenambahkan emulator ke Eclipse•   Install Wireless Toolkit atau Nokia Emulator te...
Mobile Game Developer War 4: Online CampKlik Manual Install (atau Import)…
Mobile Game Developer War 4: Online CampBrowse ke folder dimana kita menyimpan Emulatornya. Lalu tekan finish, tunggubeber...
Mobile Game Developer War 4: Online CampMembuat MIDlet Project baru
Mobile Game Developer War 4: Online Camp        Buat MIDlet dalam projectMIDlet adalah class utama yang akan dijalankan ol...
Mobile Game Developer War 4: Online CampFill detail for MIDletForm tersebut adalah:• Package, mendefinisikan packagedari m...
Mobile Game Developer War 4: Online CampStandar file MIDlet1.   TebakAngka() merupakan     konstruktor2.   startApp(), fun...
Mobile Game Developer War 4: Online CampKode awalKERANGKA MIDLET DANGAMECANVAS
Mobile Game Developer War 4: Online Camp          Struktur MIDlet [MainMidlet.java]import javax.microedition.midlet.MIDlet...
Mobile Game Developer War 4: Online CampRunning ProjectKlik kanan pada project yang ingin di running, lalu Run As >Emulate...
Mobile Game Developer War 4: Online Camp                               Hello World!import javax.microedition.midlet.MIDlet...
Mobile Game Developer War 4: Online Camp           Struktur MIDlet [MainMidlet.java]import javax.microedition.midlet.MIDle...
Mobile Game Developer War 4: Online Camp         Buat GameCanvas• File>New>Class  – Set superclass  – Add interface
Mobile Game Developer War 4: Online Camp  Struktur GameCanvas [MainCanvas.java]import javax.microedition.lcdui.game.GameCa...
Mobile Game Developer War 4: Online CampStruktur GameCanvas [MainCanvas.java]public void run() {     while(true){         ...
Mobile Game Developer War 4: Online Camp                        Game Looppublic void run() {     while(true){             ...
Mobile Game Developer War 4: Online Camp             Layar DeviceTerdapat 2 jenis layar pada device, yaitu:• Landscape, di...
Mobile Game Developer War 4: Online CampCartesian system on Device
Mobile Game Developer War 4: Online Camp            Screen Size• Landscape, rata – rata 320 x 240 pixel• Portrait, rata – ...
Mobile Game Developer War 4: Online Camp      How to develop landscape game• Emulator WTK, Qwerty Device  – Layar ada yang...
Mobile Game Developer War 4: Online Camp          How to develop portrait game• Emulator WTK 2.5.2,  DefaultColorPhone   –...
Mobile Game Developer War 4: Online Camp            Terima kasih.• Untuk menyelesaikan materi, kunjungi  http://bit.ly/KJm...
Upcoming SlideShare
Loading in...5
×

Online Camp #1: Pengenalan J2ME, Eclipse, dan Game Canvas

3,717

Published on

Materi pertama Online Camp MGDW4. Jika dirasa terlalu cepat pada bagian programming, silahkan pause lalu lanjutkan setelah s

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
3,717
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
125
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Online Camp #1: Pengenalan J2ME, Eclipse, dan Game Canvas"

  1. 1. Mobile Game Developer War 4: Online CampMGDW4 Online Camp #1Pengenalan J2ME, Eclipse, dan Game Canvas
  2. 2. Mobile Game Developer War 4: Online Camp Software pendukung• Java JDK (http://www.oracle.com/technetwork/java/javase/do wnloads/jdk-7u1-download-513651.html)• Wireless Toolkit [emulator default dari Java] (http://www.oracle.com/technetwork/java/download- 135801.html)• Eclipse Pulsar (http://eclipse.org/pulsar/)• Opsional: – Nokia S40/S60 Emulator – Perl [dibutuhkan oleh Nokia Emulator]
  3. 3. Mobile Game Developer War 4: Online Camp JDK – J2ME – dan Eclipse Pulsar• FAQ: – Apakah saya bisa menggunakan JDK versi 1.x saya? – Apakah saya bisa menggunakan Eclipse yang biasa saya gunakan? • Bisa, asal Eclipsenya bisa membuat J2ME Project
  4. 4. Mobile Game Developer War 4: Online Camp
  5. 5. Mobile Game Developer War 4: Online CampWorkspace Eclipse1. Project Explorer 4. Console and debugger2. Work here! 5. Eclipse Menu and Toolbars3. Class explorer
  6. 6. Mobile Game Developer War 4: Online CampMenambahkan emulator ke Eclipse• Install Wireless Toolkit atau Nokia Emulator terlebih dahulu• Pada Eclipse, pilih Window > Preferences akan muncul menu seperti dibawah Untuk Pulsar versi lama pilihannya bernama Import Pulsar terbaru menggunakan menu Manual Install
  7. 7. Mobile Game Developer War 4: Online CampKlik Manual Install (atau Import)…
  8. 8. Mobile Game Developer War 4: Online CampBrowse ke folder dimana kita menyimpan Emulatornya. Lalu tekan finish, tunggubeberapa saat, nanti akan muncul seperti ini.Lalu tekan OK untuk menutup Preferences
  9. 9. Mobile Game Developer War 4: Online CampMembuat MIDlet Project baru
  10. 10. Mobile Game Developer War 4: Online Camp Buat MIDlet dalam projectMIDlet adalah class utama yang akan dijalankan oleh aplikasi J2ME
  11. 11. Mobile Game Developer War 4: Online CampFill detail for MIDletForm tersebut adalah:• Package, mendefinisikan packagedari midlet kita nanti• Name, nama file midlet• Modifiers, mendefinisikanmodifiers pada file midlet tersebut• Superclass, mendefinisikan midlettersebut akan inheritance terhadapclass apa• Interface, jika file yang kita buatakan implements terhadap suatuinterface
  12. 12. Mobile Game Developer War 4: Online CampStandar file MIDlet1. TebakAngka() merupakan konstruktor2. startApp(), fungsi yang pertama kali dijalankan3. pauseApp(), fungsi yang dijalankan ketika game dipause4. destroyApp(), fungsi yang dijalankan ketika game akan diberhentikan
  13. 13. Mobile Game Developer War 4: Online CampKode awalKERANGKA MIDLET DANGAMECANVAS
  14. 14. Mobile Game Developer War 4: Online Camp Struktur MIDlet [MainMidlet.java]import javax.microedition.midlet.MIDlet;import javax.microedition.midlet.MIDletStateChangeException;public class MainMidlet extends MIDlet { public MainMidlet() { } protected void destroyApp(boolean arg0) throws MIDletStateChangeException { } protected void pauseApp() { } protected void startApp() throws MIDletStateChangeException { }}
  15. 15. Mobile Game Developer War 4: Online CampRunning ProjectKlik kanan pada project yang ingin di running, lalu Run As >Emulated Java ME MIDlet
  16. 16. Mobile Game Developer War 4: Online Camp Hello World!import javax.microedition.midlet.MIDlet;import javax.microedition.midlet.MIDletStateChangeException;public class MainMidlet extends MIDlet { public MainMidlet() { } protected void destroyApp(boolean arg0) throws MIDletStateChangeException { } protected void pauseApp() { } protected void startApp() throws MIDletStateChangeException { System.out.println("Hello world!"); }}
  17. 17. Mobile Game Developer War 4: Online Camp Struktur MIDlet [MainMidlet.java]import javax.microedition.midlet.MIDlet;import javax.microedition.midlet.MIDletStateChangeException;import javax.microedition.lcdui.Display;public class MainMidlet extends MIDlet { public MainCanvas canvas; public MainMidlet() { canvas = new MainCanvas(); } protected void destroyApp(boolean arg0) throws MIDletStateChangeException { } protected void pauseApp() { } protected void startApp() throws MIDletStateChangeException { Display display = Display.getDisplay(this); display.setCurrent(canvas); canvas.mulai(); Pada tahap ini akan } muncul beberapa error,} biarkan dulu.
  18. 18. Mobile Game Developer War 4: Online Camp Buat GameCanvas• File>New>Class – Set superclass – Add interface
  19. 19. Mobile Game Developer War 4: Online Camp Struktur GameCanvas [MainCanvas.java]import javax.microedition.lcdui.game.GameCanvas;import javax.microedition.lcdui.Graphics;public class MainCanvas extends GameCanvas implements Runnable { public Graphics g; Thread runner; public static int SLEEP_TIME = 1000/30; protected MainCanvas() { super(false); this.setFullScreenMode(true); g = getGraphics(); runner = new Thread(this); } public void mulai(){ runner.start(); } public void run() { //di slide berikutnya }}
  20. 20. Mobile Game Developer War 4: Online CampStruktur GameCanvas [MainCanvas.java]public void run() { while(true){ System.out.println("Testing dulu yah..."); flushGraphics(); try { Thread.sleep(SLEEP_TIME); } catch (InterruptedException e) { e.printStackTrace(); } }}
  21. 21. Mobile Game Developer War 4: Online Camp Game Looppublic void run() { while(true){ System.out.println("Testing dulu yah..."); flushGraphics(); try { Thread.sleep(SLEEP_TIME); } catch (InterruptedException e) { e.printStackTrace(); } }} while(!gameOver){ GetInput(); UpdateGame(); DrawGame(); flushGraphics(); try {Thread.sleep(SLEEP_TIME);} catch (InterruptedException e){ e.printStackTrace();} }
  22. 22. Mobile Game Developer War 4: Online Camp Layar DeviceTerdapat 2 jenis layar pada device, yaitu:• Landscape, dimana lebar > tinggi layar• Portrait, dimana tinggi > lebar layar
  23. 23. Mobile Game Developer War 4: Online CampCartesian system on Device
  24. 24. Mobile Game Developer War 4: Online Camp Screen Size• Landscape, rata – rata 320 x 240 pixel• Portrait, rata – rata 240 x 320 pixel
  25. 25. Mobile Game Developer War 4: Online Camp How to develop landscape game• Emulator WTK, Qwerty Device – Layar ada yang berlebih dibagian bawah – Tidak dapat menggunakan getHeight() secara langsung
  26. 26. Mobile Game Developer War 4: Online Camp How to develop portrait game• Emulator WTK 2.5.2, DefaultColorPhone – Just use it  nice and simple emulator
  27. 27. Mobile Game Developer War 4: Online Camp Terima kasih.• Untuk menyelesaikan materi, kunjungi http://bit.ly/KJmFfA• Untuk pertanyaan atau diskusi, bisa dilakukan via forum: http://bit.ly/mgdw4forum
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×