Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #begin
- #==============================================================================
- #==============================================================================
- #==============================================================================
- #Light Circle Script v1.11 updated(23-05-2011)
- #==============================================================================
- #==============================================================================
- #==============================================================================
- class Scene_Save < Scene_File
- alias alias_write_save_data write_save_data
- def write_save_data(file)
- alias_write_save_data(file)
- Marshal.dump($sensitivity,file)
- Marshal.dump($sensitivity_2,file)
- Marshal.dump($light_switch,file)
- Marshal.dump($flick,file)
- end
- end
- #==============================================================================
- class Scene_Load < Scene_File
- alias t_read_save_data read_save_data
- def read_save_data(file)
- t_read_save_data(file)
- $sensitivity = Marshal.load(file)
- $sensitivity_2 = Marshal.load(file)
- $light_switch = Marshal.load(file)
- $flick = Marshal.load(file)
- end
- end
- #==============================================================================
- class Game_Player< Game_Character
- def change_sensitivity(value,type)
- case type
- when "sensitivity"
- $sensitivity=value
- when "sensitivity_2"
- $sensitivity_2[0]=value
- end
- end
- end
- #==============================================================================
- class Scene_Map
- def spriteset
- return @spriteset
- end
- end
- #==============================================================================
- #==============================================================================
- #==============================================================================
- class Scene_Title
- alias alias_main main
- #--------------------------------------------------------------------------
- # * change initial sensitivity here
- #--------------------------------------------------------------------------
- def main
- $light_switch=1
- $sensitivity_2=[]
- $sensitivity_2[0]=90
- $flick=0
- alias_main
- end
- #--------------------------------------------------------------------------
- # * change initial sensitivity here
- #--------------------------------------------------------------------------
- end
- #==============================================================================
- #==============================================================================
- #==============================================================================
- # ** Spriteset_Map
- #------------------------------------------------------------------------------
- # This class brings together map screen sprites, tilemaps, etc.
- # It's used within the Scene_Map class.
- #==============================================================================
- #==============================================================================
- #==============================================================================
- class Spriteset_Map
- attr_accessor :tone
- attr_accessor :light_limit
- attr_accessor :x_limit
- attr_accessor :y_limit
- alias alias_update update
- alias alias_initialize initialize
- alias alias_dispose dispose
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- #--------------------------------------------------------------------------
- # * change initial setting
- #--------------------------------------------------------------------------
- @tone=30#30
- @light_limit=15#15
- @x_limit=6
- @y_limit=5
- #--------------------------------------------------------------------------
- # * change initial setting
- #--------------------------------------------------------------------------
- @opacity=[]
- @random=[]
- @r_value=[]
- @x_x=[]
- @y_y=[]
- @xx=[]
- @yy=[]
- @event_rx=[]
- @event_ry=[]
- @event_coor_x=[]
- @event_coor_y=[]
- @sensitivity=[]
- @viewport=[]
- @viewport[0]=[]
- @viewport[1]=[]
- @viewport[2]=[]
- @viewport[3]=[]
- @viewport[4]=[]
- @d=6
- @frame=3
- @event_frame_x_highlimit=[]
- @event_frame_y_highlimit=[]
- @event_frame_x_lowlimit=[]
- @event_frame_y_lowlimit=[]
- get_event_data
- #------------------------------------
- for @y in 0..15
- @opacity[@y]=[]
- @viewport[0][@y]=[]
- @viewport[1][@y]=[]
- @viewport[2][@y]=[]
- @viewport[3][@y]=[]
- @viewport[4][@y]=[]
- for @x in 0..20
- @viewport[0][@y][@x] = Viewport.new(@x*32-16, @y*32-16, 32, 32)
- @viewport[0][@y][@x].tone = Tone.new(-255, -255, -255, 0)
- @viewport[0][@y][@x].z = 199
- @viewport[1][@y][@x]= Viewport.new(@x*32-16+@d, @y*32-16+@d, 32, 32)
- @viewport[1][@y][@x].tone = Tone.new(-255, -255, -255, 0)
- @viewport[1][@y][@x].z = 199
- =begin
- @viewport[2][@y][@x] = Viewport.new(@x*32-16+@d*2, @y*32-16+@d*2, 32, 32)
- @viewport[2][@y][@x].tone = Tone.new(-255, -255, -255, 0)
- @viewport[2][@y][@x].z = 199
- @viewport[3][@y][@x]= Viewport.new(@x*32-16-@d, @y*32-16-@d, 32, 32)
- @viewport[3][@y][@x].tone = Tone.new(-255, -255, -255, 0)
- @viewport[3][@y][@x].z = 199
- @viewport[4][@y][@x]= Viewport.new(@x*32-16-@d*2, @y*32-16-@d*2, 32, 32)
- @viewport[4][@y][@x].tone = Tone.new(-255, -255, -255, 0)
- @viewport[4][@y][@x].z = 199
- =end
- @opacity[@y][@x]=-@tone
- end
- end
- alias_initialize
- end
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- # * Dispose
- #--------------------------------------------------------------------------
- def dispose
- alias_dispose
- for @y in 0..15
- for @x in 0..20
- for i in 0..1#4
- @viewport[i][@y][@x].dispose
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Dispose
- #--------------------------------------------------------------------------
- def update
- if Graphics.frame_rate<36
- @frame=2#4
- else
- @frame=1#3
- end
- @ccc=0 if @ccc==nil
- @ccc2=0 if @ccc2==nil
- if @ccc2 % @frame==0
- if @ccc==0
- if $light_switch==1
- @random[0]=rand($flick+1)
- #------------------
- get_event_data
- #-------------------
- i=1
- loop do
- @r_value[i]=0 if @r_value[i]==nil
- @random[i]=rand(@r_value[i]+1)
- break if i==@light_limit || @r_value[i]==nil
- i+=1
- end
- @player_rx=($game_player.real_x-$game_map.display_x)/4
- @player_ry=($game_player.real_y-$game_map.display_y)/4
- @player_coor_x= (@player_rx+16)/32
- @player_coor_y= (@player_ry+16)/32
- @sensitivity[0]=$sensitivity_2[0]+@random[0]
- i=1
- loop do
- break if @xx[i]==nil
- @event_rx[i]=(@xx[i]-$game_map.display_x/4)
- @event_ry[i]=(@yy[i]-$game_map.display_y/4)
- @event_coor_x[i]=(@event_rx[i]+16)/32
- @event_coor_y[i]=(@event_ry[i]+16)/32
- @sensitivity[i]=$sensitivity_2[i]+@random[i]
- @sensitivity[i]=100 if @sensitivity[i]>100
- i+=1
- end
- @event_seq=1
- for @y in 0..15
- for @x in 0..20
- @opacity[@y][@x] =@sensitivity[0]/((@x-@player_coor_x)**2+(@y-@player_coor_y)**2+5)
- end
- end
- loop do
- break if @xx[@event_seq]==nil
- if (@player_coor_x-@event_coor_x[@event_seq]).abs<@x_limit && (@player_coor_y-@event_coor_y[@event_seq]).abs<@y_limit
- @area_limit=(@sensitivity[@event_seq]/12).to_i
- @event_frame_x_highlimit[@event_seq]=@event_coor_x[@event_seq]+@area_limit
- @event_frame_x_lowlimit[@event_seq]=@event_coor_x[@event_seq]-@area_limit
- @event_frame_y_highlimit[@event_seq]=@event_coor_y[@event_seq]+@area_limit
- @event_frame_y_lowlimit[@event_seq]=@event_coor_y[@event_seq]-@area_limit
- @event_frame_x_highlimit[@event_seq] =20 if @event_frame_x_highlimit[@event_seq]>20
- @event_frame_x_lowlimit[@event_seq] =0 if @event_frame_x_lowlimit[@event_seq]<0
- @event_frame_y_highlimit[@event_seq] =15 if @event_frame_y_highlimit[@event_seq]>15
- @event_frame_y_lowlimit[@event_seq] =0 if @event_frame_y_lowlimit[@event_seq]<0
- for @y in @event_frame_y_lowlimit[@event_seq]..@event_frame_y_highlimit[@event_seq]
- for @x in @event_frame_x_lowlimit[@event_seq]..@event_frame_x_highlimit[@event_seq]
- @opacity[@y][@x] +=@sensitivity[@event_seq]/((@x-@event_coor_x[@event_seq])**2+(@y-@event_coor_y[@event_seq])**2+5)
- end
- end
- end
- @event_seq+=1
- end
- for @y in 0..15
- for @x in 0..20
- a=@opacity[@y][@x]
- a-=@tone
- a=0 if a>0
- a=-@tone if a<-@tone
- @viewport[0][@y][@x].tone=Tone.new(a, a, a)
- end
- end
- @on=nil if @on != nil
- else
- if @on==nil
- for @y in 0..15
- for @x in 0..20
- a=Tone.new(0,0,0, 0)
- for i in 0..1#4
- @viewport[i][@y][@x].tone =a
- end
- end
- end
- @on=true
- end
- #-------------------
- end
- else
- for @y in 0..15
- @x=0
- loop do
- @viewport[@ccc][@y][@x].tone=@viewport[0][@y][@x].tone
- break if @x==20
- @x+=1
- end
- end
- end
- @ccc+=1
- @ccc=0 if @ccc==1#5
- end
- @ccc2+=1
- @ccc2=0 if @ccc2==@frame
- alias_update
- end
- end
- #--------------------------------------------------------------------------
- # * Event Data Setup(get information from events)
- #--------------------------------------------------------------------------
- def get_event_data
- for event in $game_map.events.values
- if event.list && event.list[0].code == 108
- i=1
- loop do
- if event.list[0].parameters.to_s == i.to_s
- @xx[i]=event.x*32
- @yy[i]=event.y*32
- $sensitivity_2[i]=event.list[1].parameters.to_s .to_i
- @r_value[i]=event.list[2].parameters.to_s .to_i
- end
- break if i== @light_limit
- i+=1
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Event Data Setup(get information from events)
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- # * Frame Update (perform algorithms that calculate opacity of each coordinations)
- #--------------------------------------------------------------------------
- #==============================================================================
- #==============================================================================
- #==============================================================================
- #end
Advertisement
Add Comment
Please, Sign In to add comment