Save-Point
1-Direction Movement - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker VX/VXAce (RGSS2/3) Engines (https://www.save-point.org/forum-117.html)
+---- Thread: 1-Direction Movement (/thread-2350.html)



1-Direction Movement - woratana - 01-22-2009

1-Direction Movement Style
Version 1.0
by Woratana
Release Date: 10/06/2008


Introduction
This is the alt. movement style for shooting game.
Player will turn left/right by press Left/Right,
and walk forward/backward by press Up/Down.

This movement style will allow player to turn and shoot around without
move from spot he is standing~

Enjoy~ :lol:


Screenshots
-No screenshot-


Script
Place it above main
[Image: 25thhqt.jpg]
Code:
#===============================================================
# ? [VX] ? 1-Direction Movement Style ? ?
# * a.k.a. Resident Evil Movement Style~ *
#--------------------------------------------------------------
# ? by Woratana [woratana@hotmail.com]
# ? Thaiware RPG Maker Community
# ? Released on: 10/06/2008
# ? Version: 1.0
#--------------------------------------------------------------
# ? Feature:
# Change the way to move player to...
# press UP: Move forward
# press DOWN: Move backward
# press LEFT: Turn Left
# press RIGHT: Turn Right
#--------------------------------------------------------------
# ? How to use:
# Put this script above main, you can setup script below
#=================================================================
class Game_Player < Game_Character

#========================================================
# SETUP SCRIPT: Configure Player's Control Buttons Here~
# These buttons will apply to default move system too.
#--------------------------------------------------------
SSM_UP = Input::UP
SSM_DOWN = Input::DOWN
SSM_LEFT = Input::LEFT
SSM_RIGHT = Input::RIGHT
#------------------------------------------
SSM_DASH_BACKWARD = false # Allow player to run backward? (true/false)
SSM_CONTROL_SWITCH_ID = 9 # Switch to turn 1-dir movement system ON
#=========================================================

def move_by_input
return unless movable?
return if $game_map.interpreter.running?

if $game_switches[SSM_CONTROL_SWITCH_ID] # If control switch is ON
# Shooting style movement
if Input.repeat?(SSM_LEFT)
turn_left_90
elsif Input.repeat?(SSM_RIGHT)
turn_right_90
elsif Input.press?(SSM_DOWN)
move_backward
elsif Input.press?(SSM_UP)
move_forward
end
else
# Default movement
if Input.press?(SSM_LEFT)
move_left
elsif Input.press?(SSM_RIGHT)
move_right
elsif Input.press?(SSM_DOWN)
move_down
elsif Input.press?(SSM_UP)
move_up
end
end
end

alias wor_gampla_onedirmov_dash dash?
def dash?
return false if $game_switches[SSM_CONTROL_SWITCH_ID] and
Input.press?(SSM_DOWN) and
!SSM_DASH_BACKWARD
wor_gampla_onedirmov_dash
end
end
Instruction
Place the script above main.
You can setup script in setup part if you don't want to recover all
HP/MP/states when level up.


Author's Notes
Free for use in your work if credit is included.


Bug Report?
Please give me these informations:
Quote:- What is it says in error window?
- When is it get error? (Right after run game, when you choose
something, etc.)
- Do you have any other scripts running in your game that may crash with
this script?