Jump to content
Rpg²S Forum

kenshiro 89

Utenti
  • Posts

    8
  • Joined

  • Last visited

Posts posted by kenshiro 89

  1.  

     

    Dovrebbe esser sufficiente modificare il primo numero tra parentesi...
     
    $scene = Scene_Puzle.new(180, "Puzzleinizio", 3, 90, "Back")

    ...che indica la grandezza dei pezzi.
    ^ ^


    Grazie..
    All'inizio l'ho pensata pure io questa cosa...ma si bloccava...invece non bloccava niente...si doveva aspettare 2 secondi in pi? :P...grazie comunque
  2. 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%60 > 9
    				self.contents.draw_text(460, 0, 640, 32, "Time: #{@time/25/60}:#{@time/25%60}")
    			else
    				self.contents.draw_text(460, 0, 640, 32, "Time: #{@time/25/60}:0#{@time/25%60}")
    			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
    
    

     

     

     

     

     

     

    questo minigame del puzzle mi funziona bene...

    Ma ho una richiesta....

    Lo script divide l'immagine in 4 parti...ed ? troppo facile unirli

    Come faccio a dividerlo in pi? parti??

  3. Si sto realizzando un gdr per il forum di hokuto no ken basato su tutta la prima serie di kenshiro..

    sto realizzando anche dei minigiochi durante il viaggio dell'eroe tipo i quiz per vedere quanto si conosce la trama (per ora l'unico dove so metterci mano)

    Vorrei sapere se si possono fare minigiochi tipo gare di macchine

    Un gioco di carte stile ff8 dove però sto avendo un problema

    E un minigioco stle metal gear solid dove non devi essere scoperto per arrivare alla meta finale..

  4. Salve a tutti ragazzi.

    Mi sono iscritto oggi al vostro forum perchè l'ho trovato al quanto stupefacente..

    Spero di trovarmi bene qui.:) CIAO

×
×
  • Create New...