SlideShare une entreprise Scribd logo
1  sur  27
Mobile Game Developer War 4: Online Camp




MGDW4 Online Camp #1

Pengenalan J2ME, Eclipse, dan
       Game Canvas
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]
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
Mobile Game Developer War 4: Online Camp
Mobile Game Developer War 4: Online Camp




Workspace Eclipse
1.   Project Explorer        4.   Console and debugger
2.   Work here!              5.   Eclipse Menu and Toolbars
3.   Class explorer
Mobile Game Developer War 4: Online Camp

Menambahkan 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
Mobile Game Developer War 4: Online Camp




Klik Manual Install (atau Import)…
Mobile Game Developer War 4: Online Camp




Browse ke folder dimana kita menyimpan Emulatornya. Lalu tekan finish, tunggu
beberapa saat, nanti akan muncul seperti ini.




Lalu tekan OK untuk menutup Preferences
Mobile Game Developer War 4: Online Camp

Membuat MIDlet Project baru
Mobile Game Developer War 4: Online Camp

        Buat MIDlet dalam project




MIDlet adalah class utama yang akan dijalankan oleh aplikasi J2ME
Mobile Game Developer War 4: Online Camp


Fill detail for MIDlet
Form tersebut adalah:
• Package, mendefinisikan package
dari midlet kita nanti

• Name, nama file midlet

• Modifiers, mendefinisikan
modifiers pada file midlet tersebut

• Superclass, mendefinisikan midlet
tersebut akan inheritance terhadap
class apa

• Interface, jika file yang kita buat
akan implements terhadap suatu
interface
Mobile Game Developer War 4: Online Camp


Standar file MIDlet
1.   TebakAngka() merupakan
     konstruktor

2.   startApp(), fungsi yang pertama
     kali dijalankan

3.   pauseApp(), fungsi yang
     dijalankan ketika game dipause

4.   destroyApp(), fungsi yang
     dijalankan ketika game akan
     diberhentikan
Mobile Game Developer War 4: Online Camp




Kode awal

KERANGKA MIDLET DAN
GAMECANVAS
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 {
   }
}
Mobile Game Developer War 4: Online Camp




Running Project
Klik kanan pada project yang ingin di running, lalu Run As >
Emulated Java ME MIDlet
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!");
   }
}
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.
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.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
   }
}
Mobile Game Developer War 4: Online Camp
Struktur 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();
              }
     }
}
Mobile Game Developer War 4: Online Camp
                        Game Loop
public 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();}
                        }
Mobile Game Developer War 4: Online Camp

             Layar Device
Terdapat 2 jenis layar pada device, yaitu:
• Landscape, dimana lebar > tinggi layar
• Portrait, dimana tinggi > lebar layar
Mobile Game Developer War 4: Online Camp

Cartesian system on Device
Mobile Game Developer War 4: Online Camp

            Screen Size
• Landscape, rata – rata 320 x 240 pixel

• Portrait, rata – rata 240 x 320 pixel
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
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
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

Contenu connexe

Plus de Agate Studio

Wp quality bar tedy
Wp quality bar   tedyWp quality bar   tedy
Wp quality bar tedyAgate Studio
 
Lee marvin pitching-hacks
Lee marvin pitching-hacksLee marvin pitching-hacks
Lee marvin pitching-hacksAgate Studio
 
Emotiv EPOC by Neneng
Emotiv EPOC by NenengEmotiv EPOC by Neneng
Emotiv EPOC by NenengAgate Studio
 
Aksi – Koneksi – Deviasi by Valent
Aksi – Koneksi – Deviasi by ValentAksi – Koneksi – Deviasi by Valent
Aksi – Koneksi – Deviasi by ValentAgate Studio
 
MMO Design Architecture by Andrew
MMO Design Architecture by AndrewMMO Design Architecture by Andrew
MMO Design Architecture by AndrewAgate Studio
 
How to Persuade People by Dave
How to Persuade People by DaveHow to Persuade People by Dave
How to Persuade People by DaveAgate Studio
 
Eddie supersmash goodminton
Eddie   supersmash goodmintonEddie   supersmash goodminton
Eddie supersmash goodmintonAgate Studio
 
Satriyo digital audio gears
Satriyo   digital audio gearsSatriyo   digital audio gears
Satriyo digital audio gearsAgate Studio
 
Yinan heroes of-the_strom
Yinan   heroes of-the_stromYinan   heroes of-the_strom
Yinan heroes of-the_stromAgate Studio
 
Advanced encryption standard (aes) epul
Advanced encryption standard (aes)   epulAdvanced encryption standard (aes)   epul
Advanced encryption standard (aes) epulAgate Studio
 
Real Time Framework by Tonny
Real Time Framework by TonnyReal Time Framework by Tonny
Real Time Framework by TonnyAgate Studio
 
Unity Camera & Simple Image Editing by Puthut
Unity Camera & Simple Image Editing by PuthutUnity Camera & Simple Image Editing by Puthut
Unity Camera & Simple Image Editing by PuthutAgate Studio
 
Hibernate by Jason
Hibernate by JasonHibernate by Jason
Hibernate by JasonAgate Studio
 
Hardening Apache Web Server by Aswin
Hardening Apache Web Server by AswinHardening Apache Web Server by Aswin
Hardening Apache Web Server by AswinAgate Studio
 
Introduction to Global Illumination by Aryo
Introduction to Global Illumination by AryoIntroduction to Global Illumination by Aryo
Introduction to Global Illumination by AryoAgate Studio
 
Mobile Games Store by Valen
Mobile Games Store by ValenMobile Games Store by Valen
Mobile Games Store by ValenAgate Studio
 
Characteristics of Musical Keys by Satriyo
Characteristics of Musical Keys by SatriyoCharacteristics of Musical Keys by Satriyo
Characteristics of Musical Keys by SatriyoAgate Studio
 
Idol Cardgame by Naky
Idol Cardgame by NakyIdol Cardgame by Naky
Idol Cardgame by NakyAgate Studio
 

Plus de Agate Studio (20)

Wp quality bar tedy
Wp quality bar   tedyWp quality bar   tedy
Wp quality bar tedy
 
Toku DB by Aswin
Toku DB by AswinToku DB by Aswin
Toku DB by Aswin
 
Lee marvin pitching-hacks
Lee marvin pitching-hacksLee marvin pitching-hacks
Lee marvin pitching-hacks
 
Emotiv EPOC by Neneng
Emotiv EPOC by NenengEmotiv EPOC by Neneng
Emotiv EPOC by Neneng
 
Aksi – Koneksi – Deviasi by Valent
Aksi – Koneksi – Deviasi by ValentAksi – Koneksi – Deviasi by Valent
Aksi – Koneksi – Deviasi by Valent
 
MMO Design Architecture by Andrew
MMO Design Architecture by AndrewMMO Design Architecture by Andrew
MMO Design Architecture by Andrew
 
How to Persuade People by Dave
How to Persuade People by DaveHow to Persuade People by Dave
How to Persuade People by Dave
 
Eddie supersmash goodminton
Eddie   supersmash goodmintonEddie   supersmash goodminton
Eddie supersmash goodminton
 
Satriyo digital audio gears
Satriyo   digital audio gearsSatriyo   digital audio gears
Satriyo digital audio gears
 
Yinan heroes of-the_strom
Yinan   heroes of-the_stromYinan   heroes of-the_strom
Yinan heroes of-the_strom
 
Advanced encryption standard (aes) epul
Advanced encryption standard (aes)   epulAdvanced encryption standard (aes)   epul
Advanced encryption standard (aes) epul
 
Real Time Framework by Tonny
Real Time Framework by TonnyReal Time Framework by Tonny
Real Time Framework by Tonny
 
Unity Camera & Simple Image Editing by Puthut
Unity Camera & Simple Image Editing by PuthutUnity Camera & Simple Image Editing by Puthut
Unity Camera & Simple Image Editing by Puthut
 
Hibernate by Jason
Hibernate by JasonHibernate by Jason
Hibernate by Jason
 
Hardening Apache Web Server by Aswin
Hardening Apache Web Server by AswinHardening Apache Web Server by Aswin
Hardening Apache Web Server by Aswin
 
Introduction to Global Illumination by Aryo
Introduction to Global Illumination by AryoIntroduction to Global Illumination by Aryo
Introduction to Global Illumination by Aryo
 
Mobile Games Store by Valen
Mobile Games Store by ValenMobile Games Store by Valen
Mobile Games Store by Valen
 
Characteristics of Musical Keys by Satriyo
Characteristics of Musical Keys by SatriyoCharacteristics of Musical Keys by Satriyo
Characteristics of Musical Keys by Satriyo
 
Nelson easter egg
Nelson easter eggNelson easter egg
Nelson easter egg
 
Idol Cardgame by Naky
Idol Cardgame by NakyIdol Cardgame by Naky
Idol Cardgame by Naky
 

Dernier

Modul Ajar Bahasa Indonesia Kelas 8 Fase D
Modul Ajar Bahasa Indonesia Kelas 8 Fase DModul Ajar Bahasa Indonesia Kelas 8 Fase D
Modul Ajar Bahasa Indonesia Kelas 8 Fase DAbdiera
 
modul 1.2 guru penggerak angkatan x Bintan
modul 1.2 guru penggerak angkatan x Bintanmodul 1.2 guru penggerak angkatan x Bintan
modul 1.2 guru penggerak angkatan x BintanVenyHandayani2
 
1.2.a.6. Demonstrasi Konstektual - Modul 1.2 (Shinta Novianti - CGP A10).pdf
1.2.a.6. Demonstrasi Konstektual - Modul 1.2 (Shinta Novianti - CGP A10).pdf1.2.a.6. Demonstrasi Konstektual - Modul 1.2 (Shinta Novianti - CGP A10).pdf
1.2.a.6. Demonstrasi Konstektual - Modul 1.2 (Shinta Novianti - CGP A10).pdfShintaNovianti1
 
PPT kecerdasan emosi dan pengendalian diri.pptx
PPT kecerdasan emosi dan pengendalian diri.pptxPPT kecerdasan emosi dan pengendalian diri.pptx
PPT kecerdasan emosi dan pengendalian diri.pptxINyomanAgusSeputraSP
 
Demonstrasi Kontekstual Modul 1.2. pdf
Demonstrasi Kontekstual  Modul 1.2.  pdfDemonstrasi Kontekstual  Modul 1.2.  pdf
Demonstrasi Kontekstual Modul 1.2. pdfvebronialite32
 
Materi Kelas Online Ministry Learning Center - Bedah Kitab 1 Tesalonika
Materi Kelas Online Ministry Learning Center - Bedah Kitab 1 TesalonikaMateri Kelas Online Ministry Learning Center - Bedah Kitab 1 Tesalonika
Materi Kelas Online Ministry Learning Center - Bedah Kitab 1 TesalonikaSABDA
 
Catatan di setiap Indikator Fokus Perilaku
Catatan di setiap Indikator Fokus PerilakuCatatan di setiap Indikator Fokus Perilaku
Catatan di setiap Indikator Fokus PerilakuHANHAN164733
 
Edukasi Haji 2023 pembinaan jemaah hajii
Edukasi Haji 2023 pembinaan jemaah hajiiEdukasi Haji 2023 pembinaan jemaah hajii
Edukasi Haji 2023 pembinaan jemaah hajiiIntanHanifah4
 
Pembahasan Soal UKOM gerontik persiapan ukomnas
Pembahasan Soal UKOM gerontik persiapan ukomnasPembahasan Soal UKOM gerontik persiapan ukomnas
Pembahasan Soal UKOM gerontik persiapan ukomnasAZakariaAmien1
 
P_E_R_I_L_A_K_U__K_O_N_S_E_L_O_R__v.1.ppt
P_E_R_I_L_A_K_U__K_O_N_S_E_L_O_R__v.1.pptP_E_R_I_L_A_K_U__K_O_N_S_E_L_O_R__v.1.ppt
P_E_R_I_L_A_K_U__K_O_N_S_E_L_O_R__v.1.pptAfifFikri11
 
Keberagaman-Peserta-Didik-dalam-Psikologi-Pendidikan.pptx
Keberagaman-Peserta-Didik-dalam-Psikologi-Pendidikan.pptxKeberagaman-Peserta-Didik-dalam-Psikologi-Pendidikan.pptx
Keberagaman-Peserta-Didik-dalam-Psikologi-Pendidikan.pptxLeniMawarti1
 
PPT TEKS TANGGAPAN KELAS 7 KURIKUKULM MERDEKA
PPT TEKS TANGGAPAN KELAS 7 KURIKUKULM MERDEKAPPT TEKS TANGGAPAN KELAS 7 KURIKUKULM MERDEKA
PPT TEKS TANGGAPAN KELAS 7 KURIKUKULM MERDEKARenoMardhatillahS
 
1.2.a.6 Dekon modul 1.2. DINI FITRIANI.pdf
1.2.a.6 Dekon modul 1.2. DINI FITRIANI.pdf1.2.a.6 Dekon modul 1.2. DINI FITRIANI.pdf
1.2.a.6 Dekon modul 1.2. DINI FITRIANI.pdfsandi625870
 
SKPM Kualiti @ Sekolah 23 Feb 22222023.pptx
SKPM Kualiti @ Sekolah 23 Feb 22222023.pptxSKPM Kualiti @ Sekolah 23 Feb 22222023.pptx
SKPM Kualiti @ Sekolah 23 Feb 22222023.pptxg66527130
 
PPT IPS Geografi SMA Kelas X_Bab 5_Atmosfer.pptx_20240214_193530_0000.pdf
PPT IPS Geografi SMA Kelas X_Bab 5_Atmosfer.pptx_20240214_193530_0000.pdfPPT IPS Geografi SMA Kelas X_Bab 5_Atmosfer.pptx_20240214_193530_0000.pdf
PPT IPS Geografi SMA Kelas X_Bab 5_Atmosfer.pptx_20240214_193530_0000.pdfNatasyaA11
 
PRESENTASI PEMBELAJARAN IPA PGSD UT MODUL 2
PRESENTASI PEMBELAJARAN IPA PGSD UT MODUL 2PRESENTASI PEMBELAJARAN IPA PGSD UT MODUL 2
PRESENTASI PEMBELAJARAN IPA PGSD UT MODUL 2noviamaiyanti
 
Modul Ajar Matematika Kelas 2 Fase A Kurikulum Merdeka
Modul Ajar Matematika Kelas 2 Fase A Kurikulum MerdekaModul Ajar Matematika Kelas 2 Fase A Kurikulum Merdeka
Modul Ajar Matematika Kelas 2 Fase A Kurikulum MerdekaAbdiera
 
Modul Ajar Bahasa Indonesia - Menulis Puisi Spontanitas - Fase D.docx
Modul Ajar Bahasa Indonesia - Menulis Puisi Spontanitas - Fase D.docxModul Ajar Bahasa Indonesia - Menulis Puisi Spontanitas - Fase D.docx
Modul Ajar Bahasa Indonesia - Menulis Puisi Spontanitas - Fase D.docxherisriwahyuni
 
adap penggunaan media sosial dalam kehidupan sehari-hari.pptx
adap penggunaan media sosial dalam kehidupan sehari-hari.pptxadap penggunaan media sosial dalam kehidupan sehari-hari.pptx
adap penggunaan media sosial dalam kehidupan sehari-hari.pptxmtsmampunbarub4
 
Teknik Menjawab Kertas P.Moral SPM 2024.pptx
Teknik Menjawab Kertas P.Moral SPM  2024.pptxTeknik Menjawab Kertas P.Moral SPM  2024.pptx
Teknik Menjawab Kertas P.Moral SPM 2024.pptxwongcp2
 

Dernier (20)

Modul Ajar Bahasa Indonesia Kelas 8 Fase D
Modul Ajar Bahasa Indonesia Kelas 8 Fase DModul Ajar Bahasa Indonesia Kelas 8 Fase D
Modul Ajar Bahasa Indonesia Kelas 8 Fase D
 
modul 1.2 guru penggerak angkatan x Bintan
modul 1.2 guru penggerak angkatan x Bintanmodul 1.2 guru penggerak angkatan x Bintan
modul 1.2 guru penggerak angkatan x Bintan
 
1.2.a.6. Demonstrasi Konstektual - Modul 1.2 (Shinta Novianti - CGP A10).pdf
1.2.a.6. Demonstrasi Konstektual - Modul 1.2 (Shinta Novianti - CGP A10).pdf1.2.a.6. Demonstrasi Konstektual - Modul 1.2 (Shinta Novianti - CGP A10).pdf
1.2.a.6. Demonstrasi Konstektual - Modul 1.2 (Shinta Novianti - CGP A10).pdf
 
PPT kecerdasan emosi dan pengendalian diri.pptx
PPT kecerdasan emosi dan pengendalian diri.pptxPPT kecerdasan emosi dan pengendalian diri.pptx
PPT kecerdasan emosi dan pengendalian diri.pptx
 
Demonstrasi Kontekstual Modul 1.2. pdf
Demonstrasi Kontekstual  Modul 1.2.  pdfDemonstrasi Kontekstual  Modul 1.2.  pdf
Demonstrasi Kontekstual Modul 1.2. pdf
 
Materi Kelas Online Ministry Learning Center - Bedah Kitab 1 Tesalonika
Materi Kelas Online Ministry Learning Center - Bedah Kitab 1 TesalonikaMateri Kelas Online Ministry Learning Center - Bedah Kitab 1 Tesalonika
Materi Kelas Online Ministry Learning Center - Bedah Kitab 1 Tesalonika
 
Catatan di setiap Indikator Fokus Perilaku
Catatan di setiap Indikator Fokus PerilakuCatatan di setiap Indikator Fokus Perilaku
Catatan di setiap Indikator Fokus Perilaku
 
Edukasi Haji 2023 pembinaan jemaah hajii
Edukasi Haji 2023 pembinaan jemaah hajiiEdukasi Haji 2023 pembinaan jemaah hajii
Edukasi Haji 2023 pembinaan jemaah hajii
 
Pembahasan Soal UKOM gerontik persiapan ukomnas
Pembahasan Soal UKOM gerontik persiapan ukomnasPembahasan Soal UKOM gerontik persiapan ukomnas
Pembahasan Soal UKOM gerontik persiapan ukomnas
 
P_E_R_I_L_A_K_U__K_O_N_S_E_L_O_R__v.1.ppt
P_E_R_I_L_A_K_U__K_O_N_S_E_L_O_R__v.1.pptP_E_R_I_L_A_K_U__K_O_N_S_E_L_O_R__v.1.ppt
P_E_R_I_L_A_K_U__K_O_N_S_E_L_O_R__v.1.ppt
 
Keberagaman-Peserta-Didik-dalam-Psikologi-Pendidikan.pptx
Keberagaman-Peserta-Didik-dalam-Psikologi-Pendidikan.pptxKeberagaman-Peserta-Didik-dalam-Psikologi-Pendidikan.pptx
Keberagaman-Peserta-Didik-dalam-Psikologi-Pendidikan.pptx
 
PPT TEKS TANGGAPAN KELAS 7 KURIKUKULM MERDEKA
PPT TEKS TANGGAPAN KELAS 7 KURIKUKULM MERDEKAPPT TEKS TANGGAPAN KELAS 7 KURIKUKULM MERDEKA
PPT TEKS TANGGAPAN KELAS 7 KURIKUKULM MERDEKA
 
1.2.a.6 Dekon modul 1.2. DINI FITRIANI.pdf
1.2.a.6 Dekon modul 1.2. DINI FITRIANI.pdf1.2.a.6 Dekon modul 1.2. DINI FITRIANI.pdf
1.2.a.6 Dekon modul 1.2. DINI FITRIANI.pdf
 
SKPM Kualiti @ Sekolah 23 Feb 22222023.pptx
SKPM Kualiti @ Sekolah 23 Feb 22222023.pptxSKPM Kualiti @ Sekolah 23 Feb 22222023.pptx
SKPM Kualiti @ Sekolah 23 Feb 22222023.pptx
 
PPT IPS Geografi SMA Kelas X_Bab 5_Atmosfer.pptx_20240214_193530_0000.pdf
PPT IPS Geografi SMA Kelas X_Bab 5_Atmosfer.pptx_20240214_193530_0000.pdfPPT IPS Geografi SMA Kelas X_Bab 5_Atmosfer.pptx_20240214_193530_0000.pdf
PPT IPS Geografi SMA Kelas X_Bab 5_Atmosfer.pptx_20240214_193530_0000.pdf
 
PRESENTASI PEMBELAJARAN IPA PGSD UT MODUL 2
PRESENTASI PEMBELAJARAN IPA PGSD UT MODUL 2PRESENTASI PEMBELAJARAN IPA PGSD UT MODUL 2
PRESENTASI PEMBELAJARAN IPA PGSD UT MODUL 2
 
Modul Ajar Matematika Kelas 2 Fase A Kurikulum Merdeka
Modul Ajar Matematika Kelas 2 Fase A Kurikulum MerdekaModul Ajar Matematika Kelas 2 Fase A Kurikulum Merdeka
Modul Ajar Matematika Kelas 2 Fase A Kurikulum Merdeka
 
Modul Ajar Bahasa Indonesia - Menulis Puisi Spontanitas - Fase D.docx
Modul Ajar Bahasa Indonesia - Menulis Puisi Spontanitas - Fase D.docxModul Ajar Bahasa Indonesia - Menulis Puisi Spontanitas - Fase D.docx
Modul Ajar Bahasa Indonesia - Menulis Puisi Spontanitas - Fase D.docx
 
adap penggunaan media sosial dalam kehidupan sehari-hari.pptx
adap penggunaan media sosial dalam kehidupan sehari-hari.pptxadap penggunaan media sosial dalam kehidupan sehari-hari.pptx
adap penggunaan media sosial dalam kehidupan sehari-hari.pptx
 
Teknik Menjawab Kertas P.Moral SPM 2024.pptx
Teknik Menjawab Kertas P.Moral SPM  2024.pptxTeknik Menjawab Kertas P.Moral SPM  2024.pptx
Teknik Menjawab Kertas P.Moral SPM 2024.pptx
 

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

  • 1. Mobile Game Developer War 4: Online Camp MGDW4 Online Camp #1 Pengenalan J2ME, Eclipse, dan Game Canvas
  • 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. 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. Mobile Game Developer War 4: Online Camp
  • 5. Mobile Game Developer War 4: Online Camp Workspace Eclipse 1. Project Explorer 4. Console and debugger 2. Work here! 5. Eclipse Menu and Toolbars 3. Class explorer
  • 6. Mobile Game Developer War 4: Online Camp Menambahkan 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. Mobile Game Developer War 4: Online Camp Klik Manual Install (atau Import)…
  • 8. Mobile Game Developer War 4: Online Camp Browse ke folder dimana kita menyimpan Emulatornya. Lalu tekan finish, tunggu beberapa saat, nanti akan muncul seperti ini. Lalu tekan OK untuk menutup Preferences
  • 9. Mobile Game Developer War 4: Online Camp Membuat MIDlet Project baru
  • 10. Mobile Game Developer War 4: Online Camp Buat MIDlet dalam project MIDlet adalah class utama yang akan dijalankan oleh aplikasi J2ME
  • 11. Mobile Game Developer War 4: Online Camp Fill detail for MIDlet Form tersebut adalah: • Package, mendefinisikan package dari midlet kita nanti • Name, nama file midlet • Modifiers, mendefinisikan modifiers pada file midlet tersebut • Superclass, mendefinisikan midlet tersebut akan inheritance terhadap class apa • Interface, jika file yang kita buat akan implements terhadap suatu interface
  • 12. Mobile Game Developer War 4: Online Camp Standar file MIDlet 1. TebakAngka() merupakan konstruktor 2. startApp(), fungsi yang pertama kali dijalankan 3. pauseApp(), fungsi yang dijalankan ketika game dipause 4. destroyApp(), fungsi yang dijalankan ketika game akan diberhentikan
  • 13. Mobile Game Developer War 4: Online Camp Kode awal KERANGKA MIDLET DAN GAMECANVAS
  • 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. Mobile Game Developer War 4: Online Camp Running Project Klik kanan pada project yang ingin di running, lalu Run As > Emulated Java ME MIDlet
  • 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. 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. Mobile Game Developer War 4: Online Camp Buat GameCanvas • File>New>Class – Set superclass – Add interface
  • 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. Mobile Game Developer War 4: Online Camp Struktur 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. Mobile Game Developer War 4: Online Camp Game Loop public 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. Mobile Game Developer War 4: Online Camp Layar Device Terdapat 2 jenis layar pada device, yaitu: • Landscape, dimana lebar > tinggi layar • Portrait, dimana tinggi > lebar layar
  • 23. Mobile Game Developer War 4: Online Camp Cartesian system on Device
  • 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. 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. 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. 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