8-Directional Movement
Versi: 1.0
Tipe: Movement
PengenalanLagi iseng gak ada kerjaan... Jadi males saat nge-script buat projek. Akhirnya jadi.
Script ini memungkinkan player bergerak ke 8 arah. Tambahannya Upper dan Lower Left/Right. Abis itu event juga bisa bergerak ke 8 arah saat pakai fungsi move route Random.
Fitur
- Player bisa bergerak ke-8 arah.
- Event bisa bergerak ke-8 arah.
ScreenshotsGak perlu.
DemoGak perlu.
ScriptsVersion : 1.0
- Code:
-
#==============================================================================
# [RGSS/2] 8-Directional Movement
# Version : 1.1
# Author : LowlingLife
#==============================================================================
# Membuat player dapat berjalan ke 8 arah yaitu secara diagonal. Script ini
# juga membuat event dapat berjalan ke-8 arah jika memakai Set Move Route
# 8.
#==============================================================================
# CHANGELOG :
# V. 1.0 | Original Release
# V. 1.1 | Cross Engine
#==============================================================================
module EightDir
# Set ke true jika ingin event dapat berjalan ke-8 arah saat Random di Set
# Move Route.
ALLOW_EVENT = true
end
#==============================================================================
# EDITING BEYOND THIS LINE CAN CAUSE DAMAGE TO YOUR GAME, THEREFORE EDIT
# WITH YOUR OWN RISK.
#==============================================================================
VX = defined?(Window_ActorCommand)
dir1 = VX ? "move_by_input" : "update"
dir2 = VX ? "life_eight_dir_move" : "life_eight_dir_update"
dir3 = "unless moving? or $game_system.map_interpreter.running? or @move_route_forcing" if !VX
dir4 = "return unless movable?; return if $game_map.interpreter.running?" if VX
dir5 = "end" if !VX
#==============================================================================
# Game_Player
#==============================================================================
eval "
class Game_Player < Game_Character
#-----------------------------------------------------------------------------
# Update / Move by Input
#-----------------------------------------------------------------------------
alias #{dir2} #{dir1}
def #{dir1}
#{dir2}
#{dir3}
#{dir4}
case Input.dir8
when 1; move_lower_left
when 2; move_down
when 3; move_lower_right
when 4; move_left
when 6; move_right
when 7; move_upper_left
when 8; move_up
when 9; move_upper_right
end
#{dir5}
end
end#"
#==============================================================================
# Game_Character
#==============================================================================
class Game_Character
if EightDir::ALLOW_EVENT
#----------------------------------------------------------------------------
# Move Random
#----------------------------------------------------------------------------
def move_random
case rand(8)
when 0; move_down(false)
when 1; move_left(false)
when 2; move_right(false)
when 3; move_up(false)
when 4; move_upper_left
when 5; move_upper_right
when 6; move_lower_left
when 7; move_lower_right
end
end
end
end
http://pastebin.com/7xKThJ2V
Credits