Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Panorama Map Script

PANORAMA MAP SCRIPT

Credits: http://www.66rpg.com

What is this script?
This script will allow you to use Panorama to create a map. If you don't understand, see the screenshot.

Code:
[url=http://upload4free.co.cc/files/NQSH%20Map.JPG]http://upload4free.co.cc/files/NQSH%20Map.JPG[/url][/img][/spoiler]

 

[u][b]Where is this script?[/b][/u]

 

[i]Panorama_Layer1[/i]

#==============================================================================

# ++ 一枚絵を背景化 ver. 1.00 ++

#  Script by パラ犬

#------------------------------------------------------------------------------

# パノラマ画像のスクロールをマップのスクロールと同期させ

# 背景画像として使えるようにします。

#==============================================================================

 

module PARA_PANORAMA

 

  # パノラマのスクロールをマップと同期させる --- làm đồng kì của scroll của panorama và map

  #( 0:しない 1:する 2:イベントスイッチで制御 ) --- ( 0 : ko làm  1 làm  2 dùng event switch để chế ngự)

  FIX = 1

  # スイッチ制御に使用するスイッチ番号 --- số hiệu switch sử dụng itch chế ngự

  FIX_SWITCH = 999

 

  # 画像ファイルの一括指定 --- sự chỉ định cùng lúc của file ảnh

  #( PANORAMA[ マップID ] = ファイル名 ) --- ( PANORAMA[ map ID ] = tên file)

  PANORAMA=[]#←この行は削除しないでください --- không xóa dòng này

  PANORAMA[1] = "001-Sky01"

  PANORAMA[2] = "002-Sky02"

 

end

 

# ↑ 設定項目ここまで --- thiết định hạng mục đến đây

#------------------------------------------------------------------------------

 

#==============================================================================

# â–  Spriteset_Map

#==============================================================================

 

class Spriteset_Map

 

  #--------------------------------------------------------------------------

  # ● オブジェクト初期化 --- objet shokika

  #--------------------------------------------------------------------------

  alias initialize_parapano initialize

  def initialize

    initialize_parapano

    #パノラマ画像を設定 --- panorama

    if PARA_PANORAMA::PANORAMA[$game_map.map_id] != nil

      $game_map.panorama_name = PARA_PANORAMA::PANORAMA[$game_map.map_id]

      @panorama_name = $game_map.panorama_name

      @panorama_hue = $game_map.panorama_hue

      @panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)

    end

    # フレーム更新 ---  frame henshin

    update

  end

  #--------------------------------------------------------------------------

  # ● フレーム更新 ---  frame henshin

  #--------------------------------------------------------------------------

  alias update_parapano update

  def update

    update_parapano

    if PARA_PANORAMA::FIX == 1 or (PARA_PANORAMA::FIX==2 and $game_switches[PARA_PANORAMA::FIX_SWITCH])

      # パノラマプレーンを更新 --- panorama plain

      @panorama.ox = $game_map.display_x / 4

      @panorama.oy = $game_map.display_y / 4

    end

  end

end

Panorama_Layer2
Code:
#==============================================================================

# â–  Game_Map

#------------------------------------------------------------------------------

#  处理地图的类。包含卷动以及可以通行的判断功能。

# 本类的实例请参考 $game_map 。

#==============================================================================

class Game_Map

  attr_accessor :map

  attr_accessor :map_id

end

#==============================================================================

# â–  Spriteset_Map

#------------------------------------------------------------------------------

#  处理地图画面活动块和元件的类。本类在

# Scene_Map 类的内部使用。

#==============================================================================

 

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

    @panorama2 = Plane.new(@viewport1)

    @panorama2.z = 3000   

    # 生成雾平面

    @fog = Plane.new(@viewport1)

    @fog.z = 3000

    # 生成角色活动块

    @character_sprites = []

    for i in $game_map.events.keys.sort

      sprite = Sprite_Character.new(@viewport1, $game_map.events[i])

      @character_sprites.push(sprite)

    end

    @character_sprites.push(Sprite_Character.new(@viewport1, $game_player))

    # 生成天气

    @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 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

    end

    # 释放天候

    @weather.dispose

    # 释放图片

    for sprite in @picture_sprites

      sprite.dispose

    end

    # 释放计时器块

    @timer_sprite.dispose

    # 释放显示端口

    @viewport1.dispose

    @viewport2.dispose

    @viewport3.dispose

  end

  #--------------------------------------------------------------------------

  # ● 刷新画面

  #--------------------------------------------------------------------------

  def update

    # 远景与现在的情况有差异发情况下

    if @panorama_name != $game_map.panorama_name or

       @panorama_hue != $game_map.panorama_hue

      @panorama_name = $game_map.panorama_name

      @panorama_hue = $game_map.panorama_hue

      if @panorama.bitmap != nil

        @panorama.bitmap.dispose

        @panarama2.bitmap.dispose

        @panorama2.bitmap = nil

        @panarama.bitmap = nil

      end

      if @panorama_name != ""

        @panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)

        @panorama2.bitmap = RPG::Cache.panorama(@panorama_name+"_2", @panorama_hue)

      end

      Graphics.frame_reset

    end

    # 雾与现在的情况有差异的情况下

    if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue

      @fog_name = $game_map.fog_name

      @fog_hue = $game_map.fog_hue

      if @fog.bitmap != nil

        @fog.bitmap.dispose

        @fog.bitmap = nil

      end

      if @fog_name != ""

        @fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)

      end

      Graphics.frame_reset

    end

    # 刷新元件地图

    @tilemap.ox = $game_map.display_x / 4

    @tilemap.oy = $game_map.display_y / 4

    @tilemap.update

    # 刷新远景平面

    @panorama.ox = $game_map.display_x / 4

    @panorama.oy = $game_map.display_y / 4

    @panorama2.ox = @panorama.ox

    @panorama2.oy = @panorama.oy

    # 刷新雾平面

    @fog.zoom_x = $game_map.fog_zoom / 100.0

    @fog.zoom_y = $game_map.fog_zoom / 100.0

    @fog.opacity = $game_map.fog_opacity

    @fog.blend_type = $game_map.fog_blend_type

    @fog.ox = $game_map.display_x / 4 + $game_map.fog_ox

    @fog.oy = $game_map.display_y / 4 + $game_map.fog_oy

    @fog.tone = $game_map.fog_tone

    # 刷新角色活动块

    for sprite in @character_sprites

      sprite.update

    end

    # 刷新天候图形

    @weather.type = $game_screen.weather_type

    @weather.max = $game_screen.weather_max

    @weather.ox = $game_map.display_x / 4

    @weather.oy = $game_map.display_y / 4

    @weather.update

    # 刷新图片

    for sprite in @picture_sprites

      sprite.update

    end

    # 刷新计时器块

    @timer_sprite.update

    # 设置画面的色调与震动位置

    @viewport1.tone = $game_screen.tone

    @viewport1.ox = $game_screen.shake

    # 设置画面的闪烁色

    @viewport3.color = $game_screen.flash_color

    # 刷新显示端口

    @viewport1.update

    @viewport3.update

  end

end

Demo
http://vnup.org/files/1117/Demo.rar
Password to extract: makegamevn

How to use?
First, let me introduce it. The first script allow you to make the first layer. Events and characters will walk through this layer. The second script allow you to make the second layer. This layer will cover events and characters.
Now, how to use it? You only need to choose the panorama for the tileset of the map. This will be the layer 1. You should rename the layer 2 panorama's name to layer1name_2.png. For example, if the panorama 1 named Map1.png then the panorama 2 should be named Map1_2.png (see the demo).
The last thing to do: You should mark the passage for the tileset. I recommend you to use a tile set will a blank square and a X mark. Because you can't see the panorama in the Editor, you can use this software to find the co-ordinate: http://vnup.org/files/1117/GetGridMap1.rar (Credits to makegame.vn, need .NET Framework to work).

Why should I use this script?
You can see this game to know what can this script doing: http://www.mediafire.com/?lmpljytrpnm
Or see the screenshots:
This game is a vietnamese game. It use 45 degree panorama maps and 45 degree battle system (the Fantasy Sango Battle System that I have posted here: index.php?topic=35577.0 )


Note
-This script is shared by http://www.66rpg.com
-I'm vietnamese, so excuse me for many spelling and grammar errors
-Have fun
 
I just have to say - AWESOME! Best script EVER.... If it works =P Just how would I *easily* create Panorama for every single map of my game without much work (and not to make my game file 500MB+)?
 
Err...sorry...the demo password is makegamevn, I think.
This script is only a part of the project Fantasy Sango. We should work hard to make the game like the last screenshots :D
 
3 words i love you lol this look freaking amazing i most likely will use this on some maps dont see how it would fit for a sonic game but i have to lol
 
im having an error with this script
line 37 " @tilemap.autotiles = RPG::Cache.autotile(autotile_name) "
it says "cannot convert array into string"
 
The line should read "@tilemap.autotiles = RPG::Cache.autotile(autotile_name)"

EDIT: Oh, I get it...looking at what I've done...Phoenix Flame, you must edit your post to enclose your code in [ code ] tags, otherwise usefule code like [ i ] will turn into italics...

Code:
@tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
 
now im having error with this"    autotile_name = $game_map.autotile_names "
same error

maybe because of my other script???
 
That line should read:

Code:
    autotile_name = $game_map.autotile_names[i]

If you have any further problems before the code gets properly enclosed in CODE tags, just click the quote button on his post.  That way, you get the uninterpreted text of his code in the post box.
 
rey meustrus":1xtd9t08 said:
The line should read "@tilemap.autotiles = RPG::Cache.autotile(autotile_name)"

EDIT: Oh, I get it...looking at what I've done...Phoenix Flame, you must edit your post to enclose your code in [ code ] tags, otherwise usefule code like [ i ] will turn into italics...

Code:
@tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
Edited :D
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top