• Tidak ada hasil yang ditemukan

Penggambaran Kelas

Dalam dokumen Membangun aplikasi game Farming Life (Halaman 54-57)

3.3 Analisis Sistem

3.3.7 Analisis Kebutuhan Fungsional

3.3.7.3 Penggambaran Kelas

Kelas digambarkan dengan class diagram.Diagram kelas atau classdiagram

menggambarkan struktur sistem dari segi pendefinisian kelas-kelas yang akan dibuat untuk membangun sistem. Kelas memiliki apa yang disebut atribut dan metode atau operasi.Class diagram ditunjukan pada Gambar 3.9.Pendefinisian kelas ditunjukan pada Tabel 3.13.

Tabel 3.13 Definisi Class

Jenis Class Nama Class

Boundary Main Intro Field Town01 Town02 Tsquare Beach Control Hero TextBar Main Entity SaveSlot

Town01

< < boundary> > + boolean f ront + boolean back + int event Dialog + int npc + int CLOSE + . . . + Town01() + public void act () + public void addCharact ers() + public void dist ance() + public void event s() + void t ot alHarga()

Field

< < boundary> > + boolean f ront + boolean back + int event Dialog + int npc + int CLOSE + . . . + Field() + public void act () + public void addCharact ers() + public void dist ance() + public void event s() + public void cont rolMenuGame() + public void plant () + public void cuaca() + public void loadFarm() + public void f arm()

Town02

< < boundary> > + boolean f ront + boolean back + int event Dialog + int npc + int CLOSE + . . . + Town02() + public void act () + public void addCharact ers() + public void dist ance() + public void event s()

TSquare

< < boundary> > + boolean f ront + boolean back + int event Dialog + int npc + int CLOSE + . . . + TSquare() + public void act () + public void addCharact ers() + public void event s() + public void dist ance()

Beach

< < boundary> > + boolean f ront + boolean back + int event Dialog + int npc + int CLOSE + . . . + Beach() + public void act () + public void addCharact ers() + public void dist ance() + public void event s()

Main

< < boundary> >

+ Main() + void act () + void pilihMenuUt ama()

I nt ro

< < boundary> > -Kot akNama KN + Text Bar Text + st at ic boolean hapus + I nt ro() + void act () + void kot akNama()

Port al

+ Port al(int port al)

Sprit e

+ void set Animat ion(Animat ion newAnim) + Animat ion get Animat ion() + int get Height () + int get Widt h() + boolean isNear(Class clss) + boolean canSee(Class clss) + boolean canLook(Class clss) Hero < < cont rol> > + Hero()

+ st at ic void init ializeI mages() + void act ()

+ void cont rols() + void runRight () + void runLef t () + void runUp() + void runDown() + void colRight () + void colLef t () + void colDown() + void colUp() + void side() + void t ravel() + void dist ance() + void wait Time() + void changeI t ems() + void changeTools() Ot her + Ot her(int obj) House + House(int house) Flower + Flower(int f lower) Tree + Tree(int t ree) Fence + Fence() Text Bar + St ring Value + St ring I nt ro1 + St ring I nt ro2 + . . . + Text Bar() + void act () + void Draw() + void Writ e() + void set Page() + void changePage() + void changeDialog() + void t ime() + void cont rols()

Anim at ion

+ st at ic f inal int DEFAULT_DURATI ON + ArrayList < Greenf oot I mage> images + int act Count

+ int currI mage + int imageDurat ion + Animat ion()

+ void addI mage(Greenf oot I mage img) + Greenf oot I mage get I mage() + void updat e() + boolean isFinished()

+ void set I mageDurat ion(int perI mageCount ) + int get I mageDurat ion()

+ int get I mageCount () + void reset () + St ring t oSt ring()

Sound

+ st at ic void play(int music, int volume) + st at ic void st op()

Creat

-int Speed -int delt aX -int delt aY -Ant Hill home + Creat ure()

+ void set HomeHill(Ant Hill home + Ant Hill get HomeHill() + void walkTowardsHome() + void walkAwayFromHome() + void headTowards(Act or t arg + void walk()

+ void headRoughlyTowards(Ac -int comput eHomeDelt a(boolean -int adjust Speed(int speed) -int capSpeed(int speed) + boolean randomChance(int pe + boolean canSee(Class clss)

Ant

-st at ic f inal int MAX_PH_LEVEL -st at ic f inal int PH_TI ME -boolean carryingFood -int pheromoneLevel -int f oundLast Pheromone + Greenf oot I mage ant + st at ic boolean hide + Ant (Ant Hill home) + void act () + void searchForFood() + void checkHome() + boolean at Home() + void checkFood() + void t akeFood(Food f ood) + void dropFood() + void handlePheromoneDrop() + boolean smellPheromone() + void walkTowardsPheromone() + void checkGet Food() + void removeAnt ()

Ant Hill

+ st at ic boolean act ive + st at ic int ant s -int maxAnt s -Count er f oodCount er -int f ood -int t arget + Greenf oot I mage ah + st at ic boolean hide + Ant Hill()

+ Ant Hill(int numberOf Ant s) + void act ()

+ void count Food() + void sebarSemut () + void checkTarget ()

Pherom one

-f inal st at ic int MAX_I NTENS -int int ensit y

+ st at ic boolean hide St at us + st at ic int MAXSTAMI NA + st at ic int STAMI NA + st at ic int COI N + st at ic boolean SLEEP + void act () + void drawSt at us() + void kurangKoin()

Object Menu

+ int MENUGAME + void drawObject (St ring menu)

Cuaca

+ int y, t , orig + double x, inc + st at ic boolean hapus + Cuaca(int dist ance) + void act () NPC01 + NPC01() NPC02 + NPC02() CTools + st at ic int alat + st at ic int barang + int x, y + CTools() + void act () Message

+ void drawMessage(St ring m)

Kot akNam a + St ring key + st at ic St ring Nama + Kot akNama() + void act () + void t ampilNama() + void cekMasukan() Tim e + st at ic boolean t ime + st at ic boolean sleep + st at ic boolean BONUS + St ring dayName + St ring mont hName + void act () + void mark() + int millisElapsed() + void t imeSt art () + void t imeI mage()

Rat ingGam e

+ st at ic int RG -int MAX + void act () + void point I mage() + void hit ungRat ing()

SaveSlot

+ st at ic boolean savemenu + SaveSlot () + void act () + File chooseFile() + void f ileI nf o()

+ boolean makeFolder(St ring f olderName) + void creat eDat a(St ring dat aName) + void remove()

BAB 4

BAB 5

BAB 6

BAB 7

BAB 8

Dalam dokumen Membangun aplikasi game Farming Life (Halaman 54-57)

Dokumen terkait