Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Plane_Mask < Plane
- ColorPass = Color.new(255,255,255,125)
- ColorImpass = Color.new(0,0,0,125)
- def initialize(vport)
- super(vport)
- @width = 1
- @height = 1
- self.z = 90
- end
- def update
- if $game_map
- if @width != $game_map.width || @height != $game_map.height
- @width = $game_map.width
- @height = $game_map.height
- update_bitmap
- end
- self.ox = $game_map.display_x / 8
- self.oy = $game_map.display_y / 8
- end
- end
- def update_bitmap
- bmp = Bitmap.new(@width * 32, @height * 32)
- @width.times do |xp|
- @height.times do |yp|
- rect = [xp * 32 + 4, yp * 32 + 4, 32 - 8, 32 - 8]
- if $game_player.map_passable?(xp, yp)
- rect << ColorPass
- bmp.fill_rect(*rect)
- else
- rect << ColorImpass
- bmp.fill_rect(*rect)
- end
- end
- end
- self.bitmap = bmp
- end
- end
- class Spriteset_Map
- alias theo_init initialize
- def initialize
- theo_init
- @mask = Plane_Mask.new(@viewport1)
- @mask.update
- end
- alias theo_update update
- def update
- theo_update
- @mask.update if @mask
- end
- alias theo_dispose dispose
- def dispose
- theo_dispose
- @mask.dispose
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment