Jump to content
Rpg²S Forum

the-joker

Banned
  • Posts

    489
  • Joined

  • Last visited

Posts posted by the-joker

  1. Allora...per attivare lo script devi inserire all'inizio del gioco, un auto start con dentro il call script:

    $game_ddns.turn_on

    $game_ddns.go_outside

    $game_ddns.make_it_day

     

    Poi per disattivarlo durante il gioco basta usare il comando :$game_ddns.turn_off

    (per attivarlo poi : $game_ddns.turn_on)

     

    Inoltre ad ogni teletrasporto devi aggiungere un call script che è

    questo se la mappa dove ti teletrasporta è una mappa esterna : $game_ddns.go_outside

    mentre questo se è una mappa interna : $game_ddns.go_inside.

     

    A me funziona.

    Volevo sapere però se qualcuno riesce ad aggiungere che quando si fa giorno o notte, la transition sia più lunga. Inoltre vorrei che si attivassero due swich :una per il giorno e una per la notte.

    Così si possono gestire gli eventi sia di giorno che di notte.

    Grazie.

  2. Basta che metti un evento vuoto sulla mappa senza parallel process, basta anche action key, ma dentro devi inserire due commenti: il primo deve essere "Light Effects" senza le virgolette, il secondo

    "Fire"senza le virgolette.

  3. Uno script per creare un puzzle

    Screen:
    http://img389.imageshack.us/my.php?image=screen3ub.png

    Create una classe sopra main e inserite questo.

    L'immagine del puzzle deve essere 420x420 pixel

    Per chiamare l'evento inserite questo codice di esempio:


    CODICE
    $scene = Scene_Puzle.new(180, "Puzzleinizio", 3, 90, "Back")


    Dove:
    1) 180 è la misura dei pezzi;
    2) Puzzleinizio è l'immagine del puzzle che va messa in Graphics\Pictures;
    3) 90 sono i secondi che avete per risolverlo, mettere "false" per tempo illimitato;
    4) Back è l'immagine che volete mettere come sfondo al vostro puzzle, sempre 420 x 420 pixel, cartella Graphics\Pictures.
     

     

    #==============================================================================
    # ? Scene_Puzle - By DarkRog - Versión Pase automático de piezas.
    =begin
    You need a picture with size 420px x 420px, in Graphics/Pictures.
    You have to call a script from an event and write:
    $scene = Scene_Puzle.new(piece size , "picture", variable id (this variable will be the result of the game), time, background)
    *The size has to be dividing of 420.
    *The picture need to be in Graphics/Picture.
    *The variable id:
    1:You won, 2:Time up.
    *Seconds, or false for unlimited time.
    *A background image in Graphics/Picture, or false for any picture.
    Example:
    $scene = Scene_Puzle.new(140, "Puzle1", 3, 30, "Back")
    Size:140, Picture:"Puzle1", Variable:3, Seconds:30 Background:"Back".
    =end
    #------------------------------------------------------------------------------
    
    class Scene_Puzle
    	def initialize(size, img, vid, tim, back)
    		@pu = Window_Puzle.new(size, img, vid, tim, back)
    	end
    	def main
    		Graphics.transition
    		loop do
    			Graphics.update
    			Input.update
    			update
    			if $scene != self
    				break
    			end
    		end
    		Graphics.freeze
    		@pu.dispose
    		if $scene.is_a?(Scene_Title)
    			Graphics.transition
    			Graphics.freeze
    		end
    	end
    	def update
    		@pu.refresh
    	end
    end
    
    class Window_Puzle < Window_Base
    	def initialize(size, img, vid, tim, back)
    		super(-16, -16, 640+32, 480+32)
    		self.contents = Bitmap.new(width - 32, height - 32)
    		self.contents.font.name = $fontface
    		self.contents.font.size = 23
    		@back = back
    		@vid = vid
    		@piezasi = size
    		@img = img
    		@winb = Window_PBrillo.new
    		if tim == false
    			@timeh = false
    		else
    			@time = tim*25
    			@timeh = true
    		end
    		@pieza = []
    		piezas = []
    		num = 0
    		for i in 0..420/@piezasi-1
    			for a in 0..420/@piezasi-1
    				@pieza[num] = Pieza_Puzle.new(a, i)
    				piezas[num] = num
    				num += 1
    			end
    		end
    		@op = []
    		for i in 0..420/@piezasi*420/@piezasi-1
    			loop do
    				ra = rand(420/@piezasi*420/@piezasi)
    				if piezas[ra] != nil
    					@op[i] = ra
    					piezas[ra] = nil
    					break
    				end
    			end
    		end
    		@cursor = num-1
    		@o = 100
    		@re = false
    		refresh
    	end
    	def refresh
    		self.contents.clear
    		if @back != false
    			self.contents.blt(0, 0, RPG::Cache.picture(@back), Rect.new(0, 0, 640, 480), 255)
    		end
    		if @timeh == true
    			@time -= 1
    			if @time == 0
    				$game_variables[@vid] = 2
    				$game_system.se_play($data_system.buzzer_se)
    				$scene = Scene_Map.new
    			end
    		end
    		if @o <= 100
    			@re = false
    		elsif @o >= 255
    			@re = true
    		end
    		if @re == false
    			@o += 5
    		elsif @re == true
    			@o -= 5
    		end
    		self.contents.draw_text(26, 0, 640, 32, "Pieces")
    		self.contents.draw_text(300, 0, 640, 32, "Panel")
    		if @timeh != false
    			if @time/25` > 9
    				self.contents.draw_text(460, 0, 640, 32, "Time: #{@time/25/60}:#{@time/25`}")
    			else
    				self.contents.draw_text(460, 0, 640, 32, "Time: #{@time/25/60}:0#{@time/25`}")
    			end
    		else
    			self.contents.draw_text(460, 0, 640, 32, "Unlimited time")
    		end
    		self.contents.fill_rect(70-@piezasi/2+@piezasi/100, 240-@piezasi/2, @piezasi+2, @piezasi+2, Color.new(0, 0, 0, 200))
    		self.contents.fill_rect(175, 35, 422, 422, Color.new(0, 0, 0, 200))
    		self.contents.blt(176, 36, RPG::Cache.picture(@img), Rect.new(0, 0, 420, 420), 10)
    		pieza = 0
    		for i in 0..420/@piezasi-1
    			for a in 0..420/@piezasi-1
    				if @pieza[pieza].d == true
    					self.contents.blt(176+a*@piezasi, 36+i*@piezasi, RPG::Cache.picture(@img), Rect.new(@piezasi*a, @piezasi*i, @piezasi, @piezasi), 255)
    				end
    				pieza += 1
    			end
    		end
    		for a in -1..1
    			i = @cursor-a
    			if @op[i] != nil
    				if i >= 0 and a != 0
    					if @pieza[@op[i]].d == false
    					elsif @pieza[@op[i]].d == true
    					end
    				end
    				if a == 0
    					if @pieza[@op[i]].d == false
    						self.contents.blt(70-@piezasi/2+@piezasi/100+1, 240-@piezasi*3/2+@piezasi*(a+1), RPG::Cache.picture(@img), Rect.new(@pieza[@op[i]].x*@piezasi, @pieza[@op[i]].y*@piezasi, @piezasi, @piezasi), @o)
    					elsif @pieza[@op[i]].d == true
    						self.contents.blt(70-@piezasi/2+@piezasi/100+1, 240-@piezasi*3/2+@piezasi*(a+1), RPG::Cache.picture(@img), Rect.new(@pieza[@op[i]].x*@piezasi, @pieza[@op[i]].y*@piezasi, @piezasi, @piezasi), 20+@o/10)
    					end
    				end
    			end
    		end
    		if @fase == 1
    			f1_up
    			return
    		elsif @fase == nil
    			@fase = 1
    			@cursorx = 0
    			@cursory = 0
    		end
    	end
    	
    	
    	def f1_up
    		self.contents.blt(@piezasi*@cursorx+176, 36+@piezasi*@cursory, RPG::Cache.picture(@img), Rect.new(@pieza[@op[@cursor]].x*@piezasi, @pieza[@op[@cursor]].y*@piezasi, @piezasi, @piezasi), @o)
    		if Input.repeat?(Input::RIGHT) and @cursorx < 420/@piezasi-1
    			@cursorx += 1
    			$game_system.se_play($data_system.cursor_se)
    		elsif Input.repeat?(Input::RIGHT) and @cursorx == 420/@piezasi-1
    			$game_system.se_play($data_system.cursor_se)
    			@cursorx = 0
    		end
    		if Input.repeat?(Input::LEFT) and @cursorx > 0
    			@cursorx -= 1
    			$game_system.se_play($data_system.cursor_se)
    		elsif Input.repeat?(Input::LEFT) and @cursorx == 0
    			$game_system.se_play($data_system.cursor_se)
    			@cursorx = 420/@piezasi-1
    		end
    		if Input.repeat?(Input::DOWN) and @cursory < 420/@piezasi-1
    			@cursory += 1
    			$game_system.se_play($data_system.cursor_se)
    		elsif Input.repeat?(Input::DOWN) and @cursory == 420/@piezasi-1
    			@cursory = 0
    			$game_system.se_play($data_system.cursor_se)
    		end
    		if Input.repeat?(Input::UP) and @cursory >0
    			@cursory -= 1
    			$game_system.se_play($data_system.cursor_se)
    		elsif Input.repeat?(Input::UP) and @cursory == 0
    			@cursory = 420/@piezasi-1
    			$game_system.se_play($data_system.cursor_se)
    		end
    		if Input.trigger?(Input::C)
    			if @pieza[@op[@cursor]].x == @cursorx and @pieza[@op[@cursor]].y == @cursory
    				$game_system.se_play($data_system.load_se)
    				@pieza[@op[@cursor]].d = true
    				piezac = 0
    				for i in 0...420/@piezasi*420/@piezasi
    					if @pieza[i].d == true
    						piezac +=1
    					end
    				end
    				if piezac == 420/@piezasi*420/@piezasi
    					$game_variables[@vid] = 1
    					@o2 = 0
    					@re2 = false
    					@t2 = 0
    					Audio.se_play("Audio/SE/056-Right02.ogg", 100, 50)
    					loop do
    						Graphics.update
    						@t2 += 1
    						if @re2 == true
    							@o2 -= 5
    						elsif @re2 == false
    							@o2 += 5
    						end
    						if @o2 >= 255
    							@re2 = true
    						elsif @o2 <= 0
    							@re2 = false
    						end
    						@winb.refresh(@o2)
    						if @t2 == 102
    							@winb.dispose
    							break
    						end
    					end
    					$game_system.se_play($data_system.shop_se)
    					$scene = Scene_Map.new
    				else
    					@cursor -= 1
    				end
    			else
    				$game_system.se_play($data_system.buzzer_se)
    			end
    			return
    		end
    	end
    	
    end
    
    class Pieza_Puzle
    	attr_accessor :x
    	attr_accessor :y
    	attr_accessor :d
    	def initialize(x, y)
    		@x = x
    		@y = y
    		@d = false
    	end
    end
    
    class Window_PBrillo < Window_Base
    	def initialize
    		super(-16, -16, 640+32, 480+32)
    		self.contents = Bitmap.new(width - 32, height - 32)
    		self.contents.font.name = $fontface
    		self.contents.font.size = 23
    		self.opacity = 0
    		refresh(0)
    	end
    	def refresh(o)
    		self.contents.clear
    		self.contents.fill_rect(175, 35, 422, 422, Color.new(255, 255, 255, o))
    	end
    end
    

     

     

  4. Descrizione

    Script per inserire il gioco del Tris.

     

    Autore

    Shado

     

    Istruzioni per l'uso

    Create una nuova classe sopra main e chiamatela Tictactoe.
    Inserite il codice e per richiamarlo usare il call script con questo: $scene = Tictactoe.new .

    Script

     

     

     

    ######################################
    # Jeu Tic-tac-toe fait par Shado - 27 Juillet 2006
    # Laissez un crédit pour moi si vous l'utilisez. Merci !
    # Version : 1.3
    ######################################
    
    class Tictactoe
    	
    	@@turn = "x"
    	@@font_name = "Arial"
    	@@font_size = 40
    	
    	def initialize(menu_index = 0)
    		@menu_index = menu_index
    	end
    	######################
    	def main
    		@turnWindow = Turn_Window.new(@@turn)
    		@turnWindow.x = 450
    		@turnWindow.y = 370
    		setSquares
    		setMenu
    		
    		Graphics.transition
    		loop do
    			Graphics.update
    			Input.update
    			update
    			if $scene != self
    				break
    			end
    		end
    		
    		Graphics.freeze
    		@command_window.dispose
    		@turnWindow.dispose
    		
    		for x in 0..8
    			@sqr[x].dispose
    		end
    	end
    	######################
    	def update
    		@command_window.update
    		@turnWindow.update(@@turn)
    		
    		for x in 0..8
    			@sqr[x].update
    		end
    		
    		if @command_window.active
    			update_command
    			return
    		end
    	end
    	
    	######################
    	def update_command
    		if Input.trigger?(Input::B)
    			$game_system.se_play($data_system.cancel_se)
    			$scene = Scene_Map.new
    			return
    		end
    		if Input.trigger?(Input::C)
    			case @command_window.index
    			when 0..8
    				$game_system.se_play($data_system.decision_se)
    				doAction(@command_window.index)
    			when 9
    				$game_system.se_play($data_system.decision_se)
    				$scene = Tictactoe.new
    			when 10
    				$game_system.se_play($data_system.cancel_se)
    				$scene = Scene_Map.new
    			end
    			return
    		end
    	end
    	######################
    	def setMenu
    		s1 = "Alto a sinistra"
    		s2 = "Alto al centro"
    		s3 = "Alto a destra"
    		s4 = "Centro a sinistra"
    		s5 = "Centro al centro"
    		s6 = "Centro a destra"
    		s7 = "Basso a sinistra"
    		s8 = "Basso al centro"
    		s9 = "Basso a destra"
    		s10 = "Resetta"
    		s11 = "Esci"
    		@command_window = Window_Command.new(175, [s1, s2, s3, s4, s5, s6,s7,s8,s9,s10,s11])
    		@command_window.index = @menu_index
    		@command_window.x = 440
    	end
    	######################
    	def setSquares
    		@sqr = []
    		for x in 0..2
    			@sqr[x] = Square.new(@@font_name,@@font_size)
    			@sqr[x].x = (x+1)*100
    			@sqr[x].y = 50
    		end
    		
    		for x in 3..5
    			@sqr[x] = Square.new(@@font_name,@@font_size)
    			@sqr[x].x = (x-2)*100
    			@sqr[x].y = 150
    		end
    		
    		for x in 6..8
    			@sqr[x] = Square.new(@@font_name,@@font_size)
    			@sqr[x].x = (x-5)*100
    			@sqr[x].y = 250
    		end
    		
    	end
    	######################
    	def doAction(squareId)
    		if (@sqr[squareId].getOwner == "none")
    			@sqr[squareId].setOwner(@@turn)
    			verifyScore
    		else
    			$game_system.se_play($data_system.buzzer_se)
    		end
    	end
    	######################
    	def verifyScore
    		gameIsFinish = false
    		#check all --
    		for x in 0..2
    			if (@sqr[x*3].getOwner == @@turn && @sqr[x*3+1].getOwner == @@turn && @sqr[x*3+2].getOwner == @@turn)
    				print " "+@@turn+" Fine !"
    				gameIsFinish = true
    			end
    		end
    		
    		#check all |
    		for x in 0..2
    			if (@sqr[x].getOwner == @@turn && @sqr[x+3].getOwner == @@turn && @sqr[x+6].getOwner == @@turn)
    				print " "+@@turn+" Fine !"
    				gameIsFinish = true
    			end
    		end
    		
    		#check \
    		if (@sqr[0].getOwner == @@turn && @sqr[4].getOwner == @@turn && @sqr[8].getOwner == @@turn)
    			print " "+@@turn+" Fine !"
    			gameIsFinish = true
    		end
    		
    		#check /
    		if (@sqr[2].getOwner == @@turn && @sqr[4].getOwner == @@turn && @sqr[6].getOwner == @@turn)
    			print " "+@@turn+" Fine !"
    			gameIsFinish = true
    		end
    		
    		if noMoreSpace && !gameIsFinish
    			print "Niente!"
    			$scene = Scene_Restart.new
    		end
    		
    		if gameIsFinish
    			$scene = Scene_Restart.new
    		elsif (@@turn == "x")
    			@@turn = "o"
    		else @@turn = "x"
    		end
    	end
    	######################
    	def noMoreSpace
    		for x in 0..8
    			if (@sqr[x].getOwner == "none")
    				return false
    			end
    		end
    		return true
    	end
    	######################
    end
    
    #----------------------------------------------------------------------
    #Squares
    #----------------------------------------------------------------------
    class Square < Window_Base
    	
    	def initialize(fontName,fontSize)
    		@owner = "none"
    		
    		super(0, 0, 100,100)
    		self.contents = Bitmap.new(width-32, height-32)
    		self.contents.font.name = fontName
    		self.contents.font.size = fontSize
    		refresh
    	end
    	
    	def refresh
    		self.contents.clear
    		if (@owner == "x")
    			self.contents.font.color = text_color(2)
    			self.contents.draw_text(22, 15, 100, 32, "X")
    		elsif (@owner == "o")
    			self.contents.font.color = text_color(1)
    			self.contents.draw_text(22, 15, 100, 32, "O")
    		end
    	end
    	
    	def update
    		refresh
    	end
    	#############
    	def setOwner(newOwner)
    		@owner = newOwner
    	end
    	#############
    	def getOwner
    		return @owner
    	end
    	#############
    end
    
    #----------------------------------------------------------------------
    #Turn Window
    #----------------------------------------------------------------------
    class Turn_Window < Window_Base
    	
    	def initialize(turn)
    		super(0, 0, 165,60)
    		self.contents = Bitmap.new(width-32, height-32)
    		self.contents.font.name = "Arial"
    		self.contents.font.size = 30
    		refresh(turn)
    	end
    	
    	def refresh(turn)
    		self.contents.clear
    		if (turn == "x")
    			self.contents.font.color = text_color(2)
    			self.contents.draw_text(0,0,100,32,"Tour de : X")
    			elsif
    			self.contents.font.color = text_color(1)
    			self.contents.draw_text(0,0,100,32,"Tour de : O")
    		end
    	end
    	
    	def update(turn)
    		refresh(turn)
    	end
    end
    #----------------------------------------------------------------------
    #scene restart
    #----------------------------------------------------------------------
    class Scene_Restart
    	
    	@@font_name = "Arial"
    	@@font_size = 40
    	
    	def initialize(menu_index = 0)
    		@menu_index = menu_index
    	end
    	######################
    	def main
    		setMenu
    		
    		Graphics.transition
    		loop do
    			Graphics.update
    			Input.update
    			update
    			if $scene != self
    				break
    			end
    		end
    		
    		Graphics.freeze
    		@command_window.dispose
    	end
    	######################
    	def update
    		@command_window.update
    		
    		if @command_window.active
    			update_command
    			return
    		end
    	end
    	######################
    	def update_command
    		if Input.trigger?(Input::C)
    			case @command_window.index
    			when 0
    				$game_system.se_play($data_system.decision_se)
    				$scene = Tictactoe.new
    			when 1
    				$game_system.se_play($data_system.cancel_se)
    				$scene = Scene_Map.new
    			end
    			return
    		end
    	end
    	######################
    	def setMenu
    		s1 = "Ricomincia Tris"
    		s2 = "Esci"
    		@command_window = Window_Command.new(180, [s1, s2])
    		@command_window.index = @menu_index
    		@command_window.x = 250
    		@command_window.y = 200
    	end
    end
    

     

     

     

     

    Bugs e Conflitti noti

    N/A

  5. Creare un Mp3

    Descrizione

    Ecco uno script che vi permetterà di ascoltare le canzoni del vostro gioco grazie a un mp3.

     

    Autore

    squall@loeher.zzn.com

     

    Allegati

    Ecco una demo. Usate l'oggetto chiamato mp3 per far partire lo script.
    http://www.megaupload.com/?d=JF9XRZ9C

    Istruzioni per l'uso

    Per utilizzarlo create un nuovo oggetto nel database e chiamatelo mp3. Fatelo inconsumabile e utilizzabile dal menù.
    Assegnategli un common event in cui c'è il call script:$scene = Scene_SoundTest.new

     

    Script

    Create una nuova classe sopra main, chiamatela Sound Test e inserite dentro questo:

     

     

    #==============================================================================
    # ¦ Window_SoundTest
    #------------------------------------------------------------------------------
    # thanks to ccoa from rmxp.net for the help
    # credits to squall@loeher.zzn.com
    #==============================================================================
    class Window_SoundTest < Window_Selectable
    	#--------------------------------------------------------------------------
    	# ? initialize
    	#--------------------------------------------------------------------------
    	def initialize()
    		super(0, 0, 640, 480)
    		refresh
    		self.index = 0
    		self.active = true
    	end
    	#--------------------------------------------------------------------------
    	# ? sound
    	#--------------------------------------------------------------------------
    	def sound
    		return @data[self.index]
    	end
    	#--------------------------------------------------------------------------
    	# ? refresh
    	#--------------------------------------------------------------------------
    	def refresh
    		files = Dir.new("Audio/BGM/").entries
    		files[0, 2] = nil
    		for i in 0...files.size
    			if files[i].include?(".psflib")
    				files[i] = nil
    				break
    			end
    		end
    		files.compact!
    		@item_max = files.size
    		if @item_max == 0
    			@item_max = 1
    		end
    		self.contents = Bitmap.new(width - 32, row_max * 32)
    		self.contents.font.name = $fontface
    		self.contents.font.size = $fontsize
    		@data = []
    		for i in 0...@item_max
    			unless files[i] == nil
    				@data.push(files[i])
    				files[i].slice!(".mp3")
    				files[i].slice!(".mid")
    				files[i].slice!(".ogg")
    				files[i].slice!(".wma")
    				files[i].slice!(".wav")
    				files[i].slice!(".psf2")
    				files[i].slice!(".minipsf2")
    				files[i].slice!(".psf")
    				files[i].slice!(".minipsf")
    				self.contents.draw_text(0, i * 32, 640, 32, files[i])
    			end
    		end
    	end
    end
    
    #==============================================================================
    # ¦ Scene_SoundTest
    #==============================================================================
    
    class Scene_SoundTest
    	#--------------------------------------------------------------------------
    	# ? main
    	#--------------------------------------------------------------------------
    	def main
    		$game_system.bgm_memorize
    		$game_system.bgm_stop
    		@window = Window_SoundTest.new
    		Graphics.transition
    		loop do
    			Graphics.update
    			Input.update
    			update
    			if $scene != self
    				break
    			end
    		end
    		Graphics.freeze
    		@window.dispose
    	end
    	#--------------------------------------------------------------------------
    	# ? update
    	#--------------------------------------------------------------------------
    	def update
    		@window.update
    		if Input.trigger?(Input::C)
    			unless @window.sound == nil
    				Audio.bgm_play("Audio/BGM/" + @window.sound, 255, 100)
    				if Audio.methods.include?("psf_play")
    					Audio.psf_play("Audio/BGM/" + @window.sound, 255)
    				end
    				return
    			end
    		end
    		if Input.trigger?(Input::B)
    			$game_system.se_play($data_system.cancel_se)
    			$scene = Scene_Map.new
    			$game_system.bgm_stop
    			$game_system.bgm_restore
    			return
    		end
    	end
    end
    

     

     

     

     

    Bugs e Conflitti Noti

    N/A

  6. Create una classe sopra main col nome di Light Effects e inserite questo:
    (Per ottenere l'effetto luce, mettere un evento nella mappa che abbia il commento:Light Effects
    e il commento Fire.
    Poi mettete nella cartella Graphics/Picture questo file chiamandolo LE.png
    post-996-1205058046.png

     

     

    #================================
    # ■ Light Effects
    #================================
    # By: Near Fantastica
    # Date: 28.06.05
    # Version: 3
    #================================
    
    class Spriteset_Map
    	#--------------------------------------------------------------
    	alias les_spriteset_map_initalize initialize
    	alias les_spriteset_map_dispose dispose
    	alias les_spriteset_map_update update
    	#--------------------------------------------------------------
    	def initialize
    		@light_effects = []
    		setup_lights
    		les_spriteset_map_initalize
    		update
    	end
    	#--------------------------------------------------------------
    	def dispose
    		les_spriteset_map_dispose
    		for effect in @light_effects
    			effect.light.dispose
    		end
    		@light_effects = []
    	end
    	#--------------------------------------------------------------
    	def update
    		les_spriteset_map_update
    		update_light_effects
    	end
    	#--------------------------------------------------------------
    	def setup_lights
    		for event in $game_map.events.values
    			next if event.list == nil
    			for i in 0...event.list.size
    				if event.list[i].code == 108 and event.list[i].parameters == ["Light Effects"]
    					type = event.list[i+1].parameters.to_s
    					case type.upcase!
    					when "GROUND"
    						light_effects = Light_Effect.new(event,type)
    						light_effects.light.zoom_x = 200 / 100.0
    						light_effects.light.zoom_y = 200 / 100.0
    						light_effects.light.opacity = 50
    						@light_effects.push(light_effects)
    					when "FIRE"
    						light_effects = Light_Effect.new(event,type)
    						light_effects.light.zoom_x = 300 / 100.0
    						light_effects.light.zoom_y = 300 / 100.0
    						light_effects.light.opacity = 100
    						@light_effects.push(light_effects)
    					when "LAMPPOST"
    						light_effects = Light_Effect.new(event,"LEFT LAMP POST")
    						light_effects.light.opacity = 100
    						@light_effects.push(light_effects)
    						light_effects = Light_Effect.new(event,"RIGHT LAMP POST")
    						light_effects.light.opacity = 100
    						@light_effects.push(light_effects)
    					when "LEFTLANTERN"
    						light_effects = Light_Effect.new(event,type)
    						light_effects.light.opacity = 150
    						@light_effects.push(light_effects)
    					when "RIGHTLANTERN"
    						light_effects = Light_Effect.new(event,type)
    						light_effects.light.opacity = 150
    						@light_effects.push(light_effects)
    					end
    				end
    			end
    		end
    		for effect in @light_effects
    			case effect.type
    			when "GROUND"
    				effect.light.x = (effect.event.real_x - 200 - $game_map.display_x) / 4
    				effect.light.y = (effect.event.real_y - 200 - $game_map.display_y) / 4
    			when "FIRE"
    				effect.light.x = (effect.event.real_x - 300 - $game_map.display_x) / 4
    				effect.light.y = (effect.event.real_y - 300 - $game_map.display_y) / 4
    			when "LEFT LAMP POST"
    				effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 5
    				effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15
    			when "RIGHT LAMP POST"
    				effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 25
    				effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15
    			when "LEFTLANTERN"
    				effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 20
    				effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 5
    			when "RIGHTLANTERN"
    				effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 10
    				effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 5
    			end
    		end
    	end
    	#--------------------------------------------------------------
    	def update_light_effects
    		for effect in @light_effects
    			next if not in_range?(effect.event)
    			case effect.type
    			when "GROUND"
    				effect.light.x = (effect.event.real_x - 200 - $game_map.display_x) / 4
    				effect.light.y = (effect.event.real_y - 200 - $game_map.display_y) / 4
    			when "FIRE"
    				effect.light.x = (effect.event.real_x - 300 - $game_map.display_x) / 4
    				effect.light.y = (effect.event.real_y - 300 - $game_map.display_y) / 4
    			when "LEFT LAMP POST"
    				effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 5
    				effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15
    			when "RIGHT LAMP POST"
    				effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 25
    				effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15
    			when "LEFTLANTERN"
    				effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 20
    				effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 5
    			when "RIGHTLANTERN"
    				effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 10
    				effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 5
    			end
    		end
    	end
    	#--------------------------------------------------------------
    	def in_range?(object)
    		screne_x = $game_map.display_x
    		screne_x -= 256
    		screne_y = $game_map.display_y
    		screne_y -= 256
    		screne_width = $game_map.display_x
    		screne_width += 2816
    		screne_height = $game_map.display_y
    		screne_height += 2176
    		return false if object.real_x <= screne_x
    		return false if object.real_x >= screne_width
    		return false if object.real_y <= screne_y
    		return false if object.real_y >= screne_height
    		return true
    	end
    end
    
    #================================
    # ■ Light Effects Class
    #================================
    
    class Light_Effect
    	#--------------------------------------------------------------
    	attr_accessor :light
    	attr_accessor :event
    	attr_accessor :type
    	#--------------------------------------------------------------
    	def initialize(event, type)
    		@light = Sprite.new
    		@light.bitmap = RPG::Cache.picture("LE.PNG")
    		@light.visible = true
    		@light.z = 1000
    		@event = event
    		@type = type
    	end
    end
    

     

     

×
×
  • Create New...