Pembuatan Game Fruit Entrepreneur Dengan Menggunakan Engine RPG Maker VX Ace

  LAMPIRAN : LISTING PROGRAM

1. Modules

a. Modul Vocab

  Modul ini mendefinisikan persyaratan dan pesan dari beberapa data sebagai konstan Variabel.

  # Shop Screen ShopBuy = "Beli" ShopSell = "Jual" ShopCancel = "Batal" Possession = "Dimiliki" # Status Screen ExpTotal = "Current Exp" ExpNext = "To Next %s" # Save/Load Screen SaveMessage = "Disimpan di mana?" LoadMessage = "Lanjutkan yang mana?" File = "Data" # Display when there are multiple members PartyName = "%s's Party" # Basic Battle Messages Emerge = "%s emerged!" Preemptive = "%s got the upper hand!"

  Surprise = "%s was surprised!" EscapeStart = "%s has started to escape!" EscapeFailure = "However, it was unable to escape!" # Battle Ending Messages Victory = "%s was victorious!" Defeat = "%s was defeated." ObtainExp = "%s EXP received!" ObtainGold = "%s\\G found!" ObtainItem = "%s found!" LevelUp = "%s is now %s %s!" ObtainSkill = "%s learned!" # Use Item UseItem = "%s uses %s!" # Critical Hit CriticalToEnemy = "An excellent hit!!" CriticalToActor = "A painful blow!!" # Results for Actions on Actors ActorDamage = "%s took %s damage!" ActorRecovery = "%s recovered %s %s!" ActorGain = "%s gained %s %s!" ActorLoss = "%s lost %s %s!" ActorDrain = "%s was drained of %s %s!" ActorNoDamage = "%s took no damage!" ActorNoHit = "Miss! %s took no damage!" # Results for Actions on Enemies EnemyDamage = "%s took %s damage!"

  EnemyRecovery = "%s recovered %s %s!" EnemyGain = "%s gained %s %s!" EnemyLoss = "%s lost %s %s!" EnemyDrain = "Drained %s %s from %s!" EnemyNoDamage = "%s took no damage!" EnemyNoHit = "Missed! %s took no damage!" # Evasion/Reflection Evasion = "%s evaded the attack!" MagicEvasion = "%s nullified the magic!" MagicReflection = "%s reflected the magic!" CounterAttack = "%s counterattacked!" Substitute = "%s protected %s!" # Buff/Debuff BuffAdd = "%s's %s went up!" DebuffAdd = "%s's %s went down!" BuffRemove = "%s's %s returned to normal." # Skill or Item Had No Effect ActionFailure = "There was no effect on %s!" # Error Message PlayerPosError = "Player's starting position is not set." EventOverflow = "Common event calls exceeded the limit." # Basic Status def self.basic(basic_id) $data_system.terms.basic[basic_id] end

  # Parameters def self.param(param_id) $data_system.terms.params[param_id] end # Equip Type def self.etype(etype_id) $data_system.terms.etypes[etype_id] end # Commands def self.command(command_id) $data_system.terms.commands[command_id] end # Currency Unit def self.currency_unit $data_system.currency_unit end # def self.level; basic(0); end # Level def self.level_a; basic(1); end # Level (short) def self.hp; basic(2); end # HP def self.hp_a; basic(3); end # HP (short) def self.mp; basic(4); end # MP def self.mp_a; basic(5); end # MP (short) def self.tp; basic(6); end # TP def self.tp_a; basic(7); end # TP (short) def self.fight; command(0); end # Fight def self.escape; command(1); end # Escape def self.attack; command(2); end # Attack def self.guard; command(3); end # Guard def self.item; command(4); end # Items def self.skill; command(5); end # Skills def self.equip; command(6); end # Equip def self.status; command(7); end # Status def self.formation; command(8); end # Change Formation def self.save; command(9); end # Save def self.game_end; command(10); end # Exit Game def self.weapon; command(12); end # Weapons def self.armor; command(13); end # Armor def self.key_item; command(14); end # Key Items def self.equip2; command(15); end # Change Equipment def self.optimize; command(16); end # Ultimate Equipment def self.clear; command(17); end # Remove All def self.new_game; command(18); end # New Game def self.continue; command(19); end # Continue def self.shutdown; command(20); end # Shut Down def self.to_title; command(21); end # Go to Title def self.cancel; command(22); end # Cancel # end

b. Module Sound

  Module Sound ini memainkan efek suara. Diperoleh dengan efek suara yang ditentukan dalam Database dari $ data_system, dan memainkan mereka.

  # System Sound Effect def self.play_system_sound(n) $data_system.sounds[n].play end

  # Cursor Movement def self.play_cursor play_system_sound(0) end # Decision def self.play_ok play_system_sound(1) end # Cancel def self.play_cancel play_system_sound(2) end # Buzzer def self.play_buzzer play_system_sound(3) end # Equip def self.play_equip play_system_sound(4) end # Save def self.play_save play_system_sound(5) end

  # Load def self.play_load play_system_sound(6) end # Battle Start def self.play_battle_start play_system_sound(7) end # Escape def self.play_escape play_system_sound(8) end # Enemy Attack def self.play_enemy_attack play_system_sound(9) end # Enemy Damage def self.play_enemy_damage play_system_sound(10) end # Enemy Collapse def self.play_enemy_collapse play_system_sound(11) end # Boss Collapse 1 def self.play_boss_collapse1 play_system_sound(12) end # Boss Collapse 2 def self.play_boss_collapse2 play_system_sound(13) end # Actor Damage def self.play_actor_damage play_system_sound(14) end # Actor Collapse def self.play_actor_collapse play_system_sound(15) end # Recovery def self.play_recovery play_system_sound(16) end # Miss def self.play_miss play_system_sound(17) end # Evasion def self.play_evasion

play_system_sound(18) end # Magic Evasion def self.play_magic_evasion play_system_sound(19) end # Magic Reflection def self.play_reflection play_system_sound(20) end # Shop def self.play_shop play_system_sound(21) end # Use Item def self.play_use_item play_system_sound(22) end # Use Skill def self.play_use_skill play_system_sound(23) end

c. Module Cache

  Modul ini memuat masing-masing grafis, membuat objek bitmap, dan mempertahankannya. Modul ini dibuat untuk mempercepat load dan menghemat memori. def self.animation(filename, hue) load_bitmap("Graphics/Animations/", filename, hue) end # # * Get Battle Background (Floor) Graphic # def self.battleback1(filename) load_bitmap("Graphics/Battlebacks1/", filename) end # # * Get Battle Background (Wall) Graphic # def self.battleback2(filename) load_bitmap("Graphics/Battlebacks2/", filename) end # # * Get Battle Graphic # def self.battler(filename, hue) load_bitmap("Graphics/Battlers/", filename, hue) end # # * Get Character Graphic # def self.character(filename) load_bitmap("Graphics/Characters/", filename) end # # * Get Face Graphic # def self.face(filename) load_bitmap("Graphics/Faces/", filename) end # # * Get Parallax Background Graphic # def self.parallax(filename) load_bitmap("Graphics/Parallaxes/", filename) end # # * Get Picture Graphic # def self.picture(filename) load_bitmap("Graphics/Pictures/", filename) end # # * Get System Graphic # def self.system(filename) load_bitmap("Graphics/System/", filename) end # # * Get Tileset Graphic # def self.tileset(filename) load_bitmap("Graphics/Tilesets/", filename) end

  # # * Get Title (Background) Graphic # def self.title1(filename) load_bitmap("Graphics/Titles1/", filename) end # # * Get Title (Frame) Graphic # def self.title2(filename) load_bitmap("Graphics/Titles2/", filename) end # # * Load Bitmap # def self.load_bitmap(folder_name, filename, hue = 0) @cache ||= {} if filename.empty? empty_bitmap elsif hue == 0 normal_bitmap(folder_name + filename) else hue_changed_bitmap(folder_name + filename, hue) end end # # * Create Empty Bitmap # def self.empty_bitmap Bitmap.new(32, 32) end

  # # * Create/Get Normal Bitmap # def self.normal_bitmap(path) @cache[path] = Bitmap.new(path) unless include?(path) @cache[path] end # # * Create/Get Hue-Changed Bitmap # def self.hue_changed_bitmap(path, hue) key = [path, hue] unless include?(key) @cache[key] = normal_bitmap(path).clone @cache[key].hue_change(hue) end @cache[key] end # # * Check Cache Existence # def self.include?(key) @cache[key] && !@cache[key].disposed? end # # * Clear Cache # def self.clear @cache ||= {} @cache.clear GC.start end end

2. Game Objects

a. Class Game_Temp Kelas ini menangani data sementara yang tidak termasuk dengan data simpan.

  Contoh kelas ini direferensikan oleh $ game_temp. attr_reader :common_event_id # Common Event ID attr_accessor :fade_type # Fade Type at Player Transfer # # * Object Initialization # def initialize @common_event_id = 0 @fade_type = 0 end # # * Reserve Common Event Call # def reserve_common_event(common_event_id) @common_event_id = common_event_id end # # * Clear Common Event Call Reservation # def clear_common_event @common_event_id = 0 end

  # # * Determine Reservation of Common Event Call # def common_event_reserved? @common_event_id > 0 end # # * Get Reserved Common Event # def reserved_common_event $data_common_events[@common_event_id] end end

b. Class Game_Switches

  Kelas ini menangani Switch yang disusun berdasarkn ‘Array’. def initialize @data = [] end # # * Get Switch # def [](switch_id) @data[switch_id] || false end # # * Set Switch # value : ON (true) / OFF (false) # def []=(switch_id, value) @data[switch_id] = value on_change end # # * Processing When Setting Switches # def on_change $game_map.need_refresh = true end end

3. Sprites

a. Class Spirte_Base Kelas untuk menambahkan animasi sprite.

  class Sprite_Base < Sprite # # * Class Variable # @@ani_checker = [] @@ani_spr_checker = [] @@_reference_count = {} # # * Object Initialization # def initialize(viewport = nil) super(viewport) @use_sprite = true # Sprite use flag

  @ani_duration = 0 # Remaining time of animation end # # * Free # def dispose super dispose_animation end # # * Frame Update # def update super update_animation @@ani_checker.clear @@ani_spr_checker.clear end # # * Determine if animation is being displayed # def animation? @animation != nil end # # * Start Animation # def start_animation(animation, mirror = false) dispose_animation @animation = animation if @animation

  @ani_mirror = mirror set_animation_rate @ani_duration = @animation.frame_max * @ani_rate + 1 load_animation_bitmap make_animation_sprites set_animation_origin end end # # * Set Animation Speed # def set_animation_rate @ani_rate = 4 # Fixed value by default end # # * Read (Load) Animation Graphics # def load_animation_bitmap animation1_name = @animation.animation1_name animation1_hue = @animation.animation1_hue animation2_name = @animation.animation2_name animation2_hue = @animation.animation2_hue @ani_bitmap1 = Cache.animation(animation1_name, animation1_hue) @ani_bitmap2 = Cache.animation(animation2_name, animation2_hue) if @@_reference_count.include?(@ani_bitmap1) @@_reference_count[@ani_bitmap1] += 1 else @@_reference_count[@ani_bitmap1] = 1 end if @@_reference_count.include?(@ani_bitmap2) @@_reference_count[@ani_bitmap2] += 1 else @@_reference_count[@ani_bitmap2] = 1 end Graphics.frame_reset end # # * Create Animation Spirtes # def make_animation_sprites @ani_sprites = [] if @use_sprite && !@@ani_spr_checker.include?(@animation) 16.times do sprite = ::Sprite.new(viewport) sprite.visible = false @ani_sprites.push(sprite) end if @animation.position == 3 @@ani_spr_checker.push(@animation) end end @ani_duplicated = @@ani_checker.include?(@animation) if !@ani_duplicated && @animation.position == 3 @@ani_checker.push(@animation) end end # # * Set Animation Origin # def set_animation_origin if @animation.position == 3 if viewport == nil

  @ani_ox = Graphics.width / 2 @ani_oy = Graphics.height / 2 else @ani_ox = viewport.rect.width / 2 @ani_oy = viewport.rect.height / 2 end else @ani_ox = x - ox + width / 2 @ani_oy = y - oy + height / 2 if @animation.position == 0 @ani_oy -= height / 2 elsif @animation.position == 2 @ani_oy += height / 2 end end end # # * Free Animation # def dispose_animation if @ani_bitmap1 @@_reference_count[@ani_bitmap1] -= 1 if @@_reference_count[@ani_bitmap1] == 0 @ani_bitmap1.dispose end end if @ani_bitmap2 @@_reference_count[@ani_bitmap2] -= 1 if @@_reference_count[@ani_bitmap2] == 0 @ani_bitmap2.dispose end end if @ani_sprites @ani_sprites.each {|sprite| sprite.dispose } @ani_sprites = nil @animation = nil end @ani_bitmap1 = nil @ani_bitmap2 = nil end # # * Update Animation # def update_animation return unless animation? @ani_duration -= 1 if @ani_duration % @ani_rate == 0 if @ani_duration > 0 frame_index = @animation.frame_max frame_index -= (@ani_duration + @ani_rate - 1) / @ani_rate animation_set_sprites(@animation.frames[frame_index]) @animation.timings.each do |timing| animation_process_timing(timing) if timing.frame == frame_index end else end_animation end end end # # * End Animation #

def end_animation dispose_animation end # # * Set Animation Sprite # frame : Frame data (RPG::Animation::Frame) # def animation_set_sprites(frame) cell_data = frame.cell_data @ani_sprites.each_with_index do |sprite, i| next unless sprite pattern = cell_data[i, 0] if !pattern || pattern < 0 sprite.visible = false next end sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2 sprite.visible = true sprite.src_rect.set(pattern % 5 * 192, pattern % 100 / 5 * 192, 192, 192) if @ani_mirror sprite.x = @ani_ox - cell_data[i, 1] sprite.y = @ani_oy + cell_data[i, 2] sprite.angle = (360 - cell_data[i, 4]) sprite.mirror = (cell_data[i, 5] == 0) else sprite.x = @ani_ox + cell_data[i, 1] sprite.y = @ani_oy + cell_data[i, 2] sprite.angle = cell_data[i, 4] sprite.mirror = (cell_data[i, 5] == 1) end

sprite.z = self.z + 300 + i sprite.ox = 96 sprite.oy = 96 sprite.zoom_x = cell_data[i, 3] / 100.0 sprite.zoom_y = cell_data[i, 3] / 100.0 sprite.opacity = cell_data[i, 6] * self.opacity / 255.0 sprite.blend_type = cell_data[i, 7] end end # # * SE and Flash Timing Processing # timing : Timing data (RPG::Animation::Timing) # def animation_process_timing(timing) timing.se.play unless @ani_duplicated case timing.flash_scope when 1 self.flash(timing.flash_color, timing.flash_duration * @ani_rate) when 2 if viewport && !@ani_duplicated viewport.flash(timing.flash_color, timing.flash_duration * @ani_rate) end when 3 self.flash(nil, timing.flash_duration * @ani_rate) end end end

a. Module Tambahan

a. HUD Energi

  Module ini membuat tampilan energy yang digunakan sebagai tolak ukur masa akrif pemain per hari. def self.init

  @use_hud = false @viewport = Viewport.new(0,0,544,416)

  @viewport.z = GAUGES_Z @sprite_bg = Sprite_Base.new(@viewport) @sprite_bg.z = GAUGES_Z @sprite_bg.bitmap = Bitmap.new(544,416) @sprite_b = Sprite_Base.new(@viewport) @sprite_b.z = GAUGES_Z+1 @sprite_b.bitmap = Bitmap.new(544,416) if GAUGE_IMAGES @hp_bg_bit = Cache.system(GAUGE_BG_HP)

  @mp_bg_bit = Cache.system(GAUGE_BG_MP) @hp_b_bit = Cache.system(GAUGE_HP) @mp_b_bit = Cache.system(GAUGE_MP)

  @tp_bg_bit = Cache.system(GAUGE_BG_TP) @tp_b_bit = Cache.system(GAUGE_TP)

  @xp_bg_bit = Cache.system(GAUGE_BG_XP) @tp_b_bit = Cache.system(GAUGE_XP) end

  @bg = Cache.system(BACKGROUND) unless BACKGROUND.nil? @hp = [] @mp = [] @maxhp = [] @maxmp = []

  @tp = [] @exp = [] @sprite_b.bitmap.font.name = FONT @sprite_b.bitmap.font.size = FONT_SIZE end def self.toggle @use_hud = !@use_hud if SceneManager.scene_is?(Scene_Map) if @use_hud self.update(true) else @sprite_b.bitmap.clear

  @sprite_bg.bitmap.clear end end end def self.change_actor(id) @actor = $game_actors[id] self.update if SceneManager.scene_is?(Scene_Map) end def self.use_hud return @use_hud end def self.load_hud(wat) @use_hud = wat end def self.actor return @actor.id end def self.clear @sprite_b.bitmap.clear @sprite_bg.bitmap.clear end def self.update(forced=false) unless forced return if not @use_hud return if not SceneManager.scene_is?(Scene_Map) return if not @actor return if (@actor.hp == @hp[@actor.id] and @actor.mp ==

  @mp[@actor.id] and @actor.mhp == @maxhp[@actor.id] and @actor.mmp == @maxmp[@actor.id] and @actor.tp == @tp[@actor.id] and @actor.exp == @exp[@actor.id]) end

  @hp[@actor.id] = @actor.hp @mp[@actor.id] = @actor.mp @maxhp[@actor.id] = @actor.mhp @maxmp[@actor.id] = @actor.mmp

  @tp[@actor.id] = @actor.tp @exp[@actor.id] = @actor.exp

  @sprite_b.bitmap.clear @sprite_bg.bitmap.clear rect_bg = Rect.new(BG_X,BG_Y,BG_WIDTH,BG_HEIGHT) if not @bg.nil? rect = Rect.new(0,0,@bg.width,@bg.height)

  @sprite_bg.bitmap.stretch_blt(rect_hp,@bg,rect,OPACITY) end

b. Module Gold_Map Module yang memunculkan jumlah uang di interface.

  def initialize super(0, 0, window_width, fitting_height(1)) refresh end # # * Get Window Width # def window_width return 160 end # # * Refresh # def refresh contents.clear draw_currency_value(value, currency_unit, 4, 0, contents.width - 8) end # # * Get Party Gold # def value $game_party.gold end # # Get Currency Unit

  # def currency_unit Vocab::currency_unit end # # * Open Window # def open refresh super end end

  

S U R A T K E T E R A N G A N

Hasil Uji Program Tugas Akhir

  Yang bertanda tangan di bawah ini, menerangkan bahwa Mahasiswa Tugas Akhir Program Diploma 3 Teknik Informatika:

  N a m a : M. RIZKY ZULKARNAIN N I M : 112406244 Program Studi : D-III TEKNIK INFORMATIKA Judul Tugas Akhir : PEMBUATAN GAME FRUIT ENTRPRENEUR

  DENGAN MENGGUNAKAN ENGINE RPG MAKER VX ACE Telah melaksanakan test program Tugas Akhir Mahasiswa tersebut di atas pada tanggal 2014.

  Dengan Hasil : Sukses / Gagal Demikian diterangkan untuk digunakan melengkapi syarat pendaftaran Ujian Meja Hijau Tugas Akhir Mahasiswa bersangkutan di Departemen Matematika FMIPA USU Medan.

  Medan, 2014 Dosen Pembimbing/Kepala Lab. Komputer, Drs. Partano Siagian M.Sc

  NIP. 195112271980031001

  

KEMENTERIAN PENDIDIKAN NASIONAL

UNIVERSITAS SUMATERA UTARA

FAKULTAS MATEMATIKA DAN ILMU PENGETAHUAN

ALAM

Jl. Bioteknologi No. 1 Kampus USU Telp. (061) 8211050 Fax. (061) 8214290 Medan-20155

Email

  

Kartu Bimbingan Tugas Akhir Mahasiswa

  Nama : M. Rizky Zulkarnain Nomor Induk Mahasiswa : 112406244 Judul Tugas Akhir : Pembuatan Game Fruit Entrepreneur Dengan

  Menggunkan Engine RPG Make Vx Ace Dosen Pembimbing : Drs. Partano Siagian M.Sc Tanggal Mulai Bimbingan : Agustus 2014 Tanggal Selesai Bimbingan : 2014

  Tanggal Asisten Pembahasan Pada Asistensi Paraf Dosen No

  Keterangan Bimbingan Mengenai, Pada Bab : Pembimbing

  1 Proposal Tugas Akhir

  2 Bab 1

  3 Bab 2

  4 Bab 3

  5 Bab 4

  6 Bab 5

  7 Pengujian Program

  • Kartu ini harap dikembalikan ke Departemen Matematika bila bimbingan Mahasiswa telah selesai.

  Diketahui, Disetujui,

  Ketua Program Studi D3 Teknik Informatika Pembimbing Utama/ FMIPA USU Penanggung Jawab Dr. Elly Rosmaini, M. Si Drs. Partano Siagian M.Sc NIP. 196005201985032002 NIP. 195112271980031001