Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Side view Battle system and sprites

Status
Not open for further replies.

RPGuy

Member

Hi all.


RMXP is not free it costs $60. I have looked around for a good, easy to use script for side view battle systems but I cannot find any. I have found one script, heard it works and all. But the text on the page where i got it is gone so i do not know where to put the script in the script page. (I will post it at the bottom, its kind of big.) Also, if anyone can get me this script, or help with the one i have, could you get me some battle animations? I can't play a rpg game (old school type) without a side view battle system. Any help would be greatly appreciated!:D

P.S. (If you have a good cattapiller system I would like that too please)


--------------------------------VVScriptVV-------------------------------

#==============================================================================
# ++ サイドビューバトル(歩行グラフィック版) ver. 1.14 ++
#  Script by パラ犬
#  http://2d6.parasite.jp/
#------------------------------------------------------------------------------
# バトルフィールドに歩行グラフィックを表示します。
#==============================================================================

module SDVA

X_LINE = 500 # 横位置のバトラー表示座標
Y_LINE = 200 # 縦位置のバトラー表示座標
X_SPACE = 15 # 横位置のバトラー同士の間隔
Y_SPACE = 40 # 縦位置のバトラー同士の間隔
X_POSITION = 25 # 隊列[前衛・中衛・後衛]の横間隔
Y_POSITION = 0 # 隊列[前衛・中衛・後衛]の縦間隔

ATTACK_MOVE = true # 攻撃時に前へ踏み出すか( true / false )
SKILL_MOVE = true # スキル使用時に前へ踏み出すか( true / false )
ITEM_MOVE = false # アイテム使用時に前へ踏み出すか( true / false )
MOVE_STEP = 1 # 移動歩数
MOVE_PIXEL = 10 # 一歩あたりのピクセル数

PARTY_POS = 1 # キャラクターの向き( 0:下 / 1:左 / 2:右 / 3:上 )

WINDOWPOS_CHANGE = true # コマンドウインドウをバトラーの横に表示するか( true / false )

end

#==============================================================================
# â–  Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● バトル画面 X 座標の取得
#--------------------------------------------------------------------------
def screen_x
if self.index != nil
# 隊列を取得
pos = $data_classes[self.class_id].position
x_pos = pos * SDVA::X_POSITION
scr_x = self.index * SDVA::X_SPACE + SDVA::X_LINE + x_pos
# 移動アクションのとき
if self.current_action.move_action == true
# 横に移動
scr_x += @shift_x
end
return scr_x
else
return 0
end
end
#--------------------------------------------------------------------------
# ● バトル画面 Y 座標の取得
#--------------------------------------------------------------------------
def screen_y
if self.index != nil
# 隊列を取得
pos = $data_classes[self.class_id].position
y_pos = pos * SDVA::Y_POSITION
scr_y = self.index * SDVA::Y_SPACE + SDVA::Y_LINE + y_pos
# 移動アクションのとき
if self.current_action.move_action == true
# 縦に移動
scr_y += @shift_y
end
return scr_y
else
return 0
end
end
#--------------------------------------------------------------------------
# ● バトル画面 Z 座標の取得
#--------------------------------------------------------------------------
def screen_z
if self.index != nil
return self.index
else
return 0
end
end
end

#==============================================================================
# ■ Game_Battler (分割定義 1)
#==============================================================================

class Game_Battler
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :pattern # 歩行パターン
attr_reader :trans_x # X方向の移動距離
attr_reader :moving # 移動中フラグ
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_sdva initialize
def initialize
initialize_sdva
move_reset
end
#--------------------------------------------------------------------------
# ○ 移動カウント
#--------------------------------------------------------------------------
def move
@moving = 1
if @step < SDVA::MOVE_STEP
# 歩数を満たすまで移動
@pattern = (@pattern + 1) % 4
@step += 1
move_step
else
# 移動終了
@pattern = 1
@moving = 2
end
end
#--------------------------------------------------------------------------
# ○ 移動処理
#--------------------------------------------------------------------------
def move_step
# パーティの向きによって移動座標を変える
case SDVA::PARTY_POS
when 0
@shift_y = @step * SDVA::MOVE_PIXEL
when 1
@shift_x = -(@step * SDVA::MOVE_PIXEL)
when 2
@shift_x = @step * SDVA::MOVE_PIXEL
when 3
@shift_y = -(@step * SDVA::MOVE_PIXEL)
end
end
#--------------------------------------------------------------------------
# ○ 移動のリセット
#--------------------------------------------------------------------------
def move_reset
@moving = 0
@pattern = 0
@step = 0
@shift_x = 0
@shift_y = 0
end
end

#==============================================================================
# â–  Game_BattleAction
#==============================================================================

class Game_BattleAction
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :move_action # 移動するアクションか
#--------------------------------------------------------------------------
# ● クリア
#--------------------------------------------------------------------------
alias clear_sdva clear
def clear
clear_sdva
@move_action = false
end
end

#==============================================================================
# â–  Sprite_Battler
#==============================================================================

class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias update_sdva update
def update
# バトラーがアクターに含まれるとき
if @battler.is_a?(Game_Actor)
# ファイル名か色相が現在のものと異なる場合
# 行動中の場合
if @battler.battler_name != @battler_name or
@battler.battler_hue != @battler_hue or
@battler.current_action.basic == 0 or
@battler.current_action.kind != 3
# ビットマップを取得、設定
@character_name = @battler.character_name
@character_hue = @battler.character_hue
# 歩行グラフィックを描画
self.bitmap = RPG::Cache.character(@character_name, @character_hue)
cw = self.bitmap.width / 4
ch = self.bitmap.height / 4
@width = cw
@height = ch
if @battler.current_action.move_action == true
# 歩かせる
@battler.move
else
@battler.move_reset
end
# 転送元の矩形を設定
sx = @battler.pattern * cw
sy = SDVA::PARTY_POS * ch
self.src_rect.set(sx, sy, cw, ch)
self.ox = @width / 2
self.oy = @height
# 隠れ状態なら不透明度を 0 にする
if @battler.hidden
self.opacity = 0
end
end
end
update_sdva
end
end

#==============================================================================
# â–  Scene_Battle
#==============================================================================

class Scene_Battle
#--------------------------------------------------------------------------
# ● アクターコマンドウィンドウのセットアップ
#--------------------------------------------------------------------------
alias phase3_setup_command_window_sdva phase3_setup_command_window
def phase3_setup_command_window
phase3_setup_command_window_sdva
if SDVA::WINDOWPOS_CHANGE
# アクターコマンドウィンドウの位置を設定
case SDVA::PARTY_POS
when 0
x_pos = @active_battler.screen_x - (@actor_command_window.width/2)
y_pos = @active_battler.screen_y
when 1
x_pos = @active_battler.screen_x - @actor_command_window.width - 16
y_pos = @active_battler.screen_y - @actor_command_window.height
when 2
x_pos = @active_battler.screen_x + 16
y_pos = @active_battler.screen_y - @actor_command_window.height
when 3
x_pos = @active_battler.screen_x - (@actor_command_window.width/2)
y_pos = @active_battler.screen_y - @actor_command_window.height - 48
end
@actor_command_window.x = x_pos >= 0 ? x_pos : 0
@actor_command_window.x = x_pos+@actor_command_window.width <= 640 ? x_pos : 640-@actor_command_window.width
@actor_command_window.y = y_pos >= 0 ? y_pos : 0
@actor_command_window.y = y_pos+@actor_command_window.height <= 480 ? y_pos : 480-@actor_command_window.height
# ステータスウインドウに隠れないように
@actor_command_window.z = 9999
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
#--------------------------------------------------------------------------
alias update_phase4_step3_sdva update_phase4_step3
def update_phase4_step3
if SDVA::ATTACK_MOVE
if @active_battler.current_action.basic == 0
@active_battler.current_action.move_action = true
end
end
if SDVA::SKILL_MOVE
if @active_battler.current_action.kind == 1
@active_battler.current_action.move_action = true
end
end
if SDVA::ITEM_MOVE
if @active_battler.current_action.kind == 2
@active_battler.current_action.move_action = true
end
end
# バトラーがアクターに含まれ、移動アクション中
if @active_battler.is_a?(Game_Actor) and
@active_battler.current_action.move_action
# 移動終了時
if @active_battler.moving == 2
update_phase4_step3_sdva
end
elsif @active_battler.moving == 0
update_phase4_step3_sdva
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
#--------------------------------------------------------------------------
alias update_phase4_step6_sdva update_phase4_step6
def update_phase4_step6
@active_battler.current_action.move_action = false
@active_battler.move_reset
update_phase4_step6_sdva
end
end

#==============================================================================
# â–  Spriteset_Battle
#==============================================================================

class Spriteset_Battle
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_sdva initialize
def initialize
initialize_sdva
@viewport2.z = 1
end
end

#==============================================================================
# â–  Arrow_Actor
#==============================================================================

class Arrow_Actor < Arrow_Base
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias update_sdva update
def update
update_sdva
# カーソル下
if Input.repeat?(Input::DOWN)
$game_system.se_play($data_system.cursor_se)
@index += 1
@index %= $game_party.actors.size
end
# カーソル上
if Input.repeat?(Input::UP)
$game_system.se_play($data_system.cursor_se)
@index += $game_party.actors.size - 1
@index %= $game_party.actors.size
end
end
end

#==============================================================================
# â–  Arrow_Enemy
#==============================================================================

class Arrow_Enemy < Arrow_Base
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias update_sdva update
def update
update_sdva
# カーソル下
if Input.repeat?(Input::DOWN)
$game_system.se_play($data_system.cursor_se)
$game_troop.enemies.size.times do
@index += 1
@index %= $game_troop.enemies.size
break if self.enemy.exist?
end
end
# カーソル上
if Input.repeat?(Input::UP)
$game_system.se_play($data_system.cursor_se)
$game_troop.enemies.size.times do
@index += $game_troop.enemies.size - 1
@index %= $game_troop.enemies.size
break if self.enemy.exist?
end
end
end
end
 
You can find a good side view battle system Here
You can get the battler for this system Here
This is the Caterpillar Script
#==============================================================================
# â–  Train_Actor::Config
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================

module Train_Actor

# ●Switch setup for transparent status
# When true, switch control is used
# TRANSPARENT_SWITCH = true
TRANSPARENT_SWITCH = false

# ●Switch number for transparent status
# When TRANSPARENT_SWITCH is true, transparency will be activated when the switch of this number is on
TRANSPARENT_SWITCHES_INDEX = 20

# ●Maximum number of actors
# There will be support for a large number of people in a party in the future...
TRAIN_ACTOR_SIZE_MAX = 4

# Constants
DOWN_LEFT = 1
DOWN_RIGHT = 3
UP_LEFT = 7
UP_RIGHT = 9
JUMP = 5

end

# rgss

# Spriteset_Map_Module.rb
#==============================================================================
# â–  Spriteset_Map_Module
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================

module Train_Actor

module Spriteset_Map_Module
def setup_actor_character_sprites?
return @setup_actor_character_sprites_flag != nil
end
def setup_actor_character_sprites(characters)
if !setup_actor_character_sprites?
for character in characters.reverse
@character_sprites.unshift(
Sprite_Character.new(@viewport1, character)
)
end
@setup_actor_character_sprites_flag = true
end
end
end

end

class Spriteset_Map
include Train_Actor::Spriteset_Map_Module
end

# Scene_Map_Module.rb
#==============================================================================
# â–  Scene_Map_Module
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================

module Train_Actor

module Scene_Map_Module
def setup_actor_character_sprites(characters)
@spriteset.setup_actor_character_sprites(characters)
end
end

end

class Scene_Map
include Train_Actor::Scene_Map_Module
end

# Game_Party_Module.rb
#==============================================================================
# â–  Game_Party_Module
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================

module Train_Actor

module Game_Party_Module
attr_reader :characters
def actors_dead?
for actor in actors
if actor.dead?
return true
end
end
return false
end
def update_party_order
if not actors_dead?
return actors
end
alive_actors = []
dead_actors = []
for actor in actors
if actor.dead?
dead_actors.push actor
else
alive_actors.push actor
end
end
return alive_actors + dead_actors
end
def setup_actor_character_sprites
if @characters.nil?
@characters = []
for i in 1 ... TRAIN_ACTOR_SIZE_MAX
@characters.push(Game_Party_Actor.new)
end
end
setup_actors = update_party_order
for i in 1 ... TRAIN_ACTOR_SIZE_MAX
@characters[i - 1].setup(setup_actors)
end
if $scene.class.method_defined?('setup_actor_character_sprites')
$scene.setup_actor_character_sprites(@characters)
end
end
def update_party_actors
update_party_order
setup_actor_character_sprites
transparent = $game_player.transparent
if transparent == false
if TRANSPARENT_SWITCH
transparent = $game_switches[TRANSPARENT_SWITCHES_INDEX]
end
end
for character in @characters
character.transparent = transparent
character.move_speed = $game_player.move_speed
character.step_anime = $game_player.step_anime
character.update
end
end
def moveto_party_actors( x, y )
setup_actor_character_sprites
for character in @characters
character.moveto( x, y )
end
if @move_list == nil
@move_list = []
end
move_list_setup
end
def move_party_actors
if @move_list == nil
@move_list = []
move_list_setup
end
@move_list.each_index do |i|
if @characters != nil
case @move_list.type
when Input::DOWN
@characters.move_down(@move_list.args[0])
when Input::LEFT
@characters.move_left(@move_list.args[0])
when Input::RIGHT
@characters.move_right(@move_list.args[0])
when Input::UP
@characters.move_up(@move_list.args[0])
when DOWN_LEFT
@characters.move_lower_left
when DOWN_RIGHT
@characters.move_lower_right
when UP_LEFT
@characters.move_upper_left
when UP_RIGHT
@characters.move_upper_right
when JUMP
@characters.jump(@move_list.args[0],@move_list.args[1])
end
end
end
end
class Move_List_Element
def initialize(type,args)
@type = type
@args = args
end
def type() return @type end
def args() return @args end
end
def move_list_setup
for i in 0 .. TRAIN_ACTOR_SIZE_MAX
@move_list = nil
end
end
def add_move_list(type,*args)
@move_list.unshift(Move_List_Element.new(type,args)).pop
end
def move_down_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::DOWN,turn_enabled)
end
def move_left_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::LEFT,turn_enabled)
end
def move_right_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::RIGHT,turn_enabled)
end
def move_up_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::UP,turn_enabled)
end
def move_lower_left_party_actors
move_party_actors
add_move_list(DOWN_LEFT)
end
def move_lower_right_party_actors
move_party_actors
add_move_list(DOWN_RIGHT)
end
def move_upper_left_party_actors
move_party_actors
add_move_list(UP_LEFT)
end
def move_upper_right_party_actors
move_party_actors
add_move_list(UP_RIGHT)
end
def jump_party_actors(x_plus, y_plus)
move_party_actors
add_move_list(JUMP,x_plus, y_plus)
end
end

end

class Game_Party
include Train_Actor::Game_Party_Module
end

# Game_Player_Module.rb
#==============================================================================
# â–  Game_Player_Module
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================

module Train_Actor

module Game_Player_Module
attr_reader :move_speed
attr_reader :step_anime

def update_party_actors
$game_party.update_party_actors
$game_party.actors.each do |actor|
if actor.dead?
next
end
@character_name = actor.character_name
@character_hue = actor.character_hue
break
end
end
def update
update_party_actors
super
end
def moveto( x, y )
$game_party.moveto_party_actors( x, y )
super( x, y )
end
def move_down(turn_enabled = true)
if passable?(@x, @y, Input::DOWN)
$game_party.move_down_party_actors(turn_enabled)
end
super(turn_enabled)
end
def move_left(turn_enabled = true)
if passable?(@x, @y, Input::LEFT)
$game_party.move_left_party_actors(turn_enabled)
end
super(turn_enabled)
end
def move_right(turn_enabled = true)
if passable?(@x, @y, Input::RIGHT)
$game_party.move_right_party_actors(turn_enabled)
end
super(turn_enabled)
end
def move_up(turn_enabled = true)
if passable?(@x, @y, Input::UP)
$game_party.move_up_party_actors(turn_enabled)
end
super(turn_enabled)
end
def move_lower_left
# When possible to move from down→left or from left→down
if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
(passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
$game_party.move_lower_left_party_actors
end
super
end
def move_lower_right
# When possible to move from down→right or from right→down
if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
(passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
$game_party.move_lower_right_party_actors
end
super
end
def move_upper_left
# When possible to move from up→left or from left→up
if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
(passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
$game_party.move_upper_left_party_actors
end
super
end
def move_upper_right
# When possible to move from up→right or from right→up
if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
(passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
$game_party.move_upper_right_party_actors
end
super
end
def jump(x_plus, y_plus)
# New coordinates are calculated
new_x = @x + x_plus
new_y = @y + y_plus
# When addition values are (0,0), it is possible to jump to the destination
if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0)
$game_party.jump_party_actors(x_plus, y_plus)
end
super(x_plus, y_plus)
end
end

end

class Game_Player
include Train_Actor::Game_Player_Module
end

# Game_Event_Module.rb
#==============================================================================
# â–  Game_Event_Module
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================

module Train_Actor

module Game_Event_Module
#--------------------------------------------------------------------------
# ● Judgement determined
# x : X coordinates
# y : Y coordinates
# d : Direction (0,2,4,6,8) ※ 0 = Checks if all directions are not able to be passed (for a jump)
# return : Passing is impossible (false), possible (true)
#--------------------------------------------------------------------------
def passable?(x, y, d)
result = super(x, y, d)
if result
# New coordinates are searched for
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
# Loops for actor in train
for actor in $game_party.characters
# When displayed
if not actor.character_name.empty?
# When actor's coordinates correspond to the destination
if actor.x == new_x and actor.y == new_y
# When event
if self != $game_player
# Passing is impossible
return false
end
end
end
end
end
return result
end
end

end

class Game_Event
include Train_Actor::Game_Event_Module
end

# Game_Party_Actor.rb
#==============================================================================
# â–  Game_Party_Actor
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================

module Train_Actor

class Game_Party_Actor < Game_Character
attr_writer :move_speed
attr_writer :step_anime

def initialize
super()
@through = true
end
def setup(actor)
# The file name and hue of the character are set
if actor != nil and (not actor.dead?) # When dead, it is erased for the time being...
@character_name = actor.character_name
@character_hue = actor.character_hue
else
@character_name = ""
@character_hue = 0
end
# Opacity and blending method are initialized
@opacity = 255
@blend_type = 0
end
def screen_z(height = 0)
if $game_player.x == @x and $game_player.y == @y
return $game_player.screen_z(height) - 1
end
super(height)
end
#--------------------------------------------------------------------------
# ● Move down
# turn_enabled : Flag that permits direction change on the spot
#--------------------------------------------------------------------------
def move_down(turn_enabled = true)
# Face down
if turn_enabled
turn_down
end
# When possible to pass
if passable?(@x, @y, Input::DOWN)
# Face down
turn_down
# Update coordinates
@y += 1
end
end
#--------------------------------------------------------------------------
# ● Move left
# turn_enabled : Flag that permits direction change on the spot
#--------------------------------------------------------------------------
def move_left(turn_enabled = true)
# Face left
if turn_enabled
turn_left
end
# When possible to pass
if passable?(@x, @y, Input::LEFT)
# Face left
turn_left
# Update coordinates
@x -= 1
end
end
#--------------------------------------------------------------------------
# ● Move right
# turn_enabled : Flag that permits direction change on the spot
#--------------------------------------------------------------------------
def move_right(turn_enabled = true)
# Face right
if turn_enabled
turn_right
end
# When possible to pass
if passable?(@x, @y, Input::RIGHT)
# Face right
turn_right
# Update coordinates
@x += 1
end
end
#--------------------------------------------------------------------------
# ● Move up
# turn_enabled : Flag that permits direction change on the spot
#--------------------------------------------------------------------------
def move_up(turn_enabled = true)
# Face up
if turn_enabled
turn_up
end
# When possible to pass
if passable?(@x, @y, Input::UP)
# Face up
turn_up
# Update coordinates
@y -= 1
end
end
#--------------------------------------------------------------------------
# ● Move lower left
#--------------------------------------------------------------------------
def move_lower_left
# When no direction fixation
unless @direction_fix
# Turn left when facing right, turn down when facing up
@direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::UP ? Input::DOWN : @direction)
end
# When possible to move from down→left or from left→down
if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
(passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
# Update coordinates
@x -= 1
@y += 1
end
end
#--------------------------------------------------------------------------
# ● Move lower right
#--------------------------------------------------------------------------
def move_lower_right
# When no direction fixation
unless @direction_fix
# Turn right when facing left, turn down when facing up
@direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::UP ? Input::DOWN : @direction)
end
# When possible to move from down→right or from right→down
if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
(passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
# Update coordinates
@x += 1
@y += 1
end
end
#--------------------------------------------------------------------------
# ● move upper left
#--------------------------------------------------------------------------
def move_upper_left
# When no direction fixation
unless @direction_fix
# Turn left when facing right, turn up when facing down
@direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::DOWN ? Input::UP : @direction)
end
# When possible to move from up→left or from left→up
if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
(passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
# Update coordinates
@x -= 1
@y -= 1
end
end
#--------------------------------------------------------------------------
# ● move upper right
#--------------------------------------------------------------------------
def move_upper_right
# When no direction fixation
unless @direction_fix
# Turn right when facing left, turn up when facing down
@direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::DOWN ? Input::UP : @direction)
end
# When possible to move from up→right or from right→up
if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
(passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
# Update coordinates
@x += 1
@y -= 1
end
end
end

end
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top