PrinceOfSorrow
15-01-2007, 06:47 PM
سلام عليكم ورحمة الله وبركاته ^__^
حبيت أقدم شي بسيط لمستخدمين برنامج RMXP :أفكر:
سكربت 1 :
التايتل الخاص متحرك في مقدمة
أولا يجب عليك وضع الاكواد فوق Main (وسميه اي اسم)
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ ◆タイトル画面演出 - KGC_TitleDirection◆
#_/----------------------------------------------------------------------------
#_/ タイトル画面に様々な演出を追加します。
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#==============================================================================
# ★ カスタマイズ項目 ★
#==============================================================================
module KGC
# ◆テストプレイでも表示
TD_TESTPLAY_SHOW = true
# ◆ロゴファイル(nil で解除)
# これを解除すると「ロゴ表示 SE」も無効
TD_LOGO_FILE = RPG::Cache.title("001-Title01.jpg")
# ◆ロゴ表示 SE (nil で解除)
# ファイル名表記 <例> TD_LOGO_SE = "start_logo"
# AudioFile表記 <例> TD_LOGO_SE = RPG::AudioFile.new("start_logo", 80, 100)
# の2方式に対応。
TD_LOGO_SE = nil
# ◆タイトル表示トランジション(nil で解除)
TD_TITLE_TRANSITION = "020-Flat01.png"
# ◆タイトル文字(配列の要素毎に1行)
TD_TITLE_TEXT = [
"Prince,Ordaz & EMPEROR",
] # ←この ] は消さないこと。
# ◆コマンドウィンドウの幅 【単位:ピクセル(px)】
TD_WINDOW_WIDTH = 256
# ◆ニューゲーム項目名
TD_COMMAND_NEWGAME = "New Game"
# ◆コンティニュー項目名
TD_COMMAND_CONTINUE = "Continue"
# ◆シャットダウン項目名
TD_COMMAND_SHUTDOWN = "Quit"
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
$imported = {} if $imported == nil
$imported["TitleDirection"] = true
#==============================================================================
# ■ Scene_Title
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
# 戦闘テストの場合
if $BTEST
battle_test
return
end
# データベースをロード
$data_actors = load_data("Data/Actors.rxdata")
$data_classes = load_data("Data/Classes.rxdata")
$data_skills = load_data("Data/Skills.rxdata")
$data_items = load_data("Data/Items.rxdata")
$data_weapons = load_data("Data/Weapons.rxdata")
$data_armors = load_data("Data/Armors.rxdata")
$data_enemies = load_data("Data/Enemies.rxdata")
$data_troops = load_data("Data/Troops.rxdata")
$data_states = load_data("Data/States.rxdata")
$data_animations = load_data("Data/Animations.rxdata")
$data_tilesets = load_data("Data/Tilesets.rxdata")
$data_common_events = load_data("Data/CommonEvents.rxdata")
$data_system = load_data("Data/System.rxdata")
# システムオブジェクトを作成
$game_system = Game_System.new
# タイトル BGM を演奏
$game_system.bgm_play($data_system.title_bgm)
# ME、BGS の演奏を停止
Audio.me_stop
Audio.bgs_stop
# タイトルロゴ表示処理
if KGC::TD_LOGO_FILE != nil && !$title_flag &&
(KGC::TD_TESTPLAY_SHOW || !$DEBUG)
# スプライト作成
@sprite = [Sprite.new, Sprite.new]
@sprite[0].bitmap = KGC::TD_LOGO_FILE
@sprite[1].bitmap = @sprite[0].bitmap
# ロゴ表示 SE 演奏
if KGC::TD_LOGO_SE != nil
if KGC::TD_LOGO_SE.is_a?(RPG::AudioFile)
$game_system.se_play(KGC::TD_LOGO_SE)
elsif KGC::TD_LOGO_SE.is_a?(String)
Audio.se_play("Audio/SE/" + KGC::TD_LOGO_SE)
end
end
# 表示位置を調整
@sprite[0].x = (640 - @sprite[0].bitmap.width) / 2 - 240
@sprite[1].x = (640 - @sprite[1].bitmap.width) / 2 + 240
@sprite[0].y = @sprite[1].y = (480 - @sprite[0].bitmap.height) / 2
# 完全透明
@sprite[0].opacity = @sprite[1].opacity = 0
# トランジション実行
Graphics.transition(0)
for i in 0..39
@sprite[0].x += 6
@sprite[1].x -= 6
@sprite[0].opacity += 4
@sprite[1].opacity += 4
Graphics.update
end
@sprite[0].opacity = 255
@sprite[1].opacity = 0
for i in 0..19
Graphics.update
end
# トランジション準備
Graphics.freeze
# スプライトを解放
@sprite[0].bitmap.dispose
@sprite[0].dispose
@sprite[1].dispose
# トランジション実行
Graphics.transition(20)
# トランジション準備
Graphics.freeze
end
# タイトルフラグを立てる
$title_flag = true
# タイトルグラフィックを作成
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
# タイトル文字を描画
@title_text = Sprite.new
@title_text.bitmap = Bitmap.new(640, 480)
@title_text.bitmap.font.name = "Poor Richard"
@title_text.bitmap.font.size = 35
@title_text.bitmap.font.bold = true
@title_text.bitmap.font.italic = true
y = 440 - 21 * KGC::TD_TITLE_TEXT.size
for i in 0...KGC::TD_TITLE_TEXT.size
text = KGC::TD_TITLE_TEXT[i]
@title_text.bitmap.font.color = Color.new(0, 32, 96)
if $imported["FrameShadowText"]
@title_text.bitmap.draw_frame_text(8, y, 640, 48, text, 1)
else
@title_text.bitmap.draw_text(8, y, 640, 48, text, 1)
end
@title_text.bitmap.font.color = Color.new(224, 0, 0)
if $imported["FrameShadowText"]
@title_text.bitmap.draw_frame_text(0, y - 8, 640, 48, text, 1)
else
@title_text.bitmap.draw_text(0, y - 8, 640, 48, text, 1)
end
y += 42
end
@title_text.opacity = 0
@title_text.z = 100
# コマンドウィンドウを作成
s = []
s[0] = KGC::TD_COMMAND_NEWGAME
s[1] = KGC::TD_COMMAND_CONTINUE
s[2] = KGC::TD_COMMAND_SHUTDOWN
@command_window = Window_Command.new(KGC::TD_WINDOW_WIDTH, s)
@command_window.opacity = 0
@command_window.back_opacity = 160
@command_window.contents_opacity = 0
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 480
# コンティニュー有効判定
# セーブファイルがひとつでも存在するかどうかを調べる
# 有効なら @continue_enabled を true、無効なら false にする
@continue_enabled = false
for i in 0..3
if FileTest.exist?("Save#{i+1}.rxdata")
@continue_enabled = true
end
end
# コンティニューが有効な場合、カーソルをコンティニューに合わせる
# 無効な場合、コンティニューの文字をグレー表示にする
if @continue_enabled
@command_window.index = 1
else
@command_window.disable_item(1)
end
# トランジション実行
if KGC::TD_TITLE_TRANSITION == nil
Graphics.transition
else
Graphics.transition(40, "Graphics/Transitions/" + KGC::TD_TITLE_TRANSITION)
end
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# コマンドウィンドウを解放
@command_window.dispose
# タイトルグラフィックを解放
@sprite.bitmap.dispose
@sprite.dispose
# タイトル文字を解放
if @title_text != nil
@title_text.bitmap.dispose
@title_text.dispose
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias update_KGC_TitleDirection update
def update
# タイトル文字を浮き出させる
if @title_text.opacity < 255
@title_text.opacity += 5
end
# 元の処理を実行
update_KGC_TitleDirection
# 何となくウィンドウを弄って遊ぶ
@command_window.y -= 4 if @command_window.y > 256
@command_window.opacity += 5
@command_window.contents_opacity += 5
end
#--------------------------------------------------------------------------
# ● ニューゲーム処理
#--------------------------------------------------------------------------
alias command_new_game_KGC_TitleDirection command_new_game
def command_new_game
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# BGMフェードアウト
Audio.bgm_fade(2000)
# 意味の無い演出
for i in 0..60
@sprite.x -= 32
@sprite.y -= 32
@sprite.zoom_x += 0.1
@sprite.zoom_y += 0.1
@sprite.opacity -= 5
@title_text.x -= 32
@title_text.y -= 32
@title_text.zoom_x += 0.1
@title_text.zoom_y += 0.1
@title_text.opacity -= 5
@command_window.y -= 5
@command_window.opacity -= 5
@command_window.contents_opacity -= 5
Graphics.update
end
# 決定 SE を一時消去
se_buf = $data_system.decision_se
$data_system.decision_se = nil
# 元の処理を実行
command_new_game_KGC_TitleDirection
# 決定 SE を戻す
$data_system.decision_se = se_buf
end
end
بعد ذلك أن أردت تغير الاسم اذهب لسطر 30
# ◆タイトル文字(配列の要素毎に1行)
TD_TITLE_TEXT = [
"Prince,Ordaz & EMPEROR",
] # ←この ] は消さないこと。
أما أن أردت تغير صورة أذهب لسطر 17
واكتب اسم صورة بالكامل مع صيغة من ملف Title
TD_LOGO_FILE = RPG::Cache.title("001-Title01.jpg")
السكربت 2 :
هذا سكربت يجعلك تقفز في للعبة ;)
مفيد جدا خصوصا أثناء عمل Dungeon مع أسرار
راح يفيد الجميع ^^
فقط أنسخ هذا السكربت وضعه في فوق main وسمه اي شي (jump_system مثلا)
#==============================================================================
# ■ WallJump Script
#------------------------------------------------------------------------------
# Enables jumping around the map
# Made by: Huitzilopoctli of rmxp.net as part of Interactive World
#------------------------------------------------------------------------------
# Press the A Input (ShiftKey) to jump
# The player will be able to jump over any passable tile, or any tile with a
# TerrainID the same as the JumpID
# The player must land on a passable tile without a solid event blocking it
# If the player can't jump the full 2 tiles, it will go 1 or, failing that, none
# To stop the player from jumping over a particular event, make the first
# command for the event a comment, containing this word: \Tall
# To create a 'tall' tile that will stop the player from jumping over it even if
# the tile below is jumpable, set the tile's id to not the JumpID or 0
# To lock the player's facing while moving, hold down CTRL
#==============================================================================
#==============================================================================
# ● Customisation
#==============================================================================
JumpID = 1 # The terrain ID of the tiles which can be jumped over
MaxJump = 2 # The longest jump that can be made by the player
#==============================================================================
# ● Game_Player
#==============================================================================
class Game_Player < Game_Character
# forces Game_Character's passable method to be used, so CTRL no longer makes
# the hero able to walk through walls
def passable?(x, y, d)
super(x, y, d)
end
def leap
# finds the increases to x & y for the current direction
xdir = (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
ydir = (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
# Ow!
unless $game_map.terrain_tag(@x + xdir, @y + ydir) == JumpID or
$game_map.passable?(@x + xdir, @y + ydir, @direction, self)
# make the player jump
route = RPG::MoveRoute.new
route.list.clear
route.list.push(RPG::MoveCommand.new(37))
route.list.push(RPG::MoveCommand.new(14, [0, 0]))
route.list.push(RPG::MoveCommand.new(38))
route.list.push(RPG::MoveCommand.new(0))
route.repeat = false
$game_player.force_move_route(route)
# shake the screen
$game_screen.start_shake(7, 7, 5)
# display an "Ouch!" message
$game_temp.message_text = "Ouch!"
return
end
# finds the jumpable distance
dist = jumpable_distance
# wall jump
if dist.between?(1, MaxJump - 1) and
!$game_map.passable?(@x + (dist + 1) * xdir, @y + (dist + 1) * ydir, @direction, self) and
!($game_map.terrain_tag(@x + (dist + 1) * xdir, @y + (dist + 1) * ydir) == JumpID)
# finds the reverse direction
bounce_dir = @direction == 2 ? 8 : (@direction == 4 ? 6 : (@direction == 6 ? 4 : 2))
# finds the wall-jump distance
b_dist = jumpable_distance(bounce_dir, MaxJump + 2, @x + dist * xdir, @y + dist * ydir)
# finds the additions to x and y made by the reverse direction
b_xdir = (bounce_dir == 6 ? 1 : bounce_dir == 4 ? -1 : 0)
b_ydir = (bounce_dir == 2 ? 1 : bounce_dir == 8 ? -1 : 0)
# create the move_route
route = RPG::MoveRoute.new
route.list.clear
route.list.push(RPG::MoveCommand.new(37))
# add the normal jump
route.list.push(RPG::MoveCommand.new(14, [xdir * dist, ydir * dist]))
# add the wall jump
route.list.push(RPG::MoveCommand.new(14, [b_xdir * b_dist, b_ydir * b_dist]))
route.list.push(RPG::MoveCommand.new(38))
route.list.push(RPG::MoveCommand.new(0))
route.repeat = false
$game_player.force_move_route(route)
return
end
# creates a route for a normal jump and forces the player to follow it
route = RPG::MoveRoute.new
route.list.clear
route.list.push(RPG::MoveCommand.new(37))
route.list.push(RPG::MoveCommand.new(14, [xdir * dist, ydir * dist]))
route.list.push(RPG::MoveCommand.new(38))
route.list.push(RPG::MoveCommand.new(0))
route.repeat = false
$game_player.force_move_route(route)
end
alias update_primary update
def update
# calls the normal update method
update_primary
# locks the facing if CTRL is pressed, else unlocks it
@direction_fix = Input.press?(Input::CTRL)
# leaps if Input::A is triggered
leap if Input.trigger?(Input::A) && !moving?
end
def jumpable_distance(dir = @direction, max_dist = MaxJump, x = @x, y = @y)
xdir = (dir == 6 ? 1 : dir == 4 ? -1 : 0)
ydir = (dir == 2 ? 1 : dir == 8 ? -1 : 0)
jumpable_tiles = []
for i in 0..max_dist
check_x = x + i * xdir
check_y = y + i * ydir
e = $game_map.events[$game_map.check_event(check_x, check_y)]
if e
if e.list[0].parameters[0] =~ "\Tall"
break
end
if not e.through
next
end
end
if $game_map.passable?(check_x, check_y, dir, self) or
$game_map.terrain_tag(check_x, check_y) == JumpID
jumpable_tiles.push(i)
end
end
jumpable_tiles.reverse.each do |i|
check_x = x + i * xdir
check_y = y + i * ydir
return i if $game_map.passable?(check_x, check_y, dir, self)
end
return 0
end
end
سكربت 3 :
المشي في أتجاهات8 + الجري (حسب تغير الرقم في سكربت)
فقط أردف هذه سكربت أيضا فوق main (وسميه أي اسم)
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ ◆ダッシュ&8方向移動 - KGC_Dash_8DirMove◆
#_/----------------------------------------------------------------------------
#_/ Dash & 8 traverse performance at the time of map movement are added.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#==============================================================================
# ★ カスタマイズ項目 ★
#==============================================================================
module KGC
# ◆Dash button
D8DM_DASH_BUTTON = Input::X
# ◆Dash speed
D8DM_DASH_SPEED = 4.3
# ◆Walking speed
D8DM_WALK_SPEED = 4
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
$imported = {} if $imported == nil
$imported["Dash_8DirMove"] = true
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :dash_permit # ダッシュ許可フラグ
attr_accessor :dir8_permit # 8方向移動許可フラグ
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_KGC_Dash_8DirMove initialize
def initialize
# 元の処理を実行
initialize_KGC_Dash_8DirMove
@dash_permit, @dir8_permit = true, true
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ローカル変数に移動中かどうかを記憶
last_moving = moving?
# 移動中、イベント実行中、移動ルート強制中、
# メッセージウィンドウ表示中のいずれでもない場合
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
# 向きを保存
direction = @direction
# 方向ボタンが押されていれば、その方向へプレイヤーを移動
if $game_system.dir8_permit
case Input.dir8
when 1 # 左下
move_left
move_down
# 向き固定でない場合
unless @direction_fix
# 右向きだった場合は左を、上向きだった場合は下を向く
@direction = (direction == 6 ? 4 : direction == 8 ? 2 : direction)
end
when 2 # 下
move_down
when 3 # 右下
move_down
move_right
# 向き固定でない場合
unless @direction_fix
# 左向きだった場合は右を、上向きだった場合は下を向く
@direction = (direction == 4 ? 6 : direction == 8 ? 2 : direction)
end
when 4 # 左
move_left
when 6 # 右
move_right
when 7 # 左上
move_up
move_left
# 向き固定でない場合
unless @direction_fix
# 右向きだった場合は左を、下向きだった場合は上を向く
@direction = (direction == 6 ? 4 : direction == 2 ? 8 : direction)
end
when 8 # 上
move_up
when 9 # 右上
move_right
move_up
# 向き固定でない場合
unless @direction_fix
# 左向きだった場合は右を、下向きだった場合は上を向く
@direction = (direction == 4 ? 6 : direction == 2 ? 8 : direction)
end
end
else
case Input.dir4
when 2
move_down
when 4
move_left
when 6
move_right
when 8
move_up
end
end
# ダッシュが許可されており、かつダッシュボタンが押されている場合
if $game_system.dash_permit && Input.press?(KGC::D8DM_DASH_BUTTON)
# ダッシュ速度に変更
@move_speed = KGC::D8DM_DASH_SPEED
else
# 歩行速度に変更
@move_speed = KGC::D8DM_WALK_SPEED
end
end
# ローカル変数に座標を記憶
last_real_x = @real_x
last_real_y = @real_y
super
# キャラクターが下に移動し、かつ画面上の位置が中央より下の場合
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
# マップを下にスクロール
$game_map.scroll_down(@real_y - last_real_y)
end
# キャラクターが左に移動し、かつ画面上の位置が中央より左の場合
if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
# マップを左にスクロール
$game_map.scroll_left(last_real_x - @real_x)
end
# キャラクターが右に移動し、かつ画面上の位置が中央より右の場合
if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
# マップを右にスクロール
$game_map.scroll_right(@real_x - last_real_x)
end
# キャラクターが上に移動し、かつ画面上の位置が中央より上の場合
if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
# マップを上にスクロール
$game_map.scroll_up(last_real_y - @real_y)
end
# 移動中ではない場合
unless moving?
# 前回プレイヤーが移動中だった場合
if last_moving
# 同位置のイベントとの接触によるイベント起動判定
result = check_event_trigger_here([1,2])
# 起動したイベントがない場合
if result == false
# デバッグモードが ON かつ CTRL キーが押されている場合を除き
unless $DEBUG and Input.press?(Input::CTRL)
# エンカウント カウントダウン
if @encounter_count > 0
@encounter_count -= 1
end
end
end
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# 同位置および正面のイベント起動判定
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end
end
end
صممت مثال لهذه الاكواد في المرفقات ;)
ووقتا ممتعا ^^
التحكم :
A : لركض
Z : للقفز
حبيت أقدم شي بسيط لمستخدمين برنامج RMXP :أفكر:
سكربت 1 :
التايتل الخاص متحرك في مقدمة
أولا يجب عليك وضع الاكواد فوق Main (وسميه اي اسم)
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ ◆タイトル画面演出 - KGC_TitleDirection◆
#_/----------------------------------------------------------------------------
#_/ タイトル画面に様々な演出を追加します。
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#==============================================================================
# ★ カスタマイズ項目 ★
#==============================================================================
module KGC
# ◆テストプレイでも表示
TD_TESTPLAY_SHOW = true
# ◆ロゴファイル(nil で解除)
# これを解除すると「ロゴ表示 SE」も無効
TD_LOGO_FILE = RPG::Cache.title("001-Title01.jpg")
# ◆ロゴ表示 SE (nil で解除)
# ファイル名表記 <例> TD_LOGO_SE = "start_logo"
# AudioFile表記 <例> TD_LOGO_SE = RPG::AudioFile.new("start_logo", 80, 100)
# の2方式に対応。
TD_LOGO_SE = nil
# ◆タイトル表示トランジション(nil で解除)
TD_TITLE_TRANSITION = "020-Flat01.png"
# ◆タイトル文字(配列の要素毎に1行)
TD_TITLE_TEXT = [
"Prince,Ordaz & EMPEROR",
] # ←この ] は消さないこと。
# ◆コマンドウィンドウの幅 【単位:ピクセル(px)】
TD_WINDOW_WIDTH = 256
# ◆ニューゲーム項目名
TD_COMMAND_NEWGAME = "New Game"
# ◆コンティニュー項目名
TD_COMMAND_CONTINUE = "Continue"
# ◆シャットダウン項目名
TD_COMMAND_SHUTDOWN = "Quit"
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
$imported = {} if $imported == nil
$imported["TitleDirection"] = true
#==============================================================================
# ■ Scene_Title
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
# 戦闘テストの場合
if $BTEST
battle_test
return
end
# データベースをロード
$data_actors = load_data("Data/Actors.rxdata")
$data_classes = load_data("Data/Classes.rxdata")
$data_skills = load_data("Data/Skills.rxdata")
$data_items = load_data("Data/Items.rxdata")
$data_weapons = load_data("Data/Weapons.rxdata")
$data_armors = load_data("Data/Armors.rxdata")
$data_enemies = load_data("Data/Enemies.rxdata")
$data_troops = load_data("Data/Troops.rxdata")
$data_states = load_data("Data/States.rxdata")
$data_animations = load_data("Data/Animations.rxdata")
$data_tilesets = load_data("Data/Tilesets.rxdata")
$data_common_events = load_data("Data/CommonEvents.rxdata")
$data_system = load_data("Data/System.rxdata")
# システムオブジェクトを作成
$game_system = Game_System.new
# タイトル BGM を演奏
$game_system.bgm_play($data_system.title_bgm)
# ME、BGS の演奏を停止
Audio.me_stop
Audio.bgs_stop
# タイトルロゴ表示処理
if KGC::TD_LOGO_FILE != nil && !$title_flag &&
(KGC::TD_TESTPLAY_SHOW || !$DEBUG)
# スプライト作成
@sprite = [Sprite.new, Sprite.new]
@sprite[0].bitmap = KGC::TD_LOGO_FILE
@sprite[1].bitmap = @sprite[0].bitmap
# ロゴ表示 SE 演奏
if KGC::TD_LOGO_SE != nil
if KGC::TD_LOGO_SE.is_a?(RPG::AudioFile)
$game_system.se_play(KGC::TD_LOGO_SE)
elsif KGC::TD_LOGO_SE.is_a?(String)
Audio.se_play("Audio/SE/" + KGC::TD_LOGO_SE)
end
end
# 表示位置を調整
@sprite[0].x = (640 - @sprite[0].bitmap.width) / 2 - 240
@sprite[1].x = (640 - @sprite[1].bitmap.width) / 2 + 240
@sprite[0].y = @sprite[1].y = (480 - @sprite[0].bitmap.height) / 2
# 完全透明
@sprite[0].opacity = @sprite[1].opacity = 0
# トランジション実行
Graphics.transition(0)
for i in 0..39
@sprite[0].x += 6
@sprite[1].x -= 6
@sprite[0].opacity += 4
@sprite[1].opacity += 4
Graphics.update
end
@sprite[0].opacity = 255
@sprite[1].opacity = 0
for i in 0..19
Graphics.update
end
# トランジション準備
Graphics.freeze
# スプライトを解放
@sprite[0].bitmap.dispose
@sprite[0].dispose
@sprite[1].dispose
# トランジション実行
Graphics.transition(20)
# トランジション準備
Graphics.freeze
end
# タイトルフラグを立てる
$title_flag = true
# タイトルグラフィックを作成
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
# タイトル文字を描画
@title_text = Sprite.new
@title_text.bitmap = Bitmap.new(640, 480)
@title_text.bitmap.font.name = "Poor Richard"
@title_text.bitmap.font.size = 35
@title_text.bitmap.font.bold = true
@title_text.bitmap.font.italic = true
y = 440 - 21 * KGC::TD_TITLE_TEXT.size
for i in 0...KGC::TD_TITLE_TEXT.size
text = KGC::TD_TITLE_TEXT[i]
@title_text.bitmap.font.color = Color.new(0, 32, 96)
if $imported["FrameShadowText"]
@title_text.bitmap.draw_frame_text(8, y, 640, 48, text, 1)
else
@title_text.bitmap.draw_text(8, y, 640, 48, text, 1)
end
@title_text.bitmap.font.color = Color.new(224, 0, 0)
if $imported["FrameShadowText"]
@title_text.bitmap.draw_frame_text(0, y - 8, 640, 48, text, 1)
else
@title_text.bitmap.draw_text(0, y - 8, 640, 48, text, 1)
end
y += 42
end
@title_text.opacity = 0
@title_text.z = 100
# コマンドウィンドウを作成
s = []
s[0] = KGC::TD_COMMAND_NEWGAME
s[1] = KGC::TD_COMMAND_CONTINUE
s[2] = KGC::TD_COMMAND_SHUTDOWN
@command_window = Window_Command.new(KGC::TD_WINDOW_WIDTH, s)
@command_window.opacity = 0
@command_window.back_opacity = 160
@command_window.contents_opacity = 0
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 480
# コンティニュー有効判定
# セーブファイルがひとつでも存在するかどうかを調べる
# 有効なら @continue_enabled を true、無効なら false にする
@continue_enabled = false
for i in 0..3
if FileTest.exist?("Save#{i+1}.rxdata")
@continue_enabled = true
end
end
# コンティニューが有効な場合、カーソルをコンティニューに合わせる
# 無効な場合、コンティニューの文字をグレー表示にする
if @continue_enabled
@command_window.index = 1
else
@command_window.disable_item(1)
end
# トランジション実行
if KGC::TD_TITLE_TRANSITION == nil
Graphics.transition
else
Graphics.transition(40, "Graphics/Transitions/" + KGC::TD_TITLE_TRANSITION)
end
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# コマンドウィンドウを解放
@command_window.dispose
# タイトルグラフィックを解放
@sprite.bitmap.dispose
@sprite.dispose
# タイトル文字を解放
if @title_text != nil
@title_text.bitmap.dispose
@title_text.dispose
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias update_KGC_TitleDirection update
def update
# タイトル文字を浮き出させる
if @title_text.opacity < 255
@title_text.opacity += 5
end
# 元の処理を実行
update_KGC_TitleDirection
# 何となくウィンドウを弄って遊ぶ
@command_window.y -= 4 if @command_window.y > 256
@command_window.opacity += 5
@command_window.contents_opacity += 5
end
#--------------------------------------------------------------------------
# ● ニューゲーム処理
#--------------------------------------------------------------------------
alias command_new_game_KGC_TitleDirection command_new_game
def command_new_game
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# BGMフェードアウト
Audio.bgm_fade(2000)
# 意味の無い演出
for i in 0..60
@sprite.x -= 32
@sprite.y -= 32
@sprite.zoom_x += 0.1
@sprite.zoom_y += 0.1
@sprite.opacity -= 5
@title_text.x -= 32
@title_text.y -= 32
@title_text.zoom_x += 0.1
@title_text.zoom_y += 0.1
@title_text.opacity -= 5
@command_window.y -= 5
@command_window.opacity -= 5
@command_window.contents_opacity -= 5
Graphics.update
end
# 決定 SE を一時消去
se_buf = $data_system.decision_se
$data_system.decision_se = nil
# 元の処理を実行
command_new_game_KGC_TitleDirection
# 決定 SE を戻す
$data_system.decision_se = se_buf
end
end
بعد ذلك أن أردت تغير الاسم اذهب لسطر 30
# ◆タイトル文字(配列の要素毎に1行)
TD_TITLE_TEXT = [
"Prince,Ordaz & EMPEROR",
] # ←この ] は消さないこと。
أما أن أردت تغير صورة أذهب لسطر 17
واكتب اسم صورة بالكامل مع صيغة من ملف Title
TD_LOGO_FILE = RPG::Cache.title("001-Title01.jpg")
السكربت 2 :
هذا سكربت يجعلك تقفز في للعبة ;)
مفيد جدا خصوصا أثناء عمل Dungeon مع أسرار
راح يفيد الجميع ^^
فقط أنسخ هذا السكربت وضعه في فوق main وسمه اي شي (jump_system مثلا)
#==============================================================================
# ■ WallJump Script
#------------------------------------------------------------------------------
# Enables jumping around the map
# Made by: Huitzilopoctli of rmxp.net as part of Interactive World
#------------------------------------------------------------------------------
# Press the A Input (ShiftKey) to jump
# The player will be able to jump over any passable tile, or any tile with a
# TerrainID the same as the JumpID
# The player must land on a passable tile without a solid event blocking it
# If the player can't jump the full 2 tiles, it will go 1 or, failing that, none
# To stop the player from jumping over a particular event, make the first
# command for the event a comment, containing this word: \Tall
# To create a 'tall' tile that will stop the player from jumping over it even if
# the tile below is jumpable, set the tile's id to not the JumpID or 0
# To lock the player's facing while moving, hold down CTRL
#==============================================================================
#==============================================================================
# ● Customisation
#==============================================================================
JumpID = 1 # The terrain ID of the tiles which can be jumped over
MaxJump = 2 # The longest jump that can be made by the player
#==============================================================================
# ● Game_Player
#==============================================================================
class Game_Player < Game_Character
# forces Game_Character's passable method to be used, so CTRL no longer makes
# the hero able to walk through walls
def passable?(x, y, d)
super(x, y, d)
end
def leap
# finds the increases to x & y for the current direction
xdir = (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
ydir = (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
# Ow!
unless $game_map.terrain_tag(@x + xdir, @y + ydir) == JumpID or
$game_map.passable?(@x + xdir, @y + ydir, @direction, self)
# make the player jump
route = RPG::MoveRoute.new
route.list.clear
route.list.push(RPG::MoveCommand.new(37))
route.list.push(RPG::MoveCommand.new(14, [0, 0]))
route.list.push(RPG::MoveCommand.new(38))
route.list.push(RPG::MoveCommand.new(0))
route.repeat = false
$game_player.force_move_route(route)
# shake the screen
$game_screen.start_shake(7, 7, 5)
# display an "Ouch!" message
$game_temp.message_text = "Ouch!"
return
end
# finds the jumpable distance
dist = jumpable_distance
# wall jump
if dist.between?(1, MaxJump - 1) and
!$game_map.passable?(@x + (dist + 1) * xdir, @y + (dist + 1) * ydir, @direction, self) and
!($game_map.terrain_tag(@x + (dist + 1) * xdir, @y + (dist + 1) * ydir) == JumpID)
# finds the reverse direction
bounce_dir = @direction == 2 ? 8 : (@direction == 4 ? 6 : (@direction == 6 ? 4 : 2))
# finds the wall-jump distance
b_dist = jumpable_distance(bounce_dir, MaxJump + 2, @x + dist * xdir, @y + dist * ydir)
# finds the additions to x and y made by the reverse direction
b_xdir = (bounce_dir == 6 ? 1 : bounce_dir == 4 ? -1 : 0)
b_ydir = (bounce_dir == 2 ? 1 : bounce_dir == 8 ? -1 : 0)
# create the move_route
route = RPG::MoveRoute.new
route.list.clear
route.list.push(RPG::MoveCommand.new(37))
# add the normal jump
route.list.push(RPG::MoveCommand.new(14, [xdir * dist, ydir * dist]))
# add the wall jump
route.list.push(RPG::MoveCommand.new(14, [b_xdir * b_dist, b_ydir * b_dist]))
route.list.push(RPG::MoveCommand.new(38))
route.list.push(RPG::MoveCommand.new(0))
route.repeat = false
$game_player.force_move_route(route)
return
end
# creates a route for a normal jump and forces the player to follow it
route = RPG::MoveRoute.new
route.list.clear
route.list.push(RPG::MoveCommand.new(37))
route.list.push(RPG::MoveCommand.new(14, [xdir * dist, ydir * dist]))
route.list.push(RPG::MoveCommand.new(38))
route.list.push(RPG::MoveCommand.new(0))
route.repeat = false
$game_player.force_move_route(route)
end
alias update_primary update
def update
# calls the normal update method
update_primary
# locks the facing if CTRL is pressed, else unlocks it
@direction_fix = Input.press?(Input::CTRL)
# leaps if Input::A is triggered
leap if Input.trigger?(Input::A) && !moving?
end
def jumpable_distance(dir = @direction, max_dist = MaxJump, x = @x, y = @y)
xdir = (dir == 6 ? 1 : dir == 4 ? -1 : 0)
ydir = (dir == 2 ? 1 : dir == 8 ? -1 : 0)
jumpable_tiles = []
for i in 0..max_dist
check_x = x + i * xdir
check_y = y + i * ydir
e = $game_map.events[$game_map.check_event(check_x, check_y)]
if e
if e.list[0].parameters[0] =~ "\Tall"
break
end
if not e.through
next
end
end
if $game_map.passable?(check_x, check_y, dir, self) or
$game_map.terrain_tag(check_x, check_y) == JumpID
jumpable_tiles.push(i)
end
end
jumpable_tiles.reverse.each do |i|
check_x = x + i * xdir
check_y = y + i * ydir
return i if $game_map.passable?(check_x, check_y, dir, self)
end
return 0
end
end
سكربت 3 :
المشي في أتجاهات8 + الجري (حسب تغير الرقم في سكربت)
فقط أردف هذه سكربت أيضا فوق main (وسميه أي اسم)
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ ◆ダッシュ&8方向移動 - KGC_Dash_8DirMove◆
#_/----------------------------------------------------------------------------
#_/ Dash & 8 traverse performance at the time of map movement are added.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#==============================================================================
# ★ カスタマイズ項目 ★
#==============================================================================
module KGC
# ◆Dash button
D8DM_DASH_BUTTON = Input::X
# ◆Dash speed
D8DM_DASH_SPEED = 4.3
# ◆Walking speed
D8DM_WALK_SPEED = 4
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
$imported = {} if $imported == nil
$imported["Dash_8DirMove"] = true
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :dash_permit # ダッシュ許可フラグ
attr_accessor :dir8_permit # 8方向移動許可フラグ
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_KGC_Dash_8DirMove initialize
def initialize
# 元の処理を実行
initialize_KGC_Dash_8DirMove
@dash_permit, @dir8_permit = true, true
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ローカル変数に移動中かどうかを記憶
last_moving = moving?
# 移動中、イベント実行中、移動ルート強制中、
# メッセージウィンドウ表示中のいずれでもない場合
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
# 向きを保存
direction = @direction
# 方向ボタンが押されていれば、その方向へプレイヤーを移動
if $game_system.dir8_permit
case Input.dir8
when 1 # 左下
move_left
move_down
# 向き固定でない場合
unless @direction_fix
# 右向きだった場合は左を、上向きだった場合は下を向く
@direction = (direction == 6 ? 4 : direction == 8 ? 2 : direction)
end
when 2 # 下
move_down
when 3 # 右下
move_down
move_right
# 向き固定でない場合
unless @direction_fix
# 左向きだった場合は右を、上向きだった場合は下を向く
@direction = (direction == 4 ? 6 : direction == 8 ? 2 : direction)
end
when 4 # 左
move_left
when 6 # 右
move_right
when 7 # 左上
move_up
move_left
# 向き固定でない場合
unless @direction_fix
# 右向きだった場合は左を、下向きだった場合は上を向く
@direction = (direction == 6 ? 4 : direction == 2 ? 8 : direction)
end
when 8 # 上
move_up
when 9 # 右上
move_right
move_up
# 向き固定でない場合
unless @direction_fix
# 左向きだった場合は右を、下向きだった場合は上を向く
@direction = (direction == 4 ? 6 : direction == 2 ? 8 : direction)
end
end
else
case Input.dir4
when 2
move_down
when 4
move_left
when 6
move_right
when 8
move_up
end
end
# ダッシュが許可されており、かつダッシュボタンが押されている場合
if $game_system.dash_permit && Input.press?(KGC::D8DM_DASH_BUTTON)
# ダッシュ速度に変更
@move_speed = KGC::D8DM_DASH_SPEED
else
# 歩行速度に変更
@move_speed = KGC::D8DM_WALK_SPEED
end
end
# ローカル変数に座標を記憶
last_real_x = @real_x
last_real_y = @real_y
super
# キャラクターが下に移動し、かつ画面上の位置が中央より下の場合
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
# マップを下にスクロール
$game_map.scroll_down(@real_y - last_real_y)
end
# キャラクターが左に移動し、かつ画面上の位置が中央より左の場合
if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
# マップを左にスクロール
$game_map.scroll_left(last_real_x - @real_x)
end
# キャラクターが右に移動し、かつ画面上の位置が中央より右の場合
if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
# マップを右にスクロール
$game_map.scroll_right(@real_x - last_real_x)
end
# キャラクターが上に移動し、かつ画面上の位置が中央より上の場合
if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
# マップを上にスクロール
$game_map.scroll_up(last_real_y - @real_y)
end
# 移動中ではない場合
unless moving?
# 前回プレイヤーが移動中だった場合
if last_moving
# 同位置のイベントとの接触によるイベント起動判定
result = check_event_trigger_here([1,2])
# 起動したイベントがない場合
if result == false
# デバッグモードが ON かつ CTRL キーが押されている場合を除き
unless $DEBUG and Input.press?(Input::CTRL)
# エンカウント カウントダウン
if @encounter_count > 0
@encounter_count -= 1
end
end
end
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# 同位置および正面のイベント起動判定
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end
end
end
صممت مثال لهذه الاكواد في المرفقات ;)
ووقتا ممتعا ^^
التحكم :
A : لركض
Z : للقفز