Posts: 5
Threads: 1
Joined: Apr 2012
Dear sweet God in Heaven... I think I need to change my pants. MGC, this looks amazing... I'm gonna go play with the demo, now.
Posts: 2
Threads: 0
Joined: Nov 2012
Can you fix event trigger as soon as posible?, please
Sorry for my bad English.
Posts: 2
Threads: 0
Joined: Jan 2013
Woah, this is awesome. I've been looking for something like this for forever.
For some odd reason, I have absolutely no idea where to find the tileset editor though...where can I find it?
EDIT: I'm getting an error whenever I try out the demo. It says that Game.exe had an unexpected error, and that the program must be shut down.
Posts: 422
Threads: 23
Joined: Aug 2011
It seems that looking at an invisible event with the resolution set to anything lower than "High" causes the RGSS player to crash. I also noticed that events face the opposite direction than is expected.
Posts: 704
Threads: 127
Joined: Nov 2011
Okay, here's what I found out about the events so long ago... They can be transparent below High... however, depending on the resolution states, the event sizes and the texture sizes have to be the same... so if your wall size is 480, your transparent event (whether it takes up the whole box or not, seems to need to have a space of 480 per cell.
BLOG: JayVinci.blogspot.com
FORUM COMING SOON
Currently working on:
Ambitions: RPG Developer Bakin
Heart of Vox: RPG Developer Bakin
Posts: 422
Threads: 23
Joined: Aug 2011
I'm hoping it's simply a divide my 0 error in the script and not a DLL bug. I can fix the former; the latter is going to take some work.
In the mean time, here is a fix for 'backwards events.'
change Code: current_direction = directions_list[(directions_list.index(current_direction) +
(($game_system.fple2_angle + 45) % 360) / 90) % 4]
to Code: current_direction = directions_list[((directions_list.index(current_direction) +
(($game_system.fple2_angle + 45) % 360) / 90) + 2) % 4]
Posts: 422
Threads: 23
Joined: Aug 2011
Because I love this engine (and all of you~) here is an edit to make collision more fun.
replace "MODIFIED CLASES" with Code: #====================================================================
# FPLE Engine
# v.2.0
# Author : MGC
#====================================================================
#============================================================================
# ** RPG::MapInfo
#============================================================================
$data_maps = load_data("Data/MapInfos.rxdata")
class RPG::MapInfo
# defines the map's name as the name without anything within brackets,
# including brackets
def name
return @name.gsub(/\[.*\]/) {""}
end
#--------------------------------------------------------------------------
# the original name with the codes
def full_name
return @name
end
end
#============================================================================
# ** RPG::Cache
#============================================================================
module RPG
module Cache
def self.texture(filename)
self.load_bitmap("Graphics/FPLE2_Textures/", filename)
end
def self.heightmap(filename)
self.load_bitmap("Graphics/FPLE2_Heightmaps/", filename)
end
def self.colormap(filename)
self.load_bitmap("Graphics/FPLE2_Colormaps/", filename)
end
end
end
#==============================================================================
# ** Game_Temp
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# * Aliased methods (F12 compatibility)
#--------------------------------------------------------------------------
unless @already_aliased_fple2
alias initialize_fple2_game_temp initialize
@already_aliased_fple2 = true
end
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :fple2_refresh, :fple2_refresh_light
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
initialize_fple2_game_temp
self.fple2_refresh = false
self.fple2_refresh_light = false
end
end
#============================================================================
# ** Game_System
#============================================================================
class Game_System
COSTABLE = [4096, 4095, 4094, 4090, 4086,
4080, 4074, 4065, 4056, 4046, 4034, 4021, 4006, 3991, 3974,
3956, 3937, 3917, 3896, 3873, 3849, 3824, 3798, 3770, 3742,
3712, 3681, 3650, 3617, 3582, 3547, 3511, 3474, 3435, 3396,
3355, 3314, 3271, 3228, 3183, 3138, 3091, 3044, 2996, 2946,
2896, 2845, 2793, 2741, 2687, 2633, 2578, 2522, 2465, 2408,
2349, 2290, 2231, 2171, 2110, 2048, 1986, 1923, 1860, 1796,
1731, 1666, 1600, 1534, 1468, 1401, 1334, 1266, 1198, 1129,
1060, 991, 921, 852, 782, 711, 641, 570, 499, 428,
357, 286, 214, 143, 71, 0]
#--------------------------------------------------------------------------
# * Aliased methods (F12 compatibility)
#--------------------------------------------------------------------------
unless @already_aliased_fple2
alias initialize_fple2_game_system initialize
@already_aliased_fple2 = true
end
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :fple2
attr_accessor :fple2_view_distance
attr_accessor :fple2_light_distance
attr_accessor :fple2_resolution
attr_reader :fple2_angle, :fple2_target_angle
attr_accessor :fple2_rotation_direction, :fple2_rotation_speed
attr_reader :fple2_cos, :fple2_sin
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
initialize_fple2_game_system
self.fple2 = false
self.fple2_view_distance = 9 #EDIT was 6
self.fple2_light_distance = 18 #EDIT was 6
self.fple2_resolution = 1
self.fple2_angle = 0
self.fple2_target_angle = 0
self.fple2_rotation_direction = 1
self.fple2_rotation_speed = 8
end
#--------------------------------------------------------------------------
# * Setter for the angle of rotation
#--------------------------------------------------------------------------
def fple2_angle=(value)
@fple2_angle = value % 360
case @fple2_angle
when 0..90
@fple2_cos = COSTABLE[@fple2_angle]
@fple2_sin = COSTABLE[90 - @fple2_angle]
when 90..180
@fple2_cos = -COSTABLE[180 - @fple2_angle]
@fple2_sin = COSTABLE[@fple2_angle - 90]
when 180..270
@fple2_cos = -COSTABLE[@fple2_angle - 180]
@fple2_sin = -COSTABLE[90 - (@fple2_angle - 180)]
else
@fple2_cos = COSTABLE[360 - @fple2_angle]
@fple2_sin = -COSTABLE[@fple2_angle - 270]
end
unless $game_temp.nil?
$game_temp.fple2_refresh = true
end
end
#--------------------------------------------------------------------------
# * Setter for the target angle of rotation
#--------------------------------------------------------------------------
def fple2_target_angle=(value)
@fple2_target_angle = value % 360
end
end
#============================================================================
# ** Game_Map
#============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :data_tiles
#--------------------------------------------------------------------------
# * Aliased methods (F12 compatibility)
#--------------------------------------------------------------------------
unless @already_aliased_fple2
alias setup_fple2_game_map setup
@already_aliased_fple2 = true
end
#--------------------------------------------------------------------------
# * Setup
# map_id : map ID
#--------------------------------------------------------------------------
def setup(map_id)
setup_fple2_game_map(map_id)
map_data = $data_maps[$game_map.map_id]
$game_system.fple2 = map_data.full_name.include?("[FPLE2]") && !$fple2_data.nil?
if $game_system.fple2
@tileset_id = $data_tilesets[@map.tileset_id].id
if $fple2_data.has_key?(@tileset_id)
@data_tiles = $fple2_data[@tileset_id]
else
$game_system.fple2 = false
end
end
end
#--------------------------------------------------------------------------
# * Determine if Passable
# x : x-coordinate
# y : y-coordinate
# d : direction (0,2,4,6,8,10)
# * 0,10 = determine if all directions are impassable
# self_event : Self (If event is determined passable)
# In FPLE mode, the 3rd layer is ignored to determine if it is passable
#--------------------------------------------------------------------------
def passable?(x, y, d, self_event = nil)
# If coordinates given are outside of the map
unless valid?(x, y)
# impassable
return false
end
# Change direction (0,2,4,6,8,10) to obstacle bit (0,1,2,4,8,0)
bit = (1 << (d / 2 - 1)) & 0x0f
# Loop in all events
for event in events.values
# If tiles other than self are consistent with coordinates
if event.tile_id >= 0 and event != self_event and
event.x == x and event.y == y and not event.through
# If obstacle bit is set
if @passages[event.tile_id] & bit != 0
# impassable
return false
# If obstacle bit is set in all directions
elsif @passages[event.tile_id] & 0x0f == 0x0f
# impassable
return false
# If priorities other than that are 0
elsif @priorities[event.tile_id] == 0
# passable
return true
end
end
end
# Loop searches in order from top of layer
layers = $game_system.fple2 ? [1, 0] : [2, 1, 0]
for i in layers
# Get tile ID
tile_id = data[x, y, i]
# Tile ID acquistion failure
if tile_id == nil
# impassable
return false
# If obstacle bit is set
elsif @passages[tile_id] & bit != 0
# impassable
return false
# If obstacle bit is set in all directions
elsif @passages[tile_id] & 0x0f == 0x0f
# impassable
return false
# If priorities other than that are 0
elsif @priorities[tile_id] == 0
# passable
return true
end
end
# passable
return true
end
end
#============================================================================
# ** Game_Character
#============================================================================
class Game_Character
#--------------------------------------------------------------------------
# * Aliased methods (F12 compatibility)
#--------------------------------------------------------------------------
unless @already_aliased_fple2
alias initialize_fple2_game_character initialize
end
#--------------------------------------------------------------------------
# * Attributes
#--------------------------------------------------------------------------
attr_accessor :altitude
attr_accessor :type
attr_accessor :pos_x
attr_accessor :pos_y
attr_accessor :angle
attr_accessor :effect_radius
attr_reader :cos_angle, :sin_angle
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
initialize_fple2_game_character
self.altitude = 0
self.type = 2
self.pos_x = 16
self.pos_y = 16
self.angle = 0
self.effect_radius = 128
end
#--------------------------------------------------------------------------
# * Set Angle
#--------------------------------------------------------------------------
def angle=(new_angle)
@angle = new_angle % 360
angle_rad = (Math::PI * angle) / 180
@cos_angle = (4096 * Math.cos(angle_rad)).to_i
@sin_angle = (4096 * Math.sin(angle_rad)).to_i
end
end
#==============================================================================
# ** Game_Event
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# * Aliased methods (F12 compatibility)
#--------------------------------------------------------------------------
unless @already_aliased_fple2
alias refresh_fple2_game_character refresh
@already_aliased_fple2 = true
end
#--------------------------------------------------------------------------
# * Scan the event's commands list
# page : the scanned page (RPG::Event::Page)
#--------------------------------------------------------------------------
def check_commands(page)
self.type = 2
self.pos_x = 16
self.pos_y = 16
self.angle = 0
command_list = page.list
for k in 0..command_list.length - 2
command = command_list[k]
if command.code != 108 && command.code != 408 then next end
if command.parameters[0][/Wall/] != nil
self.type = 0
elsif command.parameters[0][/Pos/] != nil
coords = command.parameters[0].scan(/\d+/)
self.pos_x = (coords[0].nil? ? 16 : coords[0].to_i)
self.pos_y = (coords[1].nil? ? 16 : coords[1].to_i)
self.pos_x = [[pos_x, 0].max, 32].min
self.pos_y = [[pos_y, 0].max, 32].min
elsif command.parameters[0][/Angle/] != nil
s_angle = command.parameters[0].scan(/\d+/)
self.angle = (s_angle[0].nil? ? 0 : s_angle[0].to_i)
elsif command.parameters[0][/Radius/] != nil
s_radius = command.parameters[0].scan(/\d+/)
self.effect_radius = (s_radius[0].nil? ? 128 : s_radius[0].to_i)
elsif command.parameters[0][/Altitude/] != nil
s_altitude = command.parameters[0].scan(/\d+/)
self.altitude = (s_altitude[0].nil? ? 0 : s_altitude[0].to_i)
end
end
end
#--------------------------------------------------------------------------
# * Refresh
# Scan the event's commands list of the current page when refreshed
#--------------------------------------------------------------------------
def refresh
refresh_fple2_game_character
if @page != nil then check_commands(@page) end
end
end
#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
# Modification of player's moves in FPLE mode
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Aliased methods (F12 compatibility)
#--------------------------------------------------------------------------
unless @already_aliased_fple2
alias move_down_fple2_game_player move_down
alias move_left_fple2_game_player move_left
alias move_right_fple2_game_player move_right
alias move_up_fple2_game_player move_up
alias move_lower_left_fple2_game_player move_lower_left
alias move_lower_right_fple2_game_player move_lower_right
alias move_upper_left_fple2_game_player move_upper_left
alias move_upper_right_fple2_game_player move_upper_right
alias jump_fple2_game_player jump
alias turn_down_fple2_game_player turn_down
alias turn_left_fple2_game_player turn_left
alias turn_right_fple2_game_player turn_right
alias turn_up_fple2_game_player turn_up
alias update_move_fple2_game_player update_move
alias moving_fple2_game_player? moving?
@already_aliased_fple2 = true
end
#--------------------------------------------------------------------------
# * Display X
#--------------------------------------------------------------------------
def display_x
return real_x
end
#--------------------------------------------------------------------------
# * Display Y
#--------------------------------------------------------------------------
def display_y
return real_y + 128
end
#--------------------------------------------------------------------------
# * Move Down
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_down(turn_enabled = true)
if $game_system.fple2
case $game_player.direction
when 2
go_forward
when 4
strafe_left
when 6
strafe_right
when 8
go_backward
end
else
move_down_fple2_game_player(turn_enabled)
end
end
#--------------------------------------------------------------------------
# * Move Left
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_left(turn_enabled = true)
if $game_system.fple2
case $game_player.direction
when 2
strafe_right
when 4
go_forward
when 6
go_backward
when 8
strafe_left
end
else
move_left_fple2_game_player(turn_enabled)
end
end
#--------------------------------------------------------------------------
# * Move Right
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_right(turn_enabled = true)
if $game_system.fple2
case $game_player.direction
when 2
strafe_left
when 4
go_backward
when 6
go_forward
when 8
strafe_right
end
else
move_right_fple2_game_player(turn_enabled)
end
end
#--------------------------------------------------------------------------
# * Move up
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_up(turn_enabled = true)
if $game_system.fple2
case $game_player.direction
when 2
go_backward
when 4
strafe_right
when 6
strafe_left
when 8
go_forward
end
else
move_up_fple2_game_player(turn_enabled)
end
end
#--------------------------------------------------------------------------
# * Move Lower Left
#--------------------------------------------------------------------------
def move_lower_left
unless $game_system.fple2
move_lower_left_fple2_game_player
end
end
#--------------------------------------------------------------------------
# * Move Lower Right
#--------------------------------------------------------------------------
def move_lower_right
unless $game_system.fple2
move_lower_right_fple2_game_player
end
end
#--------------------------------------------------------------------------
# * Move Upper Left
#--------------------------------------------------------------------------
def move_upper_left
unless $game_system.fple2
move_upper_left_fple2_game_player
end
end
#--------------------------------------------------------------------------
# * Move Upper Right
#--------------------------------------------------------------------------
def move_upper_right
unless $game_system.fple2
move_upper_right_fple2_game_player
end
end
#--------------------------------------------------------------------------
# * Jump
# x_plus : x-coordinate plus value
# y_plus : y-coordinate plus value
#--------------------------------------------------------------------------
def jump(x_plus, y_plus)
unless $game_system.fple2
jump_fple2_game_player(x_plus, y_plus)
end
end
#--------------------------------------------------------------------------
# * Turn Down
#--------------------------------------------------------------------------
def turn_down
turn_down_fple2_game_player
if $game_system.fple2
$game_system.fple2_target_angle = 0
end
end
#--------------------------------------------------------------------------
# * Turn Left
#--------------------------------------------------------------------------
def turn_left
turn_left_fple2_game_player
if $game_system.fple2
$game_system.fple2_target_angle = 90
end
end
#--------------------------------------------------------------------------
# * Turn Right
#--------------------------------------------------------------------------
def turn_right
turn_right_fple2_game_player
if $game_system.fple2
$game_system.fple2_target_angle = 270
end
end
#--------------------------------------------------------------------------
# * Turn Up
#--------------------------------------------------------------------------
def turn_up
turn_up_fple2_game_player
if $game_system.fple2
$game_system.fple2_target_angle = 180
end
end
#--------------------------------------------------------------------------
# * Rotate Left
#--------------------------------------------------------------------------
def rotate_left
$game_system.fple2_rotation_direction = -1
turn_left_90
end
#--------------------------------------------------------------------------
# * Rotate Right
#--------------------------------------------------------------------------
def rotate_right
$game_system.fple2_rotation_direction = 1
turn_right_90
end
#--------------------------------------------------------------------------
# * Technical constants to handle relative reference of frame
#--------------------------------------------------------------------------
Forward = [[0, 1], [-1, 0], [1, 0], [0, -1]]
Left = [6, 2, 8, 4]
#--------------------------------------------------------------------------
# * Go Forward
#--------------------------------------------------------------------------
def go_forward
mvt_data = Forward[(@direction >> 1) - 1]
if passable?(@x, @y, @direction)
@x += mvt_data[0]
@y += mvt_data[1]
increase_steps
else
check_event_trigger_touch(@x + mvt_data[0], @y + mvt_data[1])
end
end
#--------------------------------------------------------------------------
# * Go Backward
#--------------------------------------------------------------------------
def go_backward
target_dir = 10 - @direction
mvt_data = Forward[(target_dir >> 1) - 1]
if passable?(@x, @y, target_dir)
@x += mvt_data[0]
@y += mvt_data[1]
increase_steps
else
check_event_trigger_touch(@x + mvt_data[0], @y + mvt_data[1])
end
end
#--------------------------------------------------------------------------
# * Strafe Left
#--------------------------------------------------------------------------
def strafe_left
target_dir = Left[(@direction >> 1) - 1]
mvt_data = Forward[(target_dir >> 1) - 1]
if passable?(@x, @y, target_dir)
@x += mvt_data[0]
@y += mvt_data[1]
increase_steps
else
check_event_trigger_touch(@x + mvt_data[0], @y + mvt_data[1])
end
end
#--------------------------------------------------------------------------
# * Strafe Right
#--------------------------------------------------------------------------
def strafe_right
target_dir = 10 - Left[(@direction >> 1) - 1]
mvt_data = Forward[(target_dir >> 1) - 1]
if passable?(@x, @y, target_dir)
@x += mvt_data[0]
@y += mvt_data[1]
increase_steps
else
check_event_trigger_touch(@x + mvt_data[0], @y + mvt_data[1])
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Remember whether or not moving in local variables
last_moving = moving?
# If moving, event running, move route forcing, and message window
# display are all not occurring
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
if $game_system.fple2
# FPLE moves
if Input.press?(Input::LEFT)
rotate_left
elsif Input.press?(Input::RIGHT)
rotate_right
end
if Input.press?(Input::L)
strafe_left
elsif Input.press?(Input::R)
strafe_right
end
if Input.press?(Input::UP)
go_forward
elsif Input.press?(Input::DOWN)
go_backward
end
else
# Move player in the direction the directional button is being pressed
case Input.dir4
when 2
move_down
when 4
move_left
when 6
move_right
when 8
move_up
end
end
end
# Remember coordinates in local variables
last_real_x = @real_x
last_real_y = @real_y
super
# If character moves down and is positioned lower than the center
# of the screen
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
# Scroll map down
$game_map.scroll_down(@real_y - last_real_y)
end
# If character moves left and is positioned more let on-screen than
# center
if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
# Scroll map left
$game_map.scroll_left(last_real_x - @real_x)
end
# If character moves right and is positioned more right on-screen than
# center
if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
# Scroll map right
$game_map.scroll_right(@real_x - last_real_x)
end
# If character moves up and is positioned higher than the center
# of the screen
if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
# Scroll map up
$game_map.scroll_up(last_real_y - @real_y)
end
# If not moving
if not moving? or ($game_system.fple2 and moving? and @steps != $game_party.steps)
# If player was moving last time
if last_moving
@steps = $game_party.steps
#$game_temp.last_moving = false
# Event determinant is via touch of same position event
result = check_event_trigger_here([1,2])
# If event which started does not exist
if result == false or ($game_system.fple2 and result == false and
passable?(@x, @y, @direction))
# Disregard if debug mode is ON and ctrl key was pressed
unless $DEBUG and Input.press?(Input::CTRL)
# Encounter countdown
if @encounter_count > 0
@encounter_count -= 1
end
end
end
end
# If C button was pressed
if Input.trigger?(Input::C)
# Same position and front event determinant
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end
end
#--------------------------------------------------------------------------
# * Determine if Moving
#--------------------------------------------------------------------------
def moving?
if $game_system.fple2
return moving_fple2_game_player? ||
$game_system.fple2_angle != $game_system.fple2_target_angle
else
return moving_fple2_game_player?
end
end
#--------------------------------------------------------------------------
# * Update frame (move)
#--------------------------------------------------------------------------
def update_move
if $game_system.fple2_angle != $game_system.fple2_target_angle
$game_system.fple2_angle += $game_system.fple2_rotation_speed * $game_system.fple2_rotation_direction
delta = $game_system.fple2_target_angle - $game_system.fple2_angle
if delta.abs < $game_system.fple2_rotation_speed
$game_system.fple2_angle = $game_system.fple2_target_angle
end
end
update_move_fple2_game_player
end
end
#============================================================================
# ** Spriteset_Map
#============================================================================
class Spriteset_Map
attr_reader :fple
#--------------------------------------------------------------------------
# * Aliased methods (F12 compatibility)
#--------------------------------------------------------------------------
unless @already_aliased_fple2
alias initialize_fple2_spriteset_map initialize
alias dispose_fple2_spriteset_map dispose
alias update_fple2_spriteset_map update
@already_aliased_fple2 = true
end
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
if $game_system.fple2
# Make viewports
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport1.oy = -128
@viewport2.z = 200
@viewport3.z = 5000
# Make panorama plane
@panorama = Plane.new(@viewport1)
@panorama.z = -1000
# Make fog plane
@fog = Plane.new(@viewport1)
@fog.z = 3000
# Make weather
@weather = RPG::Weather.new(@viewport1)
# Make picture sprites
@picture_sprites = []
for i in 1..50
@picture_sprites.push(Sprite_Picture.new(@viewport2,
$game_screen.pictures[i]))
end
# Make timer sprite
@timer_sprite = Sprite_Timer.new
# FPLE2
@character_surfaces = []
@fple = FPLE2::Render.new(self, @viewport1)
# Make character surfaces
for i in $game_map.events.keys.sort
surface = FPLE2::Surface.new($game_map.events[i], @viewport1, @fple)
@character_surfaces.push(surface)
end
# Frame update
update
else
initialize_fple2_spriteset_map
end
end
#--------------------------------------------------------------------------
# * Get Surfaces
#--------------------------------------------------------------------------
def surfaces
return @character_surfaces
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
if @tilemap.nil?
# Dispose of FPLE2
@fple.dispose
# Dispose of panorama plane
@panorama.dispose
# Dispose of fog plane
@fog.dispose
# Dispose of weather
@weather.dispose
# Dispose of picture sprites
for sprite in @picture_sprites
sprite.dispose
end
# Dispose of timer sprite
@timer_sprite.dispose
# Dispose of viewports
@viewport1.dispose
@viewport2.dispose
@viewport3.dispose
else
dispose_fple2_spriteset_map
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
if $game_system.fple2
# If panorama is different from current one
if @panorama_name != $game_map.panorama_name or
@panorama_hue != $game_map.panorama_hue
@panorama_name = $game_map.panorama_name
@panorama_hue = $game_map.panorama_hue
if @panorama.bitmap != nil
@panorama.bitmap.dispose
@panorama.bitmap = nil
end
if @panorama_name != ""
@panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
end
Graphics.frame_reset
end
# If fog is different than current fog
if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue
@fog_name = $game_map.fog_name
@fog_hue = $game_map.fog_hue
if @fog.bitmap != nil
@fog.bitmap.dispose
@fog.bitmap = nil
end
if @fog_name != ""
@fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
end
Graphics.frame_reset
end
# FPLE2
# Update character sprites
@character_surfaces.each{|surface| surface.update}
@fple.update
# Update panorama plane
@panorama.ox = $game_map.display_x / 8
@panorama.oy = $game_map.display_y / 8
# Update fog plane
@fog.zoom_x = $game_map.fog_zoom / 100.0
@fog.zoom_y = $game_map.fog_zoom / 100.0
@fog.opacity = $game_map.fog_opacity
@fog.blend_type = $game_map.fog_blend_type
@fog.ox = $game_map.display_x / 4 + $game_map.fog_ox
@fog.oy = $game_map.display_y / 4 + $game_map.fog_oy
@fog.tone = $game_map.fog_tone
# Update weather graphic
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.ox = $game_map.display_x / 4
@weather.oy = $game_map.display_y / 4
@weather.update
# Update picture sprites
for sprite in @picture_sprites
sprite.update
end
# Update timer sprite
@timer_sprite.update
# Set screen color tone and shake position
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
#TEST
# If C button was pressed
if Input.press?(Input::X)
@viewport1.oy += 4
elsif Input.press?(Input::Y)
@viewport1.oy -= 4
end
# Set screen flash color
@viewport3.color = $game_screen.flash_color
# Update viewports
@viewport1.update
@viewport3.update
else
update_fple2_spriteset_map
end
end
end
#============================================================================
# ** Scene_Title
#============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# * Aliased methods (F12 compatibility)
#--------------------------------------------------------------------------
unless @already_aliased_fple2
alias main_fple2_scene_title main
@already_aliased_fple2 = true
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
if FileTest.exist?("Data/FPLE2_Data.rxdata")
$fple2_data = load_data("Data/FPLE2_Data.rxdata")
end
main_fple2_scene_title
end
end
#==============================================================================
# ** Scene_Map
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Set view distance
#--------------------------------------------------------------------------
def set_view(distance)
if distance < 0 then distance = 0 end
$game_system.fple2_view_distance = distance
if $game_system.fple2
@spriteset.fple.params[6] = $game_system.fple2_view_distance
end
$game_temp.fple2_refresh = true
end
#--------------------------------------------------------------------------
# * Set light distance
#--------------------------------------------------------------------------
def set_light(distance)
if distance < 0 then distance = 0 end
$game_system.fple2_light_distance = distance
$game_temp.fple2_refresh_light = true
$game_temp.fple2_refresh = true
end
#--------------------------------------------------------------------------
# * Increase light distance
#--------------------------------------------------------------------------
def increase_light
$game_system.fple2_light_distance += 1
$game_temp.fple2_refresh_light = true
$game_temp.fple2_refresh = true
end
#--------------------------------------------------------------------------
# * Decrease light distance
#--------------------------------------------------------------------------
def decrease_light
if $game_system.fple2_light_distance > 1
$game_system.fple2_light_distance -= 1
end
$game_temp.fple2_refresh_light = true
$game_temp.fple2_refresh = true
end
end
and replace "[WIP] FPLE2 Game_Player Free Mvts" with Code: #====================================================================
# FPLE Engine
# v.2.0
# Author : MGC
#====================================================================
#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
# Free rotation for the player in FPLE2 mode
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Aliased methods (F12 compatibility)
#--------------------------------------------------------------------------
unless @already_aliased_fple2
alias move_down_fple2_game_player move_down
alias move_left_fple2_game_player move_left
alias move_right_fple2_game_player move_right
alias move_up_fple2_game_player move_up
alias move_lower_left_fple2_game_player move_lower_left
alias move_lower_right_fple2_game_player move_lower_right
alias move_upper_left_fple2_game_player move_upper_left
alias move_upper_right_fple2_game_player move_upper_right
alias jump_fple2_game_player jump
alias update_move_fple2_game_player update_move
alias moving_fple2_game_player moving?
@already_aliased_fple2 = true
end
#--------------------------------------------------------------------------
# * Move Down
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_down(turn_enabled = true)
if $game_system.fple2
case direction
when 2
go_forward
when 4
strafe_left
when 6
strafe_right
when 8
go_backward
end
else
move_down_fple2_game_player(turn_enabled)
end
end
#--------------------------------------------------------------------------
# * Move Left
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_left(turn_enabled = true)
if $game_system.fple2
case direction
when 2
strafe_right
when 4
go_forward
when 6
go_backward
when 8
strafe_left
end
else
move_left_fple2_game_player(turn_enabled)
end
end
#--------------------------------------------------------------------------
# * Move Right
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_right(turn_enabled = true)
if $game_system.fple2
case direction
when 2
strafe_left
when 4
go_backward
when 6
go_forward
when 8
strafe_right
end
else
move_right_fple2_game_player(turn_enabled)
end
end
#--------------------------------------------------------------------------
# * Move up
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_up(turn_enabled = true)
if $game_system.fple2
case direction
when 2
go_backward
when 4
strafe_right
when 6
strafe_left
when 8
go_forward
end
else
move_up_fple2_game_player(turn_enabled)
end
end
#--------------------------------------------------------------------------
# * Move Lower Left
#--------------------------------------------------------------------------
def move_lower_left
unless $game_system.fple2
move_lower_left_fple2_game_player
end
end
#--------------------------------------------------------------------------
# * Move Lower Right
#--------------------------------------------------------------------------
def move_lower_right
unless $game_system.fple2
move_lower_right_fple2_game_player
end
end
#--------------------------------------------------------------------------
# * Move Upper Left
#--------------------------------------------------------------------------
def move_upper_left
unless $game_system.fple2
move_upper_left_fple2_game_player
end
end
#--------------------------------------------------------------------------
# * Move Upper Right
#--------------------------------------------------------------------------
def move_upper_right
unless $game_system.fple2
move_upper_right_fple2_game_player
end
end
#--------------------------------------------------------------------------
# * Jump
# x_plus : x-coordinate plus value
# y_plus : y-coordinate plus value
#--------------------------------------------------------------------------
def jump(x_plus, y_plus)
unless $game_system.fple2
jump_fple2_game_player(x_plus, y_plus)
end
end
#--------------------------------------------------------------------------
# * Rotate Left
#--------------------------------------------------------------------------
def rotate_left
$game_system.fple2_angle -= 4
directions_list = [8, 6, 2, 4]
@direction = directions_list[((
(($game_system.fple2_angle + 45) % 360) / 90) + 2) % 4]
end
#--------------------------------------------------------------------------
# * Rotate Right
#--------------------------------------------------------------------------
def rotate_right
$game_system.fple2_angle += 4
directions_list = [8, 6, 2, 4]
@direction = directions_list[((
(($game_system.fple2_angle + 45) % 360) / 90) + 2) % 4]
end
#--------------------------------------------------------------------------
# * Technical constants to handle relative reference of frame
#--------------------------------------------------------------------------
Forward = [[0, 1], [-1, 0], [1, 0], [0, -1]]
Left = [6, 2, 8, 4]
#--------------------------------------------------------------------------
def update_move
if $game_system.fple2
return
else
update_move_fple2_game_player
end
end
#--------------------------------------------------------------------------
def moving?
if $game_system.fple2
return false
else
moving_fple2_game_player
end
end
#--------------------------------------------------------------------------
# * Go Forward
#--------------------------------------------------------------------------
def go_forward
old_y = @y
old_x = @x
target_x = @real_x - (8 * $game_system.fple2_sin >> 12)
target_y = @real_y + (8 * $game_system.fple2_cos >> 12)
if fple2_passable_x?(target_x)
@real_x = target_x
#TODO: make x register better
@x = (@real_x + 84) >> 7
else
@real_x = @real_x #TEST was(@real_x + 64 >> 7 << 7).to_i
@x = (@real_x + 84) >> 7
end
if fple2_passable_y?(target_y)
@real_y = target_y
@y = (@real_y + 84) >> 7
else
@real_y = @real_y #TEST was (@real_y + 64 >> 7 << 7).to_i
@y = (@real_y + 84) >> 7
end
if (old_y != @y || old_x != @x)
increase_steps
end
end
#--------------------------------------------------------------------------
def fple2_passable_x?(target_x)
x_tile = target_x >> 7
y_tile = @real_y >> 7
unless $game_map.passable?(x_tile, y_tile, direction, self)
return false
end
if @real_y - (y_tile << 7) > 0
unless $game_map.passable?(x_tile, y_tile + 1, direction, self)
return false
end
end
if target_x - (x_tile << 7) > 0
unless $game_map.passable?(x_tile + 1, y_tile, direction, self)
return false
end
if @real_y - (y_tile << 7) > 0
unless $game_map.passable?(x_tile + 1, y_tile + 1, direction, self)
return false
end
end
end
# Loop all events
for event in $game_map.events.values
# If event coordinates are consistent with move destination
#if ((event.x == x_tile && event.y == y_tile) ||
# (@real_y - (y_tile << 7) > 0 && (event.x == x_tile && event.y == y_tile+1)) ||
# (target_x - (x_tile << 7) > 0 && (event.x == x_tile+1 && event.y == y_tile)) ||
# (@real_y - (y_tile << 7) > 0 && (event.x == x_tile+1 && event.y == y_tile+1)))
if ( (target_x < (event.real_x + ((event.pos_x - 16) << 2)) + event.effect_radius &&
target_x > (event.real_x + ((event.pos_x - 16) << 2)) - event.effect_radius) &&
(@real_y < (event.real_y + ((event.pos_y - 16) << 2)) + event.effect_radius &&
@real_y > (event.real_y + ((event.pos_y - 16) << 2)) - event.effect_radius))
# If through is OFF
unless event.through
# With self as the player and partner graphic as character
if event.character_name != ""
# impassable
return false
end
end
end
end
return true
end
#--------------------------------------------------------------------------
def fple2_passable_y?(target_y)
y_tile = target_y >> 7
x_tile = @real_x >> 7
unless $game_map.passable?(x_tile, y_tile, direction, self)
return false
end
if @real_x - (x_tile << 7) > 0
unless $game_map.passable?(x_tile + 1, y_tile, direction, self)
return false
end
end
if target_y - (y_tile << 7) > 0
unless $game_map.passable?(x_tile, y_tile + 1, direction, self)
return false
end
if @real_x - (x_tile << 7) > 0
unless $game_map.passable?(x_tile + 1, y_tile + 1, direction, self)
return false
end
end
end
# Loop all events
for event in $game_map.events.values
# If event coordinates are consistent with move destination
#if ((event.x == x_tile && event.y == y_tile) ||
# (@real_x - (x_tile << 7) > 0 && (event.x == x_tile+1 && event.y == y_tile)) ||
# (target_y - (y_tile << 7) > 0 && (event.x == x_tile && event.y == y_tile+1)) ||
# (@real_x - (x_tile << 7) > 0 && (event.x == x_tile+1 && event.y == y_tile+1)))
if ( (@real_x < (event.real_x + ((event.pos_x-16) << 2)) + event.effect_radius &&
@real_x > (event.real_x + ((event.pos_x-16) << 2)) - event.effect_radius) &&
(target_y < (event.real_y + ((event.pos_y-16) << 2)) + event.effect_radius &&
target_y > (event.real_y + ((event.pos_y-16) << 2)) - event.effect_radius))
# If through is OFF
unless event.through
# With self as the player and partner graphic as character
if event.character_name != ""
# impassable
return false
end
end
end
end
return true
end
#--------------------------------------------------------------------------
# * Go Backward
#--------------------------------------------------------------------------
def go_backward
old_y = @y
old_x = @x
target_x = @real_x + (8 * $game_system.fple2_sin >> 12)
target_y = @real_y - (8 * $game_system.fple2_cos >> 12)
if fple2_passable_x?(target_x)
@real_x = target_x
@x = (@real_x + 84) >> 7
end
if fple2_passable_y?(target_y)
@real_y = target_y
@y = (@real_y + 84) >> 7
end
if (old_y != @y || old_x != @x)
increase_steps
end
end
#--------------------------------------------------------------------------
# * Strafe Left
#--------------------------------------------------------------------------
def strafe_left
old_y = @y
old_x = @x
target_x = @real_x + (8 * $game_system.fple2_cos >> 12)
target_y = @real_y + (8 * $game_system.fple2_sin >> 12)
if fple2_passable_x?(target_x)
@real_x = target_x
@x = (@real_x + 84) >> 7
end
if fple2_passable_y?(target_y)
@real_y = target_y
@y = (@real_y + 84) >> 7
end
if (old_y != @y || old_x != @x)
increase_steps
end
end
#--------------------------------------------------------------------------
# * Strafe Right
#--------------------------------------------------------------------------
def strafe_right
old_y = @y
old_x = @x
target_x = @real_x - (8 * $game_system.fple2_cos >> 12)
target_y = @real_y - (8 * $game_system.fple2_sin >> 12)
if fple2_passable_x?(target_x)
@real_x = target_x
@x = (@real_x + 84) >> 7
end
if fple2_passable_y?(target_y)
@real_y = target_y
@y = (@real_y + 84) >> 7
end
if (old_y != @y || old_x != @x)
increase_steps
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Remember whether or not moving in local variables
last_moving = moving?
# If moving, event running, move route forcing, and message window
# display are all not occurring
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
if $game_system.fple2
# FPLE moves
if Input.press?(Input::LEFT)
rotate_left
elsif Input.press?(Input::RIGHT)
rotate_right
end
if Input.press?(Input::L)
strafe_left
elsif Input.press?(Input::R)
strafe_right
end
if Input.press?(Input::UP)
go_forward
elsif Input.press?(Input::DOWN)
go_backward
end
else
# Move player in the direction the directional button is being pressed
case Input.dir4
when 2
move_down
when 4
move_left
when 6
move_right
when 8
move_up
end
end
end
# Remember coordinates in local variables
last_real_x = @real_x
last_real_y = @real_y
super
# If character moves down and is positioned lower than the center
# of the screen
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
# Scroll map down
$game_map.scroll_down(@real_y - last_real_y)
end
# If character moves left and is positioned more let on-screen than
# center
if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
# Scroll map left
$game_map.scroll_left(last_real_x - @real_x)
end
# If character moves right and is positioned more right on-screen than
# center
if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
# Scroll map right
$game_map.scroll_right(@real_x - last_real_x)
end
# If character moves up and is positioned higher than the center
# of the screen
if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
# Scroll map up
$game_map.scroll_up(last_real_y - @real_y)
end
# If not moving
if !moving? || ($game_system.fple2 && moving? && @steps != $game_party.steps)
# If player was moving last time
if last_moving
p "I don't think this is firing"
@steps = $game_party.steps
$game_temp.last_moving = false
# Event determinant is via touch of same position event
result = check_event_trigger_here([1,2])
# If event which started does not exist
if result == false || ($game_system.fple && result == false &&
passable?(@x, @y, @direction))
# Disregard if debug mode is ON and ctrl key was pressed
unless $DEBUG and Input.press?(Input::CTRL)
# Encounter countdown
if @encounter_count > 0
@encounter_count -= 1
end
end
end
end
# If C button was pressed
if Input.trigger?(Input::C)
p "Honk! X: " + @x.to_s + ", Y: " + @y.to_s + ", Dir: " + @direction.to_s
# Same position and front event determinant
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end
end
end
Now you can, in an event page Comment, specify a collision radius. Use "Radius XX" where XX = 0-128. In most cases you'll probably want to use the width of the sprite, but not always! With this you could, for example, make a palm tree sprite and walk under its leaves. Keep in mind this is only for the Player, so Events are still going to get stuck on tiny rocks and such.
Posts: 15
Threads: 4
Joined: Jan 2018
01-08-2018, 04:06 AM
(This post was last modified: 01-08-2018, 06:42 AM by Darkantuan.)
Evens are appearing at 3x their normal size
|