Per 2016, RMID pindah ke RMID Discord (Invite link dihapus untuk mencegah spambot -Theo @ 2019). Posting sudah tidak bisa dilakukan lagi.
Mohon maaf atas ketidaknyamanannya dan mohon kerjasamanya.
|
|
| [VX]Tower of Hanoi Minigame | |
| 2011-05-10, 11:04 | [VX]Tower of Hanoi Minigame |
---|
hart Senior
Posts : 805 Thanked : 38 Engine : Other Skill : Very Beginner Type : Developer
| Minigame Menara Hanoi Versi: Gaje Tipe: Gaje PengenalanApa itu Menara Hanoi? Baca ini http://en.wikipedia.org/wiki/Tower_of_Hanoi atau tanya om Oscar. Ini saya kerjakan berdasarkan request dari om oscar kemarin. Maaf buru2 bikinnya jadi mungkin terlalu jelek dan mungkin juga ada bug. Fitur
- Bernostalgia pada masa kecil.
Screenshotstakada Demotakada Scripts - Code:
-
#=============================================================================== # * Minigame Tower of Hanoi #------------------------------------------------------------------------------- # Requested by om Oscar tercinta #------------------------------------------------------------------------------- # Cara pakai: # - Copas script ini ke atas main # - Panggil via event: # $scene = Scene_HanoiTower.new(jumlah_kotak, jumlah_tempat[, waktu]) # keterangan: # - jumlah_kotak maksimal 64, jumlah_tempat maksimal 8 # - kosongkan bagian waktu bila tidak ingin memakai waktu # - Variabel dengan ID yg ditentukan di bawah akan bernilai 1 jika menang, dan 2 # jika kalah (waktu habis) #------------------------------------------------------------------------------- module Hart module HanoiTower #------------------------------------------------------------------------------- # Konfigurasi #------------------------------------------------------------------------------- ICON_INDEX = 3 RESULT_VAR = 1 REMAINING_TIME_VAR = 2 #------------------------------------------------------------------------------- end end #=============================================================================== class Hanoi_Timer < Sprite attr_reader :time def initialize(x, y, time) super() self.visible = false if time < 0 @framecount = 0 @time = time self.x = x self.y = y self.z = 50 self.bitmap = Bitmap.new(544, 12) self.bitmap.font = Font.new("Arial", 12) end def update super() @framecount += 1 if @time >= 0 if @framecount >= 60 @time -= 1 if @time > 0 @framecount = 0 end self.bitmap.clear self.bitmap.draw_text(0, 0, 544, 12, "Time: " + @time.to_s) if @time >= 0 end end
class Hanoi_Pointer < Sprite attr_accessor :tempats attr_accessor :index attr_accessor :active def initialize(tempats) super() @tempats = tempats @active = true @index = 0 temp = Cache.system("IconSet.png") self.bitmap = Bitmap.new(24, 24) self.bitmap.blt(0, 0, temp, Rect.new((Hart::HanoiTower::ICON_INDEX % 16) * 24, (Hart::HanoiTower::ICON_INDEX / 16) * 24, 24, 24)) self.x = @tempats[@index].x - 10 self.y = 386 end def update super self.x = @tempats[@index].x - 10 self.y = 386 if active self.opacity = 255 else self.opacity = 128 end update_input end def update_input if @active if Input.repeat?(Input::RIGHT) Sound.play_cursor @index = (@index + 1) % @tempats.size elsif Input.repeat?(Input::LEFT) Sound.play_cursor @index = (@index - 1 + @tempats.size) % @tempats.size end end end end
class Hanoi_Block < Sprite attr_accessor :tempat attr_accessor :tempatpos attr_reader :size def initialize(size) super() @size = size @color = Color.new(rand(128) + 128, rand(128) + 128, rand(128) + 128) @tempat = nil @tempatpos = nil self.bitmap = Bitmap.new(size, 10) end def update super self.bitmap.fill_rect(0, 0, @size, 10, @color) self.x = @tempat.x - @size / 2 self.y = 380 - @tempatpos * 10 if @tempat != nil end end
class Hanoi_Tempat attr_accessor :blocks attr_reader :x def initialize(x) @x = x @blocks = [] end def push(block) @blocks.push(block) block.tempat = self block.tempatpos = self.height end def pop @blocks.pop end def height return @blocks.size end def empty? return @blocks.empty? end def top_smaller?(other) return false if empty? return true if other.empty? return @blocks[height - 1].size < other.blocks[other.height - 1].size end end
class Scene_HanoiTower < Scene_Base def initialize(jlh_kotak, jlh_tempat, waktu = -1) if jlh_kotak > 64 @jlh_kotak = 64 elsif jlh_kotak < 3 @jlh_kotak = 3 else @jlh_kotak = jlh_kotak end if jlh_tempat > 8 @jlh_tempat = 8 elsif jlh_tempat < 3 @jlh_tempat = 3 else @jlh_tempat = jlh_tempat end @waktu = waktu @blocks = [] @tempats = [] @timer = Hanoi_Timer.new(0, 0, @waktu) end def start for i in 0 ... @jlh_tempat @tempats[i] = Hanoi_Tempat.new((i * (544 / @jlh_tempat)) + (544 / @jlh_tempat) / 2) end for i in 0 ... @jlh_kotak @blocks[i] = Hanoi_Block.new((@jlh_kotak - i) * (100 / @jlh_kotak) + 5) @tempats[rand(@jlh_tempat)].push(@blocks[i]) end @pointer1 = Hanoi_Pointer.new(@tempats) @pointer2 = Hanoi_Pointer.new(@tempats) @pointer2.active = false @pointer2.visible = false end def update for block in @blocks block.update end if Input.trigger?(Input::C) if @pointer1.active if !@tempats[@pointer1.index].empty? Sound.play_decision @pointer2.index = @pointer1.index @pointer1.active = false @pointer2.visible = true @pointer2.active = true else Sound.play_buzzer end else if @tempats[@pointer1.index].top_smaller?(@tempats[@pointer2.index]) Sound.play_equip @tempats[@pointer2.index].push(@tempats[@pointer1.index].pop) @pointer2.active = false @pointer2.visible = false @pointer1.index = @pointer2.index @pointer1.active = true else Sound.play_buzzer end end elsif Input.trigger?(Input::B) if @pointer2.active Sound.play_cancel @pointer2.active = false @pointer2.visible = false @pointer1.active = true end end @pointer1.update @pointer2.update if win? $game_variables[Hart::HanoiTower::RESULT_VAR] = 1 $game_variables[Hart::HanoiTower::REMAINING_TIME_VAR] = @timer.time $scene = Scene_Map.new end if @waktu >= 0 && lose? $game_variables[Hart::HanoiTower::RESULT_VAR] = 2 $game_variables[Hart::HanoiTower::REMAINING_TIME_VAR] = @timer.time $scene = Scene_Map.new end @timer.update end def win? for tempat in @tempats return true if tempat.height == @jlh_kotak end return false end def lose? return @timer.time<= 0 end def terminate for block in @blocks next if block == nil block.dispose end @pointer1.dispose @pointer2.dispose @timer.dispose end end
CreditsTidak perlu credit bila tidak mau. Asalkan anda sopan dan menghargai sesama manusia
Terakhir diubah oleh hart tanggal 2011-05-10, 11:40, total 1 kali diubah |
| | | 2011-05-10, 11:15 | Re: [VX]Tower of Hanoi Minigame |
---|
nisamerica Living Skeleton
Posts : 1668 Thanked : 25 Engine : RMVX Skill : Very Beginner Type : Artist
Awards:
| Wogh, Tower of Hanoi, game yang addictive tapi kadang nyebelin Bisa di set per wadah maksimal tapi wadahnya cuma 2 ngga?? |
| | | 2011-05-10, 11:17 | Re: [VX]Tower of Hanoi Minigame |
---|
hart Senior
Posts : 805 Thanked : 38 Engine : Other Skill : Very Beginner Type : Developer
| - Quote :
Bisa di set per wadah maksimal tapi wadahnya cuma 2 ngga?? bisa |
| | | 2011-05-10, 11:22 | Re: [VX]Tower of Hanoi Minigame |
---|
nisamerica Living Skeleton
Posts : 1668 Thanked : 25 Engine : RMVX Skill : Very Beginner Type : Artist
Awards:
| Loh tunggu, kalo gitu ga bisa selesai kan? Ato gwa ketuker antara game lain? |
| | | 2011-05-10, 11:26 | Re: [VX]Tower of Hanoi Minigame |
---|
hart Senior
Posts : 805 Thanked : 38 Engine : Other Skill : Very Beginner Type : Developer
| @om merica: memang gk bisa selesai klo cuma 2 wadah, tapi kan anda yg tentuin berapa wadah sebagai pembuat gamenya, masa sih anda mau membiarkan pemain main yg gk mungkin diselesaikan? kalo ya, ya silahkan |
| | | 2011-05-10, 11:34 | Re: [VX]Tower of Hanoi Minigame |
---|
nisamerica Living Skeleton
Posts : 1668 Thanked : 25 Engine : RMVX Skill : Very Beginner Type : Artist
Awards:
| Kadang kepengen juga nyiksa player Bikin batasan aja biar ga disalahgunakan |
| | | 2011-05-10, 11:40 | Re: [VX]Tower of Hanoi Minigame |
---|
hart Senior
Posts : 805 Thanked : 38 Engine : Other Skill : Very Beginner Type : Developer
| @om merica: jangan donk.. script itu kan harus se-flexibel mungkin... Kan memang ada aja orang yg mau nyiksa player, yah biarlah dia berbuat begitu kalau memang mau tapi setelah dipikir-pikir oke deh sekarang udah dibatasi minimal 3 wadah dan minimal 3 kotak, untuk om merica tercinta |
| | | 2011-05-10, 11:55 | Re: [VX]Tower of Hanoi Minigame |
---|
nisamerica Living Skeleton
Posts : 1668 Thanked : 25 Engine : RMVX Skill : Very Beginner Type : Artist
Awards:
| Wah makasih Hart... Padahal ga ada niat buat masukin Hanoi ke game Cuma ngusul2 dan nyampah ga jelas gwa Bikin yg XP aja, sapa tau kepake |
| | | 2011-05-10, 12:20 | Re: [VX]Tower of Hanoi Minigame |
---|
Oscar Senior
Posts : 830 Thanked : 13 Engine : RMVX Skill : Beginner Type : Writer
| wah2 , dibikinin juga ternyata nda nyangka , padahal cuman tanya bisa atau enggak huheuehuehue thanks banget om hart +1 reppo |
| | | 2011-05-10, 13:02 | Re: [VX]Tower of Hanoi Minigame |
---|
hart Senior
Posts : 805 Thanked : 38 Engine : Other Skill : Very Beginner Type : Developer
| @om merica: macama~~ saya tau kok kalau anda cuma nyampah XP yach? coba dech macukin tuh script ke XP, capa tau isa @om oscar: ihihi, makacii banget wat cendol na |
| | | | Re: [VX]Tower of Hanoi Minigame |
---|
Sponsored content
| | | | | [VX]Tower of Hanoi Minigame | |
|
Similar topics | |
|
Similar topics | |
| |
Halaman 1 dari 1 | |
| Permissions in this forum: | Anda tidak dapat menjawab topik
| |
| |
Latest 10 Topics | [Web Novel] Gloria Infidelis 2016-11-17, 21:27 by LightNightKnight
[Announcement] Forum baru untuk RMID 2016-08-25, 16:39 by TheoAllen
Where I'm Wrong ? 2016-07-24, 16:10 by ReydVires
flakeheartnet's Resources part III 2016-07-08, 14:30 by flakeheartnet
Keira's Art Warehouse 2016-06-28, 19:27 by KeiraBlaze
Theo Core Time System + Bingung 2016-06-27, 16:24 by Lockin
Error Script, Maybe ? 2016-06-27, 16:20 by Lockin
Nusaimoe @ RMID Lounge 2016-06-21, 05:02 by Jihad Bagas
Call Random Battle 2016-06-15, 17:04 by Lockin
Flakeheartnet Resources Part II [come back gift] 2016-06-07, 15:51 by flakeheartnet
|
Statistics
|
Members: [ 4947 ]
Topics: [ 8258 ]
Posts: [ 112606 ]
Newest member: [ https://rmid.forumotion.net/u4968 ]
|
|
|
|
|
|