Guest User

Untitled

a guest
Apr 9th, 2020
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.71 KB | None | 0 0
  1. Demostración de la mecánica: https://imgur.com/UNaAm9s
  2.  
  3. Scripts:
  4.  
  5. Se define en PBTerrains los tags isLuz? y isSombra?
  6. Se define F como input en Controls
  7. Se definen las formas en MultipleForms
  8.  
  9. ---En Scene Map---
  10.     #Cambio de forma 802
  11.     if Input.trigger?(Input::L) && !pbMapInterpreterRunning? && $game_switches[101]
  12.           for i in $Trainer.party
  13.             if i.species==1
  14.               if  $game_variables[101]==1 #si es luz, pasa a sombra
  15.                if PBTerrain.isLuz?(pbGetTerrainTag)
  16.                  Kernel.pbMessage(_INTL("¡No puedes transformarte aquí!"))
  17.                  break
  18.                end
  19.                i.form = 0
  20.                $game_variables[101]=0
  21.              else #si es sombra, pasa a luz
  22.                 if PBTerrain.isSombra?(pbGetTerrainTag)
  23.                    Kernel.pbMessage(_INTL("¡No puedes transformarte aquí!"))
  24.                    break
  25.                 end
  26.                 i.form = 1
  27.                 $game_variables[101]=1
  28.               end  
  29.             $game_map.refresh
  30.             pbSEPlay("expfull")
  31.             break
  32.           end
  33.          end
  34.         end
  35.  
  36.  
  37. ----En Game_Map----
  38.   #Sombra y luz comprobaciones
  39.       elsif PBTerrain.isLuz?(@terrain_tags[tile_id]) && $globalluz==0
  40.         Kernel.pbStartOver
  41.       elsif PBTerrain.isSombra?(@terrain_tags[tile_id]) && $globalsombra==0
  42.         Kernel.pbStartOver
  43.       elsif PBTerrain.isLuz?(@terrain_tags[tile_id]) && $game_variables[101]==0
  44.           return false
  45.       elsif PBTerrain.isSombra?(@terrain_tags[tile_id]) && $game_variables[101]==1
  46.           return false      
  47.  
  48. ------En PBField_Field, bajo field_movement------
  49. $globalluz=250
  50. $globalsombra=250
  51.  
  52. Events.onStepTaken+=proc{
  53.   if PBTerrain.isLuz?(pbGetTerrainTag)
  54.     $globalluz-=5
  55.   elsif PBTerrain.isSombra?(pbGetTerrainTag)
  56.     $globalsombra-=5
  57.   end    
  58. }
  59.  
  60. --------Sobre Main-----------
  61. class Spriteset_Map
  62.   alias old_initialize initialize
  63.   def initialize(map=nil)
  64.     @bar=IconSprite.new(0,320,@@viewport1)
  65.     @bar.bitmap=Bitmap.new(Graphics.width,Graphics.height)
  66.     @colors=[
  67.         Color.new(255,255,255),Color.new(160,160,160),     # Luz
  68.         Color.new(0,0,0),Color.new(160,160,160),      # Sombra
  69.      ]
  70.     old_initialize(map)
  71.    end
  72.    
  73.    alias old_update update
  74.    def update
  75.      @bar.bitmap.clear
  76.      if $game_switches[101]==true
  77.       #Luz
  78.       @bar.bitmap.fill_rect(Rect.new(10,40,250*10/20,6),@colors[1])
  79.       @bar.bitmap.fill_rect(Rect.new(10,40,$globalluz*10/20,6),@colors[0])
  80.      end
  81.       #Sombra
  82.       @bar.bitmap.fill_rect(Rect.new(10,50,250*10/20,6),@colors[3])
  83.       @bar.bitmap.fill_rect(Rect.new(10,50,$globalsombra*10/20,6),@colors[2])      
  84.      @bar.z = 1000
  85.       old_update
  86.    end
  87.  end
Advertisement
Add Comment
Please, Sign In to add comment