赞 | 0 |
VIP | 77 |
好人卡 | 306 |
积分 | 1 |
经验 | 85662 |
最后登录 | 2023-11-23 |
在线时间 | 1782 小时 |
Lv1.梦旅人 虱子
- 梦石
- 0
- 星屑
- 121
- 在线时间
- 1782 小时
- 注册时间
- 2010-6-19
- 帖子
- 3597
|
- =begin
- 脚本说明:
- $scene.spriteset.read_actor(id)
- 读取id号事件(id为0时为角色)的Sprite
- $scene.spriteset.add_actor(id)
- 描绘id号事件(可以用来修改提取放置物的脚本,原脚本的更新方法太耗内存了- -)
- $scene.spriteset.dispose_actor(id)
- 释放id号事件的Sprite
- 注:以上指令均要在场景为Scene_Map时才能使用,不然会报错。
- =end
- class Scene_Map
- attr_accessor :spriteset
- end
- class Spriteset_Map
- def initialize
- @viewport1 = Viewport.new(0, 0, 640, 480)
- @viewport2 = Viewport.new(0, 0, 640, 480)
- @viewport3 = Viewport.new(0, 0, 640, 480)
- @viewport2.z = 200
- @viewport3.z = 5000
- @tilemap = Tilemap.new(@viewport1)
- @tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
- for i in 0..6
- autotile_name = $game_map.autotile_names[i]
- @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
- end
- @tilemap.map_data = $game_map.data
- @tilemap.priorities = $game_map.priorities
- @panorama = Plane.new(@viewport1)
- @panorama.z = -1000
- @fog = Plane.new(@viewport1)
- @fog.z = 3000
- @character_sprites = []
- @actor_array = []
- @character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
- @actor_array[0] = 0
- for i in $game_map.events.keys.sort
- sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
- @character_sprites.push(sprite)
- @actor_array[i] = @character_sprites.size - 1
- end
- @weather = RPG::Weather.new(@viewport1)
- @picture_sprites = []
- for i in 1..50
- @picture_sprites.push(Sprite_Picture.new(@viewport2,
- $game_screen.pictures[i]))
- end
- @timer_sprite = Sprite_Timer.new
- update
- end
- def read_actor(id)
- return @character_sprites[@actor_array[id]]
- end
- def add_actor(id)
- sprite = Sprite_Character.new(@viewport1, $game_map.events[id])
- @character_sprites.push(sprite)
- @actor_array[id] = @character_sprites.size - 1
- end
- def dispose_actor(id)
- return if @character_sprites[@actor_array[id]].nil?
- @character_sprites[@actor_array[id]].bitmap.dispose
- @character_sprites[@actor_array[id]].dispose
- @character_sprites[@actor_array[id]] = nil
- end
- def dispose
- @tilemap.tileset.dispose
- for i in 0..6
- @tilemap.autotiles[i].dispose
- end
- @tilemap.dispose
- @panorama.dispose
- @fog.dispose
- for sprite in @character_sprites
- sprite.dispose unless sprite.nil?
- end
- @weather.dispose
- for sprite in @picture_sprites
- sprite.dispose
- end
- @timer_sprite.dispose
- @viewport1.dispose
- @viewport2.dispose
- @viewport3.dispose
- end
- end
复制代码 如上,读取地图某事件的Sprite(不是Bitmap) |
|