Group: Member
Posts: 36
Type: Developer
RM Skill: Advanced
Amethyst Platform System
Introduction: First of all...this script is not made by me. It was made by Khas. I just translated it, is all. So, yeah, you can make platformers with this.
Features: ~Make platformers ~Alter gravity and jump setting ~Can be combined with Requiem SBABS to make "Metroidvania" games
Installation/Instructions: 1 - Paste this script above all the additional scripts 2 - Set the configuration
I should also mention that you're going to need a blank tile for all the non-platform parts of the maps. Dunno if it'll work with the blank parallax tile.
Screenshot:
~Open~
(Please note that the HUD is not part of the script. This, along with enemies and powerups, you will have to do on your own. SUCKS DOESN'T IT?)
Script:
~Open~
CODE
=begin ================================================================================ Amethyst Platform System - Version 1.2 RMVX - 25/03/2010 ================================================================================
-------------------------------------------------------------------------------- Credits -------------------------------------------------------------------------------- Created by Khas. Translation by Avatar176. All Amethyst scripts are licensed under a Creative Commons All Amethyst scripts can only be used in non-commercial projects, If use in commercial project please send a PM with the request. -------------------------------------------------------------------------------- Features -------------------------------------------------------------------------------- The Amethyst System Platform Selected maps transforms the constant Amp_System_Maps (see the "configuration) in platform-style maps.
-------------------------------------------------------------------------------- Instructions/Installation -------------------------------------------------------------------------------- 1 - Paste this script above all the additional scripts 2 - Set it in the configuration
-------------------------------------------------------------------------------- Instructions - Creating The Maps -------------------------------------------------------------------------------- The tiles are not passable and the platform where the tiles are passable the character can fall \ jump. The events also suffer map action gravity of the system, ie, fall into holes too
-------------------------------------------------------------------------------- Configuration -------------------------------------------------------------------------------- =end module Amp_Config # Maps that will be platform style, place the ID within the [], separated by commas Amp_System_Maps = [1,2,8,9,10,12,13,14,15,17,18,19,20,22,23,24,25,26,27,28,32,30,33,34,35,36,37 ,38,39,40,41, 42,43,46] # Force of gravity, varies from 0 ~ 2 GForce = 1 # Key to Jump Jump_Key = Input::X # Force Leap, values from 0 ~ 5 Jump_Force = 4 # Sound to play when you jump Jump_Sound = "Jump1" end #------------------------------------------------------------------------------- # Do not change anything below unless you know what you're doing! #-------------------------------------------------------------------------------
$Amethyst_Scripts = {} if $Amethyst_Scripts.nil? $Amethyst_Scripts["Am Platform System"] = ["1.2","25/03/2010"]
class Game_Character alias amp_original_initialize initialize alias amp_original_update update alias amp_original_move_up move_up alias amp_original_move_down move_down alias amp_original_move_left move_left alias amp_original_move_right move_right alias amp_original_move_random move_random alias amp_original_turn_random turn_random alias amp_original_move_toward_player move_toward_player alias amp_original_move_away_from_player move_away_from_player def amp_map? $game_map.nil? ? i = false : i = Amp_Config::Amp_System_Maps.include?($game_map.map_id) return i end def initialize if amp_map? @gforce = false; @nforce = false; @sforce = nil end amp_original_initialize end def update amp_original_update return unless amp_map? force_gravity if @gforce stop_gravity_force if @nforce end def force_gravity return if moving? @move_speed = Amp_Config::GForce+4 @y = $game_map.round_y(@y+1) @real_y = (@y-1)*256 if passable?(@x, @y+1); @gforce = true else; @nforce = true; @gforce = false end end def check_gravity_force if passable?(@x, @y+1) @sforce = @move_speed @gforce = true @walk_anime = false else check_event_trigger_touch(@x, @y+1) end end def stop_gravity_force return if moving? @nforce = false @gforce = false @walk_anime = true @move_speed = @sforce @sforce = nil end def move_up(turn_ok = true) amp_map? ? amp_move_up(turn_ok) : amp_original_move_up(turn_ok) end def move_down(turn_ok = true) amp_map? ? amp_move_down(turn_ok) : amp_original_move_down(turn_ok) end def move_left(turn_ok = true) amp_map? ? amp_move_left(turn_ok) : amp_original_move_left(turn_ok) end def move_right(turn_ok = true) amp_map? ? amp_move_right(turn_ok) : amp_original_move_right(turn_ok) end def move_random amp_map? ? amp_move_random : amp_original_move_random end def move_toward_player amp_map? ? amp_move_toward_player : amp_original_move_toward_player end def move_away_from_player amp_map? ? amp_move_away_from_player : amp_original_move_away_from_player end def turn_random amp_map? ? amp_turn_random : amp_original_turn_random end def amp_move_up(turn_ok) if passable?(@x, @y-1) @y = $game_map.round_y(@y-1) @real_y = (@y+1)*256 increase_steps @move_failed = false else check_event_trigger_touch(@x, @y-1) @move_failed = true end end def amp_move_down(turn_ok) if passable?(@x, @y+1) @y = $game_map.round_y(@y+1) @real_y = (@y-1)*256 increase_steps @move_failed = false else check_event_trigger_touch(@x, @y+1) @move_failed = true end end def amp_move_left(turn_ok) if passable?(@x-1, @y) turn_left if turn_ok @x = $game_map.round_x(@x-1) @real_x = (@x+1)*256 increase_steps check_gravity_force @move_failed = false else turn_left if turn_ok check_event_trigger_touch(@x-1, @y) @move_failed = true end end def amp_move_right(turn_ok) if passable?(@x+1, @y) turn_right if turn_ok @x = $game_map.round_x(@x+1) @real_x = (@x-1)*256 increase_steps check_gravity_force @move_failed = false else turn_right if turn_ok check_event_trigger_touch(@x+1, @y) @move_failed = true end end def amp_move_random case rand(2) when 0; move_left(false) when 1; move_right(false) end end def amp_move_toward_player sx = distance_x_from_player return if sx == 0 sx > 0 ? move_right : move_left end def amp_move_away_from_player sx = distance_x_from_player return if sx == 0 sx > 0 ? move_right : move_left end def amp_turn_random case rand(2) when 0; turn_right when 1; turn_left end end end
class Game_Player < Game_Character alias amp_2original_initialize initialize alias amp_2original_update update alias amp_2original_move_by_input move_by_input def initialize amp_2original_initialize @jforce = 0 end def update amp_2original_update update_jump_force if amp_map? and !@gforce end def update_jump_force if @jforce > 0 return if moving? if @jforce > 1 if Input.press?(Input::RIGHT) turn_right jump_upper_right elsif Input.press?(Input::LEFT) turn_left jump_upper_left else jump_up end else @move_speed = 4 @walk_anime = true check_gravity_force end @jforce -= 1 else if Input.trigger?(Amp_Config::Jump_Key) RPG::SE.new(Amp_Config::Jump_Sound,80).play dash? ? @jforce = 4+Amp_Config::Jump_Force : @jforce = 3+Amp_Config::Jump_Force @move_speed = 5 @walk_anime = false @pattern = 0 end end end def force_gravity return if moving? @move_speed = Amp_Config::GForce+4 if Input.press?(Input::RIGHT) turn_right gforce_lower_right elsif Input.press?(Input::LEFT) turn_left gforce_lower_left else @y = $game_map.round_y(@y+1) @real_y = (@y-1)*256 end check_touch_event if passable?(@x, @y+1); @gforce = true else; @nforce = true; @gforce = false end end def gforce_lower_left if (passable?(@x, @y+1) and passable?(@x-1, @y+1)) or (passable?(@x-1, @y) and passable?(@x-1, @y+1)) @x -= 1 @y += 1 else @y = $game_map.round_y(@y+1) @real_y = (@y-1)*256 end end def gforce_lower_right if (passable?(@x, @y+1) and passable?(@x+1, @y+1)) or (passable?(@x+1, @y) and passable?(@x+1, @y+1)) @x += 1 @y += 1 else @y = $game_map.round_y(@y+1) @real_y = (@y-1)*256 end end def jump_up if passable?(@x, @y-1) @y = $game_map.round_y(@y-1) @real_y = (@y+1)*256 @move_failed = false else check_event_trigger_touch(@x, @y-1) @move_failed = true @jforce = 0 check_gravity_force end end def jump_upper_left unless @direction_fix @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction) end if (passable?(@x, @y-1) and passable?(@x-1, @y-1)) or (passable?(@x-1, @y) and passable?(@x-1, @y-1)) @x -= 1 @y -= 1 else jump_up end end def jump_upper_right unless @direction_fix @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction) end if (passable?(@x, @y-1) and passable?(@x+1, @y-1)) or (passable?(@x+1, @y) and passable?(@x+1, @y-1)) @x += 1 @y -= 1 else jump_up end end def move_by_input amp_map? ? amp_move_by_input : amp_2original_move_by_input end def amp_move_by_input return if @gforce return unless movable? return if $game_map.interpreter.running? case Input.dir4 when 4; move_left when 6; move_right end end end
Notes: Do please note that this script will NOT give you a pure, precise platforming experience. I recommend using it only for minigames, or short games. For longer projects, I'd suggest complex eventing, or another engine (I.E. Game Maker).