Guest Access
Go to page : 1, 2
Morderator
Morderator
Morderator
profile
albertfish
profile
Hello, this is a script that I have wanted to create for a few days now and decided to quickly throw it together. This script mimics the screen transitions found in the 2D Zelda games. Instead of making several small (20x15) maps and teleporting between them, you can now just make a large map and let this script do the rest!
Here is what the script looks like:
Note that everything you saw there was one map.
Here is the script.
I have plans to make it so that you can create events that only execute when they are on the screen. This will make it easy to play different music or sounds based on where you are on the map.
Here is what the script looks like:
Note that everything you saw there was one map.
Here is the script.
- Spoiler:
- Code:
#==============================================================================
# ** Classic Zelda Screen Transitions
#------------------------------------------------------------------------------
# * Created by: albertfish
# * Version: 1.0
# * Last edited: September 7, 2010
#------------------------------------------------------------------------------
# Version History:
# Version 1.0: September 7, 2010
# - Initial release
#------------------------------------------------------------------------------
# Description:
# This script mimics the screen transitions found in the 2D Zelda Games.
#------------------------------------------------------------------------------
# Features:
# - Separeated a large map in to small screen size parts and adds a smooth
# transition between the parts.
#------------------------------------------------------------------------------
# Install Instructions:
# Place this script above the main script and below the default scripts.
#==============================================================================
#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
# This class brings together map screen sprites, tilemaps, etc.
# It's used within the Scene_Map class.
#==============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias af_czst_ssm_init initialize
def initialize
@x = ($game_player.x - $game_player.x % 20) * 128
@y = ($game_player.y - $game_player.y % 15) * 128
@amount_x = 0
@amount_y = 0
@scrolling = false
@prev_x = $game_player.x
@prev_y = $game_player.y
$game_map.display_x = @x
$game_map.display_y = @y
af_czst_ssm_init
end
#--------------------------------------------------------------------------
# * Scroll Right
#--------------------------------------------------------------------------
def scroll_right
@x += 128
@amount_x -= 1
if @amount_x <= 0
@scrolling = false
end
end
#--------------------------------------------------------------------------
# * Scroll Left
#--------------------------------------------------------------------------
def scroll_left
@x -= 128
@amount_x += 1
if @amount_x >= 0
@scrolling = false
end
end
#--------------------------------------------------------------------------
# * Scroll Up
#--------------------------------------------------------------------------
def scroll_up
@y -= 96
@amount_y -= 1
if @amount_y <= 0
@scrolling = false
end
end
#--------------------------------------------------------------------------
# * Scroll Down
#--------------------------------------------------------------------------
def scroll_down
@y += 96
@amount_y += 1
if @amount_y >= 0
@scrolling = false
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias af_czst_ssm_update update
def update
if !@scrolling
# Determine if the screen needs to scroll left or right
if $game_player.x % 20 == 0 && ($game_player.x - 19) * 128 > $game_map.display_x
@amount_x = 20
@scrolling = true
@prev_x += 1
elsif $game_player.x % 20 == 19 && ($game_player.x) * 128 < $game_map.display_x
@amount_x = -20
@scrolling = true
@prev_x -= 1
end
# Determine if the screen needs to scroll up or down
if $game_player.y % 15 == 0 && ($game_player.y - 14) * 128 > $game_map.display_y
@amount_y = -20
@scrolling = true
@prev_y += 1
elsif $game_player.y % 15 == 14 && ($game_player.y) * 128 < $game_map.display_y
@amount_y = 20
@scrolling = true
@prev_y -= 1
end
else @scrolling
# Scroll either left or right
if @amount_x > 0
scroll_right
elsif @amount_x < 0
scroll_left
end
# Scroll either up or down
if @amount_y < 0
scroll_down
elsif @amount_y > 0
scroll_up
end
$game_player.x = @prev_x
$game_player.y = @prev_y
end
$game_map.display_x = @x
$game_map.display_y = @y
@prev_x = $game_player.x
@prev_y = $game_player.y
af_czst_ssm_update
end
end
class Game_Character
def x=(x)
@x = x
end
def y=(y)
@y = y
end
end
I have plans to make it so that you can create events that only execute when they are on the screen. This will make it easy to play different music or sounds based on where you are on the map.
Morderator
Show Signature
Morderator
Administrator
Administrator
Administrator
profile
G@MeF@Ce
profile
@albertfish - don't tell me... you just whipped this one up
nice! I'm so going to use this!
thanks for sharing ^,^
nice! I'm so going to use this!
thanks for sharing ^,^
Administrator
Show Signature
Morderator
Morderator
Morderator
profile
albertfish
profile
Thanks, I actually really like how it turned out. Only seeing small sections of the map at one time it very cool when adding puzzles.
Also, using the grid with a size 20x15 is great for mapping while using this script.
Also, using the grid with a size 20x15 is great for mapping while using this script.
Morderator
Show Signature
Morderator
ACTIVATED
ACTIVATED
Morderator
Morderator
Morderator
profile
albertfish
profile
Yes, you should be able to. If you find any bugs when using this with other scripts just let me know.
Morderator
Show Signature
Morderator
EVENTALIST
EVENTALIST
EVENTALIST
profile
mr_wiggles
profile
Nice albert fish im sure that alot of zelda fans will love this in tehre fan based games
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
Active Member
profile
Reala
profile
how do i make it more than 20 by 15 for a transition
Active Member
Show Signature
Active Member
Morderator
Morderator
Morderator
profile
albertfish
profile
I'm not exactly sure what you are asking. You want to walk farther that 20x15 and then have the screen transition? How far are you planning on walking before the transition?Reala wrote:how do i make it more than 20 by 15 for a transition
Morderator
Show Signature
Morderator
Active Member
Active Member
Active Member
profile
Reala
profile
My game is a platformer so i say 200x15(yes 200)
Active Member
Show Signature
Active Member
Morderator
Morderator
Morderator
profile
albertfish
profile
Well, at that point I would just create multiple maps and transition between the maps. This script was build so that you can make a large map that gets segmented into small screen sized chunks.
What you are asking is possible, however it will require some heavy modification to the code. Also, each chunk of the map has to be the same size for this to work.
I might be able to make this effect work when teleporting between two maps. I can look into that because that seems like it would be much easier to do.
What you are asking is possible, however it will require some heavy modification to the code. Also, each chunk of the map has to be the same size for this to work.
I might be able to make this effect work when teleporting between two maps. I can look into that because that seems like it would be much easier to do.
Morderator
Show Signature
Morderator
Go to page : 1, 2