Convertion de script background
Lun 7 Juil 2008 - 17:38
Voila, j'aimerais savoir s'il est possible de convertir pour VX ce script "Parallaxe background", qui consiste à pouvoir faire défiler plusieurs panoramas sur une map.
Voici la démo XP:
http://www.megaupload.com/fr/?d=LX4028GK
Merci d'avance !
EDIT :
Script :
Démo : http://www.megaupload.com/?d=1FRJASX4
Voici la démo XP:
http://www.megaupload.com/fr/?d=LX4028GK
Merci d'avance !
EDIT :
Script :
- Spoiler:
- Code:
#===================================================
# ■ Parallax Background - R2- Created by dubealex
# - Moving Panoramas & More -
#===================================================
# Créé par Dubealex (thanks to him ;') ) Adapté par Mister D.
# Forum : http://rpgmakervx.1fr1.net/
#
# -- 10 Juillet 2008 17 h --
#===================================================
#===================================================
# ▼ CLASS Create_Parallax_List Begins
#===================================================
class Create_Parallax_List
def initialize
=begin -----------------------------------------------------------------------------------------------------
■ Map Parallax Background Settings:
---------------------------------------------------------------------------------------------------------
▼ DEFAULT PARALLAX SETTING FOR EACH MAP:
The following list of lines defines each default parallax settings for each map using a
parallax background. The number between square brackets is the map ID. Example:
$map_parallax[3] will refer to the parallax settings of your map ID #3. Just copy the line
to add more settings to all the maps using parallax. The rest will be done automatically by
the script when you load a map in the game. This way you don't have to set full of code in
your teleport, and you can save/load a game and it will work perfectly, as the script now
save the parallax settings in the save file. The parallax settings and syntax is the same as in
previous release: Parallax.new("name", direction, speed, opacity, hue)
Read the manual and play the demo for more info and details about how to manipulate
your parallax within the game. (It's the same way as before, but now you use the right
map ID, so you would do $map_parallax[1].fade_out(2) to fade the parallax of map ID#2.)
=end #----------------------------------------------------------------------------------------------------
$map_parallax[1]=Parallax.new("sky3", 6, 2,255,0)
$map_parallax[2]=Parallax.new("sky1",4,2,255, 0)
#--- ■ END OF SETTINGS-----------------------------------------------------------------------------
end
end
#===================================================
# ▲ CLASS Create_Parallax_List Ends
#===================================================
#===================================================
# ▼ CLASS Parallax Begins
#===================================================
class Parallax
attr_accessor :name, :direction, :speed, :opacity, :hue, :fade
def initialize(name, direction, speed, opacity, hue)
@name=name
@direction=direction
@speed=speed
@opacity=opacity
@hue=hue
@speed=speed
@fade=fade
if $parallax_active==true
$parallax_move[3]=name
$parallax_move[4]=hue
$parallax = Sprite.new
$parallax.bitmap = Cache.parallax(name, hue)
$parallax.x = 0
$parallax.y = 0
$parallax.z = -480
$parallax.opacity = opacity
if direction != 0 and speed != 0
case direction
when 2, 8
if speed > 60
speed=60
end
when 4, 6
if speed > 40
speed=40
end
end
move(direction, speed)
end
end
end
#------------------------------------------------------------------------------------------------------
def erase
$parallax_active=false
$map_parallax[$game_map.map_id]=nil
$parallax_fade[0]=0
$parallax_move[0]=0
if $parallax.nil? == false :$parallax.dispose end
if $parallax_dummy_l.nil? == false :$parallax_dummy_l.dispose end
if $parallax_dummy_r.nil? == false :$parallax_dummy_r.dispose end
if $parallax_dummy_d.nil? == false :$parallax_dummy_d.dispose end
if $parallax_dummy_u.nil? == false :$parallax_dummy_u.dispose end
end
#------------------------------------------------------------------------------------------------------
def fade_in(speed)
if @speed == 0
$parallax_direction=0
end
$parallax_fade[0]=1
$parallax_fade[1]=speed
end
#------------------------------------------------------------------------------------------------------
def fade_out(speed)
if @speed == 0
$parallax_direction=0
end
$parallax_fade[0]=2
$parallax_fade[1]=speed
end
#------------------------------------------------------------------------------------------------------
def stop_fade
$parallax_fade[0]=0
end
#------------------------------------------------------------------------------------------------------
def fade_loop(speed)
if @speed == 0
$parallax_direction=0
end
$parallax_fade[0]=3
$parallax_fade[1]=speed
$parallax_fade[2]=1
end
#------------------------------------------------------------------------------------------------------
def move(direction, speed)
$parallax_direction=direction
$parallax_move[0]=1
$parallax_move[1]=speed
$parallax_move[2]=0
end
end
#===================================================
# ▲ CLASS Parallax Ends
#===================================================
#===================================================
# ▼ CLASS Scene_Map Additional Code Begins
#===================================================
class Scene_Map
alias parallax_original_update update
def update
parallax_original_update
case $parallax_fade[0]
when 1 #Fade In
case $parallax_direction
when 0 #Not Moving
unless $parallax.opacity == 255
$parallax.opacity+=$parallax_fade[1]
$map_parallax[$game_map.map_id].opacity+=$parallax_fade[1]
else
$parallax_fade[0]=0
end
when 2 #Moving down
unless $parallax.opacity == 255
$parallax.opacity+=$parallax_fade[1]
$parallax_dummy_u.opacity+=$parallax_fade[1]
$map_parallax[$game_map.map_id].opacity+=$parallax_fade[1]
else
$parallax_fade[0]=0
end
when 6 #Moving right
unless $parallax.opacity == 255
$parallax.opacity+=$parallax_fade[1]
$parallax_dummy_l.opacity+=$parallax_fade[1]
$map_parallax[$game_map.map_id].opacity+=$parallax_fade[1]
else
$parallax_fade[0]=0
end
when 4 #Moving left
unless $parallax.opacity == 255
$parallax.opacity+=$parallax_fade[1]
$parallax_dummy_r.opacity+=$parallax_fade[1]
$map_parallax[$game_map.map_id].opacity+=$parallax_fade[1]
else
$parallax_fade[0]=0
end
when 8 #Moving up
unless $parallax.opacity == 255
$parallax.opacity+=$parallax_fade[1]
$parallax_dummy_d.opacity+=$parallax_fade[1]
$map_parallax[$game_map.map_id].opacity+=$parallax_fade[1]
else
$parallax_fade[0]=0
end
end
when 2 #Fade Out
case $parallax_direction
when 0 #Not Moving
unless $parallax.opacity == 0
$parallax.opacity-=$parallax_fade[1]
$map_parallax[$game_map.map_id].opacity-=$parallax_fade[1]
else
$parallax_fade[0]=0
end
when 2 #Moving down
unless $parallax.opacity == 0
$parallax.opacity-=$parallax_fade[1]
$parallax_dummy_u.opacity-=$parallax_fade[1]
$map_parallax[$game_map.map_id].opacity-=$parallax_fade[1]
else
$parallax_fade[0]=0
end
when 4 #Moving left
unless $parallax.opacity == 0
$parallax.opacity-=$parallax_fade[1]
$parallax_dummy_r.opacity-=$parallax_fade[1]
$map_parallax[$game_map.map_id].opacity-=$parallax_fade[1]
else
$parallax_fade[0]=0
end
when 6 #Moving right
unless $parallax.opacity == 0
$parallax.opacity-=$parallax_fade[1]
$parallax_dummy_l.opacity-=$parallax_fade[1]
$map_parallax[$game_map.map_id].opacity-=$parallax_fade[1]
else
$parallax_fade[0]=0
end
when 8 #Moving up
unless $parallax.opacity == 0
$parallax.opacity-=$parallax_fade[1]
$parallax_dummy_d.opacity-=$parallax_fade[1]
$map_parallax[$game_map.map_id].opacity-=$parallax_fade[1]
else
$parallax_fade[0]=0
end
end
when 3 #Fade Loop
case $parallax_direction
when 0 #Not Moving
case $parallax_fade[2] when 1 then
unless $parallax.opacity == 255
$parallax.opacity+=$parallax_fade[1]
$map_parallax[$game_map.map_id].opacity+=$parallax_fade[1]
else
$parallax_fade[2]=2
end
when 2
unless $parallax.opacity == 0
$parallax.opacity-=$parallax_fade[1]
$map_parallax[$game_map.map_id].opacity-=$parallax_fade[1]
else
$parallax_fade[2]=1
end
end
when 2 #Moving down
case $parallax_fade[2] when 1 then
unless $parallax.opacity == 255
$parallax.opacity+=$parallax_fade[1]
$parallax_dummy_u.opacity+=$parallax_fade[1]
$map_parallax[$game_map.map_id].opacity+=$parallax_fade[1]
else
$parallax_fade[2]=2
end
when 2
unless $parallax.opacity == 0
$parallax.opacity-=$parallax_fade[1]
$parallax_dummy_u.opacity-=$parallax_fade[1]
$map_parallax[$game_map.map_id].opacity-=$parallax_fade[1]
else
$parallax_fade[2]=1
end
end
when 8 #Moving up
case $parallax_fade[2] when 1 then
unless $parallax.opacity == 255
$parallax.opacity+=$parallax_fade[1]
$parallax_dummy_d.opacity+=$parallax_fade[1]
$map_parallax[$game_map.map_id].opacity+=$parallax_fade[1]
else
$parallax_fade[2]=2
end
when 2
unless $parallax.opacity == 0
$parallax.opacity-=$parallax_fade[1]
$parallax_dummy_d.opacity-=$parallax_fade[1]
$map_parallax[$game_map.map_id].opacity-=$parallax_fade[1]
else
$parallax_fade[2]=1
end
end
when 6 #Moving right
case $parallax_fade[2] when 1 then
unless $parallax.opacity == 255
$parallax.opacity+=$parallax_fade[1]
$parallax_dummy_l.opacity+=$parallax_fade[1]
$map_parallax[$game_map.map_id].opacity+=$parallax_fade[1]
else
$parallax_fade[2]=2
end
when 2
unless $parallax.opacity == 0
$parallax.opacity-=$parallax_fade[1]
$parallax_dummy_l.opacity-=$parallax_fade[1]
$map_parallax[$game_map.map_id].opacity-=$parallax_fade[1]
else
$parallax_fade[2]=1
end
end
when 4 #Moving left
case $parallax_fade[2] when 1 then
unless $parallax.opacity == 255
$parallax.opacity+=$parallax_fade[1]
$parallax_dummy_r.opacity+=$parallax_fade[1]
$map_parallax[$game_map.map_id].opacity+=$parallax_fade[1]
else
$parallax_fade[2]=2
end
when 2
unless $parallax.opacity == 0
$parallax.opacity-=$parallax_fade[1]
$parallax_dummy_r.opacity-=$parallax_fade[1]
$map_parallax[$game_map.map_id].opacity-=$parallax_fade[1]
else
$parallax_fade[2]=1
end
end
end
end
case $parallax_move[0]
when 1
if $parallax_move[2]==0
case $parallax_direction
when 4
$parallax_dummy_r = Sprite.new
$parallax_dummy_r.bitmap = Cache.parallax($parallax_move[3], $parallax_move[4])
$parallax_dummy_r.x = 640
$parallax_dummy_r.y = 0
$parallax_dummy_r.z = -500
$parallax_dummy_r.opacity = $parallax.opacity
when 6
$parallax_dummy_l = Sprite.new
$parallax_dummy_l.bitmap = Cache.parallax($parallax_move[3], $parallax_move[4])
$parallax_dummy_l.x = -640
$parallax_dummy_l.y = 0
$parallax_dummy_l.z = -500
$parallax_dummy_l.opacity = $parallax.opacity
when 8
$parallax_dummy_d = Sprite.new
$parallax_dummy_d.bitmap = Cache.parallax($parallax_move[3], $parallax_move[4])
$parallax_dummy_d.x = 0
$parallax_dummy_d.y = 480
$parallax_dummy_d.z = -500
$parallax_dummy_d.opacity = $parallax.opacity
when 2
$parallax_dummy_u = Sprite.new
$parallax_dummy_u.bitmap = Cache.parallax($parallax_move[3], $parallax_move[4])
$parallax_dummy_u.x = 0
$parallax_dummy_u.y = -480
$parallax_dummy_u.z = -500
$parallax_dummy_u.opacity = $parallax.opacity
end
$parallax_move[2]=1
end
case $parallax_direction
when 4
$parallax_dummy_r.x-=$parallax_move[1]
$parallax.x-=$parallax_move[1]
if $parallax_dummy_r.x==0
$parallax.x=640
end
if $parallax.x==0
$parallax_dummy_r.x=640
end
when 6
$parallax_dummy_l.x+=$parallax_move[1]
$parallax.x+=$parallax_move[1]
if $parallax.x==640
$parallax.x=-640
end
if $parallax_dummy_l.x==640
$parallax_dummy_l.x=-640
end
when 8
$parallax_dummy_d.y-=$parallax_move[1]
$parallax.y-=$parallax_move[1]
if $parallax_dummy_d.y==0
$parallax.y=480
end
if $parallax.y==0
$parallax_dummy_d.y=480
end
when 2
$parallax_dummy_u.y+=$parallax_move[1]
$parallax.y+=$parallax_move[1]
if $parallax_dummy_u.y==0
$parallax.y=-480
end
if $parallax.y==0
$parallax_dummy_u.y=-480
end
end
end
end
end
#===================================================
# ▲ CLASS Scene_Map Additional Code Ends
#===================================================
#===================================================
# ▼ CLASS Scene_Save Additional Code Begins
#===================================================
class Scene_Save < Scene_File
alias parallax_original_write_save_data write_save_data
def write_save_data(file)
parallax_original_write_save_data(file)
Marshal.dump($map_parallax, file)
end
end
#===================================================
# ▲ CLASS Scene_Save Additional Code Ends
#===================================================
#===================================================
# ▼ CLASS Scene_Load Additional Code Begins
#===================================================
class Scene_Load < Scene_File
alias parallax_original_read_save_data read_save_data
def read_save_data(file)
parallax_original_read_save_data(file)
$map_parallax = Marshal.load(file)
end
end
#===================================================
# ▲ CLASS Scene_Load Additional Code Ends
#===================================================
#===================================================
# ▼ CLASS Scene_Title Additional Code Begins
#===================================================
class Scene_Title
$map_parallax=[]
$parallax_fade=[]
$parallax_move=[]
$parallax_direction=0
$parallax_active=false
Create_Parallax_List.new
end
#===================================================
# ▲ CLASS Scene_Title Additional Code Ends
#===================================================
#===================================================
# ▼ CLASS Spriteset_Map Additional Code Begins
#===================================================
class Spriteset_Map
alias parallax_original_initialize initialize
def initialize
parallax_original_initialize
$parallax_active=false
$parallax_fade[0]=0
$parallax_move[0]=0
if $parallax.nil? == false :$parallax.dispose end
if $parallax_dummy_l.nil? == false :$parallax_dummy_l.dispose end
if $parallax_dummy_r.nil? == false :$parallax_dummy_r.dispose end
if $parallax_dummy_d.nil? == false :$parallax_dummy_d.dispose end
if $parallax_dummy_u.nil? == false :$parallax_dummy_u.dispose end
if $map_parallax[$game_map.map_id] != nil
name=$map_parallax[$game_map.map_id].name
direction=$map_parallax[$game_map.map_id].direction
speed=$map_parallax[$game_map.map_id].speed
opacity=$map_parallax[$game_map.map_id].opacity
hue=$map_parallax[$game_map.map_id].hue
$parallax_active=true
Parallax.new(name, direction, speed,opacity,hue)
end
end
end
#===================================================
# ▲ CLASS Spriteset_Map Additional Code Ends
#===================================================
Démo : http://www.megaupload.com/?d=1FRJASX4
_________________
- AzakiModérateur
- Nombre de messages : 1742
Age : 31
Localisation : Dans ton cul(stom), t'as vu, tarba? é_è
Distinction : Commentateur sportif
Indépendantiste Breton
Chevalier de lumière
Membre du Haruhi fan-club
Membre du Tsukasa Nishino fan-club.
[Chou n°3]
Mist'
Fils caché de Francis L'Alan
[Coco' ]
Chevalier Noir
Ex-Empereur d'Erem Vehyx (ou pas!! x) )
Date d'inscription : 14/05/2008
Re: Convertion de script background
Jeu 10 Juil 2008 - 19:47
D'après ce que je vois, ya un argument de trop. Vu que mes connaisances en Ruby ne sont pas assez élevées, bah je peux pas aider plus x)
Re: Convertion de script background
Jeu 10 Juil 2008 - 19:49
Merci pour cette remarque qui m'aide beaucoup Azaki, tu es mon nouveau dieu
_________________
- AzakiModérateur
- Nombre de messages : 1742
Age : 31
Localisation : Dans ton cul(stom), t'as vu, tarba? é_è
Distinction : Commentateur sportif
Indépendantiste Breton
Chevalier de lumière
Membre du Haruhi fan-club
Membre du Tsukasa Nishino fan-club.
[Chou n°3]
Mist'
Fils caché de Francis L'Alan
[Coco' ]
Chevalier Noir
Ex-Empereur d'Erem Vehyx (ou pas!! x) )
Date d'inscription : 14/05/2008
Re: Convertion de script background
Jeu 10 Juil 2008 - 19:52
Lol, c'était marqué sur la fenetre d'avertissement. Et maintenant que je suis ton nouveau dieu, bah Death' va m'en vouloir.
C'est pas l'argument parallaxes qui est de trop? ^^
Edit Wido : ca va tu peux te calmer ma remarque était purement ironique ... xD
Mist' : Moi je pense plutôt que c'est hue qui fait tout bugguer...
J'corrige ça
C'est pas l'argument parallaxes qui est de trop? ^^
Edit Wido : ca va tu peux te calmer ma remarque était purement ironique ... xD
Mist' : Moi je pense plutôt que c'est hue qui fait tout bugguer...
J'corrige ça
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum