Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # =============================================================================
- # TheoAllen - Idle Sprite
- # Version : 0.9
- # Contact : www.rpgmakerid.com (or) http://theolized.blogspot.com
- # (This script documentation is written in informal indonesian language)
- # =============================================================================
- ($imported ||= {})[:Theo_IdleSprite] = true
- # =============================================================================
- # CHANGE LOGS:
- # -----------------------------------------------------------------------------
- # 2013.08.12 - Finished script (with glitch)
- # =============================================================================
- =begin
- Perkenalan :
- Script ini berfungsi untuk menambahkan idle sprite jika player tidak bergerak
- selama sekian waktu
- Cara penggunaan :
- Pasang dibawah material namun diatas main.
- Pastikan kamu mempunyai gambar sprite dengan tambahan "_idle" dibelakang nama
- sprite berjalan yg kamu pake buat actor
- Terms of Use :
- Credit gw, TheoAllen. Kalo semisal u bisa ngedit2 script gw trus jadi lebih
- keren, terserah. Ane bebasin. Asal ngga ngeklaim aja. Kalo semisal mau
- dipake buat komersil, jangan lupa, gw dibagi gratisannya.
- =end
- # =============================================================================
- # Konfigurasi
- # =============================================================================
- module THEO
- module Idle
- Count_Delay = 150
- Anim_Speed = 0.5
- end
- end
- # =============================================================================
- # Akhir dari konfigurasi
- # =============================================================================
- class Game_Player < Game_Character
- alias theo_idle_init initialize
- def initialize
- theo_idle_init
- init_idle_member
- end
- def init_idle_member
- refresh_idle_members
- clear_idle
- end
- alias theo_idle_refresh refresh
- def refresh
- theo_idle_refresh
- refresh_idle_members
- end
- def refresh_idle_members
- @ori_charname = @character_name
- @ori_index = @character_index
- @ori_dir = @direction
- @idle_charname = @character_name + "_idle"
- @idle_index = 0
- end
- def clear_idle(ext = true)
- @idle_count = 0
- if ext
- @direction = @ori_dir
- else
- @step_anime = false
- end
- if idle_sprite?
- set_graphic(@ori_charname, @ori_index)
- end
- end
- alias theo_idle_update update
- def update
- theo_idle_update
- update_idle
- end
- def idle_sprite?
- @character_name != @ori_charname
- end
- def non_idle_sprite?
- @character_name != @idle_charname
- end
- def idle?
- @idle_count >= THEO::Idle::Count_Delay
- end
- def update_idle
- @idle_count += 1
- if $game_map.interpreter.running?
- clear_idle
- elsif idle?
- if non_idle_sprite?
- set_idle_anim
- end
- end
- end
- def set_idle_anim
- @ori_dir = @direction
- @direction = 2
- @step_anime = true
- set_graphic(@idle_charname, @idle_index)
- end
- alias theo_idle_move_straight move_straight
- def move_straight(d, turn_ok = true)
- theo_idle_move_straight(d, turn_ok = true)
- clear_idle(false)
- end
- alias theo_idle_rmove_speed real_move_speed
- def real_move_speed
- return THEO::Idle::Anim_Speed if idle?
- return theo_idle_rmove_speed
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment