Jump to content
Rpg²S Forum

*Camminata Diagonale


DaD
 Share

Recommended Posts

Descrizione
Questo script permette la camminata diagonale in diagonale da parte del charaset (di base cioe' quello di 4 frame).

Autore

パラ犬

Allegati
Per usare questo script avete bisogno di questo chara

Istruzione per l'uso
Create una classe sopra a Main e chiamatela Game_Player

 

 

#==============================================================================
# ++ ????????8???? ver. 1.00 ++
#  Script by ???
#------------------------------------------------------------------------------
# ???????????????????????????????
# ?Graphics/Characters??????
# ?(?????????)+_quarter????????????????
# ?????????????????????(?:001-Fighter01_quarter)
#------------------------------------------------------------------------------
#[??????]
# ??????????????????????????????
# ??????????????????????
# ??????????????????(?????????)+_dash_quarter??
# ?????
#==============================================================================
#==============================================================================
# ¦ Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
alias update_para_quarter update
def update
update_para_quarter
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
# ???????????????????????????
case Input.dir8
when 1 # ?????
move_lower_left
when 3 # ?????
move_lower_right
when 7 # ?????
move_upper_left
when 9 # ?????
move_upper_right
end
end
end
end
#==============================================================================
# ¦ Sprite_Character
#==============================================================================
class Sprite_Character < RPG::Sprite
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
alias update_para_quarter update
def update
update_para_quarter
if @tile_id == 0
if (@character.direction - 2) % 2 == 1
# ????????????
if quarter_graphic_exist?(@character)
# ????????
if character.dash_on and dash_quarter_graphic_exist?(@character)
@character_name = @character.character_name + "_dash_quarter"
else
@character_name = @character.character_name + "_quarter"
end
self.bitmap = RPG::Cache.character(@character_name,
@character.character_hue)
# ?????
case @character.direction
when 1
n = 0
when 3
n = 2
when 7
n = 1
when 9
n = 3
end
else
@character.direction = @character.sub_direction
# ???????????????
n = (@character.direction - 2) / 2
end
# ?????????
sx = @character.pattern * @cw
sy = n * @ch
self.src_rect.set(sx, sy, @cw, @ch)
else
self.bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
# ?????????
sx = @character.pattern * @cw
sy = (@character.direction - 2) / 2 * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
end
end
#--------------------------------------------------------------------------
# ? ????????????
#--------------------------------------------------------------------------
def quarter_graphic_exist?(character)
# ???????
begin
RPG::Cache.character(character.character_name.to_s + "_quarter", character.character_hue)
rescue
return false
end
return true
end
#--------------------------------------------------------------------------
# ? ????????????????
#--------------------------------------------------------------------------
def dash_quarter_graphic_exist?(character)
# ???????
begin
RPG::Cache.character(character.character_name.to_s + "_dash_quarter", character.character_hue)
rescue
return false
end
return true
end
end
#==============================================================================
# ¦ Game_Character
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
attr_accessor :direction # ??
attr_accessor :sub_direction # ???????????????
#--------------------------------------------------------------------------
# ? ?????
#--------------------------------------------------------------------------
def move_lower_left
# ?????????
unless @direction_fix
@sub_direction = @direction
@direction = 1
# ?????????????????????????
@sub_direction = (@sub_direction == 6 ? 4 : @sub_direction == 8 ? 2 : @sub_direction)
end
# ??????? ?????????????????
if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 4)) or
(passable?(@x, @y, 4) and passable?(@x - 1, @y, 2))
# ?????
@x -= 1
@y += 1
# ????
increase_steps
end
end
#--------------------------------------------------------------------------
# ? ?????
#--------------------------------------------------------------------------
def move_lower_right
# ?????????
unless @direction_fix
@sub_direction = @direction
@direction = 3
# ?????????????????????????
@sub_direction = (@sub_direction == 4 ? 6 : @sub_direction == 8 ? 2 : @sub_direction)
end
# ??????? ?????????????????
if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 6)) or
(passable?(@x, @y, 6) and passable?(@x + 1, @y, 2))
# ?????
@x += 1
@y += 1
# ????
increase_steps
end
end
#--------------------------------------------------------------------------
# ? ?????
#--------------------------------------------------------------------------
def move_upper_left
# ?????????
unless @direction_fix
@sub_direction = @direction
@direction = 7
# ?????????????????????????
@sub_direction = (@sub_direction == 6 ? 4 : @sub_direction == 2 ? 8 : @sub_direction)
end
# ??????? ?????????????????
if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 4)) or
(passable?(@x, @y, 4) and passable?(@x - 1, @y, 8))
# ?????
@x -= 1
@y -= 1
# ????
increase_steps
end
end
#--------------------------------------------------------------------------
# ? ?????
#--------------------------------------------------------------------------
def move_upper_right
# ?????????
unless @direction_fix
@sub_direction = @direction
@direction = 9
# ?????????????????????????
@sub_direction = (@sub_direction == 4 ? 6 : @sub_direction == 2 ? 8 : @sub_direction)
end
# ??????? ?????????????????
if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 6)) or
(passable?(@x, @y, 6) and passable?(@x + 1, @y, 8))
# ?????
@x += 1
@y -= 1
# ????
increase_steps
end
end
end
#==============================================================================
# ¦ Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ? ?????????????
#--------------------------------------------------------------------------
def dash_on
if @dash_on != nil
return @dash_on
else
return false
end
end
end

 

 

TPC Radio Site | Blog | Big-Bug

http://img102.imageshack.us/img102/4332/slackware2userbarok0.gif

http://img141.imageshack.us/img141/1571/nokappams1cf8.png

 

http://i29.tinypic.com/2vijdlh.jpg

Link to comment
Share on other sites

  • 2 years later...
Descrizione

Questo script permette la camminata diagonale in diagonale da parte del charaset (di base cioe' quello di 4 frame).

 

Autore

 

パラ犬

 

Allegati

Per usare questo script avete bisogno di questo chara

 

Istruzione per l'uso

Create una classe sopra a Main e chiamatela Game_Player

 

#==============================================================================
# ++ グラフィック変更8方向移動 ver. 1.00 ++
#  Script by パラ犬
#------------------------------------------------------------------------------
# 上下キーと左右キーを同時押しすることにより斜め移動を可能にし、
# 「Graphics/Characters」フォルダに
# 「(先頭キャラクター名)+_quarter」という名前のファイルがある場合
# 斜め移動時のグラフィックとして使用します。(例:001-Fighter01_quarter)
#------------------------------------------------------------------------------
#[設置上の注意]
# 「グラフィック変更ダッシュ」と併用する場合、このスクリプトを
# ダッシュスクリプトよりも下に置いてください。
# 斜め方向ダッシュの画像ファイル名は「(先頭キャラクター名)+_dash_quarter」に
# なります。
#==============================================================================

#==============================================================================
# ■ Game_Player
#==============================================================================

class Game_Player < Game_Character
 #--------------------------------------------------------------------------
 # ● フレーム更新
 #--------------------------------------------------------------------------
 alias update_para_quarter update
 def update
update_para_quarter
unless moving? or $game_system.map_interpreter.running? or
	   @move_route_forcing or $game_temp.message_window_showing
  # 方向ボタンが押されていれば、その方向へプレイヤーを移動
  case Input.dir8
  when 1  # 左下に移動
	move_lower_left
  when 3  # 右下に移動
	move_lower_right
  when 7  # 左上に移動
	move_upper_left
  when 9  # 右上に移動
	move_upper_right
  end
end
 end
end

#==============================================================================
# ■ Sprite_Character
#==============================================================================

class Sprite_Character < RPG::Sprite
 #--------------------------------------------------------------------------
 # ● フレーム更新
 #--------------------------------------------------------------------------
 alias update_para_quarter update
 def update
update_para_quarter
if @tile_id == 0
  if (@character.direction - 2) % 2 == 1
	# 斜め画像の有無をチェック
	if quarter_graphic_exist?(@character)
	  # 斜め画像をセット
	  if character.dash_on and dash_quarter_graphic_exist?(@character)
		@character_name = @character.character_name + "_dash_quarter"
	  else
		@character_name = @character.character_name + "_quarter"
	  end
	  self.bitmap = RPG::Cache.character(@character_name,
		@character.character_hue)
	  # 向きを取得
	  case @character.direction
		when 1
		  n = 0
		when 3
		  n = 2
		when 7
		  n = 1
		when 9
		  n = 3
	  end
	else
	  @character.direction = @character.sub_direction
	  # 斜め画像が存在しないときの向き
	  n = (@character.direction - 2) / 2
	end
	# 転送元の矩形を設定
	sx = @character.pattern * @cw
	sy = n * @ch
	self.src_rect.set(sx, sy, @cw, @ch)
  else
	self.bitmap = RPG::Cache.character(@character.character_name,
	  @character.character_hue)
	# 転送元の矩形を設定
	sx = @character.pattern * @cw
	sy = (@character.direction - 2) / 2 * @ch
	self.src_rect.set(sx, sy, @cw, @ch)
  end
end
 end
 #--------------------------------------------------------------------------
 # ○ 斜め画像の有無をチェック
 #--------------------------------------------------------------------------
 def quarter_graphic_exist?(character)
# 読み込みテスト
begin
  RPG::Cache.character(character.character_name.to_s + "_quarter", character.character_hue)
rescue
  return false
end
return true
 end
 #--------------------------------------------------------------------------
 # ○ 斜めダッシュ画像の有無をチェック
 #--------------------------------------------------------------------------
 def dash_quarter_graphic_exist?(character)
# 読み込みテスト
begin
  RPG::Cache.character(character.character_name.to_s + "_dash_quarter", character.character_hue)
rescue
  return false
end
return true
 end
end

#==============================================================================
# ■ Game_Character
#==============================================================================

class Game_Character
 #--------------------------------------------------------------------------
 # ● 公開インスタンス変数
 #--------------------------------------------------------------------------
 attr_accessor   :direction		# 向き
 attr_accessor   :sub_direction	# 斜め画像が存在しないときの向き
 #--------------------------------------------------------------------------
 # ● 左下に移動
 #--------------------------------------------------------------------------
 def move_lower_left
# 向き固定でない場合
unless @direction_fix
  @sub_direction = @direction
  @direction = 1
  # 右向きだった場合は左を、上向きだった場合は下を向く
  @sub_direction = (@sub_direction == 6 ? 4 : @sub_direction == 8 ? 2 : @sub_direction)
end
# 下→左、左→下 のどちらかのコースが通行可能な場合
if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 4)) or
   (passable?(@x, @y, 4) and passable?(@x - 1, @y, 2))
  # 座標を更新
  @x -= 1
  @y += 1
  # 歩数増加
  increase_steps
end
 end
 #--------------------------------------------------------------------------
 # ● 右下に移動
 #--------------------------------------------------------------------------
 def move_lower_right
# 向き固定でない場合
unless @direction_fix
  @sub_direction = @direction
  @direction = 3
  # 左向きだった場合は右を、上向きだった場合は下を向く
  @sub_direction = (@sub_direction == 4 ? 6 : @sub_direction == 8 ? 2 : @sub_direction)
end
# 下→右、右→下 のどちらかのコースが通行可能な場合
if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 6)) or
   (passable?(@x, @y, 6) and passable?(@x + 1, @y, 2))
  # 座標を更新
  @x += 1
  @y += 1
  # 歩数増加
  increase_steps
end
 end
 #--------------------------------------------------------------------------
 # ● 左上に移動
 #--------------------------------------------------------------------------
 def move_upper_left
# 向き固定でない場合
unless @direction_fix
  @sub_direction = @direction
  @direction = 7
  # 右向きだった場合は左を、下向きだった場合は上を向く
  @sub_direction = (@sub_direction == 6 ? 4 : @sub_direction == 2 ? 8 : @sub_direction)
end
# 上→左、左→上 のどちらかのコースが通行可能な場合
if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 4)) or
   (passable?(@x, @y, 4) and passable?(@x - 1, @y, 8))
  # 座標を更新
  @x -= 1
  @y -= 1
  # 歩数増加
  increase_steps
end
 end
 #--------------------------------------------------------------------------
 # ● 右上に移動
 #--------------------------------------------------------------------------
 def move_upper_right
# 向き固定でない場合
unless @direction_fix
  @sub_direction = @direction
  @direction = 9
  # 左向きだった場合は右を、下向きだった場合は上を向く
  @sub_direction = (@sub_direction == 4 ? 6 : @sub_direction == 2 ? 8 : @sub_direction)
end
# 上→右、右→上 のどちらかのコースが通行可能な場合
if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 6)) or
   (passable?(@x, @y, 6) and passable?(@x + 1, @y, 8))
  # 座標を更新
  @x += 1
  @y -= 1
  # 歩数増加
  increase_steps
end
 end
end

#==============================================================================
# ■ Game_Player
#==============================================================================
class Game_Player < Game_Character
 #--------------------------------------------------------------------------
 # ○ ダッシュスクリプト導入判定
 #--------------------------------------------------------------------------
 def dash_on
if @dash_on != nil
  return @dash_on
else
  return false
end
 end
end

Interessante ! :Ok:

http://img14.imageshack.us/img14/9595/obbiettivogiocaconnoi.png
Link to comment
Share on other sites

  • 1 year later...

Una maniera alternativa senza script

ciao.....io non so fare script.......

comunque questo effetto si può creare facilmente con degli eventi:

 

Nuovo evento che si attiva al passagio del chara.....

associare tramite la stringa dell "if"

ora non mi vengono i termini precisi...comunque

 

ad esempio :

if -> is pressed

move player up-right

if <- is pressed

move player down left

 

 

etc...

Link to comment
Share on other sites

Non per fare l'antipatico, ma hai visto la data dello script...

Lo script è stato postato nel 2006!

Controlla la data prima di postare!^^

http://img89.imageshack.us/img89/618/qzfc.png

Premi:

http://i49.tinypic.com/2cpdkb8.jpghttp://i40.tinypic.com/w0tfev.jpghttp://i42.servimg.com/u/f42/13/12/87/37/screen10.pnghttp://i42.servimg.com/u/f42/13/12/87/37/screen10.pnghttp://i42.servimg.com/u/f42/13/12/87/37/screen10.pnghttp://www.rpgmkr.net/contest/screen-contest-primo.pnghttp://www.rpgmkr.net/contest/screen-contest-secondo.pnghttp://www.rpgmkr.net/contest/screen-contest-secondo.png http://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest2Oct.gifhttp://rpg2s.net/gif/SCContest2Oct.gifhttp://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest1Oct.gif



http://oi60.tinypic.com/206c3nc.jpg

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...