Jump to content
Rpg²S Forum

Gianluca94

Utenti
  • Posts

    1
  • Joined

  • Last visited

Posts posted by Gianluca94

  1. want fa parte di un commento, ecco lo script buono (a me funziona):

     

    #====================================================================
    
    # ** Sprite_Clock
    #-------------------------------------------------------------------
    # This sprite is used to display the clock. It observes the
    
    $game_system
    # class and automatically changes sprite conditions.
    # Compiled by GAM modificato da Friday
    #==================================================
    
    class Sprite_Timer < Sprite
    	
    	
    	#-----------------------------------------------------------------
    	# * Object Initialization
    	#-----------------------------------------------------------------
    	def initialize
    		super
    		self.bitmap = Bitmap.new(88, 48)
    		self.bitmap.font.name = "Arial" #Replace with whatever font you want
    		self.bitmap.font.size = 32
    		self.x = 640 - self.bitmap.width
    		self.y = 0
    		self.z = 500
    		update
    	end
    	#-----------------------------------------------------------------
    	# * Dispose
    	#-----------------------------------------------------------------
    	def dispose
    		if self.bitmap != nil
    			self.bitmap.dispose
    		end
    		super
    	end
    	#-----------------------------------------------------------------
    	# * Frame Update
    	#-----------------------------------------------------------------
    	def update
    		super
    		self.visible = true
    		if Graphics.frame_count / Graphics.frame_rate != @total_sec
    			@total_sec = Graphics.frame_count / Graphics.frame_rate #mod this line to change speed of clock
    			
    			$min = @total_sec / 60 % 24
    			@sec = @total_sec % 60
    			
    			
    			if $min == 00
    				$night = 1
    				$game_variables[3]+=1
    			end
    			
    			
    			if $min == 12
    				$night = 2
    			end
    			
    			#----------------------------------------------------------------
    			# Inside/Outside
    			# Day / Night
    			# mod these for different tones, faster/slower tones,
    			# or more tones
    			#----------------------------------------------------------------
    			if $game_switches[1] #==true
    				$game_screen.start_tone_change(Tone.new(0,0,0), 5)
    			else
    				if $min < 5
    					$game_screen.start_tone_change(Tone.new(-170,-170,68), 20)
    				elsif $min >= 5 and $min < 7
    					$game_screen.start_tone_change(Tone.new(-51,-102,-102), 20)
    				elsif $min >= 7 and $min < 9
    					$game_screen.start_tone_change(Tone.new(0,-51,-68), 20)
    				elsif $min >= 9 and $min < 18
    					$game_screen.start_tone_change(Tone.new(0,0,0), 20)
    				elsif $min >= 18 and $min < 21
    					$game_screen.start_tone_change(Tone.new(-34,-68,-119), 20)
    				elsif $min >= 21
    					$game_screen.start_tone_change(Tone.new(-170,-170,68), 20)
    					
    					
    				end
    			end
    			
    			#----------------------------------------------------------------
    			# Am / Pm
    			#
    			#----------------------------------------------------------------
    			
    			
    			if $night == 2
    				ampm = " PM"
    				mins = $min - 12
    				$day = 0
    			else
    				ampm = " AM"
    				mins = $min
    				
    				
    			end
    			
    			#----------------------------------------------------------------
    			# Makes the clock more clock looking
    			#
    			#----------------------------------------------------------------
    			
    			if $min == 0 or $min == 12
    				mins = 12
    			end
    			if $min == 10
    				clock = sprintf("d:d", mins, @sec)
    			elsif $min == 11
    				clock = sprintf("d:d", mins, @sec)
    			elsif $min == 12
    				clock = sprintf("d:d", mins, @sec)
    			else
    				clock = sprintf("d:d", mins, @sec)
    			end
    			clock += ampm
    			
    			
    			$clock = clock
    			# Clear window contents
    			self.bitmap.clear
    			if $clock != nil
    				text = clock
    				# Draw clock
    				self.bitmap.font.color.set(255, 255, 255)
    				self.bitmap.draw_text(self.bitmap.rect, text, 1)
    				@timer = clock
    			end
    		end
    	end
    	
    end
    

     

     


×
×
  • Create New...