Mettre des lumières

 


Presentation

Auteur : Kylock

Nom du Script : Light Effect VX

Description : Mettez des lumières dans votre jeu, comme des lustres ou un feu de camp.

Preview du résultat final :

Free Image Hosting at www.ImageShack.us

 Avant de pouvoir l'utiliser, importez l'image ci-dessous dans le dossier Picture et nommez la "le".

Image Hosted by ImageShack.us

Pour un meilleur effet, obscurcissez l'écran. Si vous ne savez pas comment faire :

http://www.rpgmakeronline.com/tutoriaux/jeuxdelumiere

Ensuite, créer l'objet lumineux en event et faite "Insérer un commentaire". Là vous avez le choix :

LIGHT pour une petite lumière blanche.
LIGHT2 pour la même mais plus étendue.
FIRE pour un petit feu.
FIRE2 pour un grand feu.
GROUND lumière blanche assez étendue.

Copiez ensuite le script au-dessus de "Main".

Script

#==============================================================================
#
#               RPG Maker ONLINE !!!
#
#==============================================================================
#   Pour faire briller un évenement, choisissez vous même son type.
#==============================================================================
# Types d'éclairage :
#------------------------------------------------------------------------------
#   GROUND - Lumière blanche moyenne.
#   FIRE   - Large lumière rouge.
#   LIGHT  - Faible lumière blanche.
#   LIGHT2 - Forte lumière blanche.
#   TORCH  - Forte lumière rouge sur une petite zone.
#   TORCH2 - Forte lumière rouge sur une grande zone.
#==============================================================================
#  Un grand merci à Lorek !
#==============================================================================

class Spriteset_Map
   alias les_spriteset_map_initalize initialize
   alias les_spriteset_map_dispose dispose
   alias les_spriteset_map_update update
   def initialize
     @light_effects = []
     setup_lights
     les_spriteset_map_initalize
     update
   end
   def dispose
     les_spriteset_map_dispose
     for effect in @light_effects
       effect.light.dispose
     end
     @light_effects = []
   end
   def update
     les_spriteset_map_update
     update_light_effects
   end
   def setup_lights
     for event in $game_map.events.values
       next if event.list == nil
       for i in 0...event.list.size
         if event.list[i].code == 108 and event.list[i].parameters == ["GROUND"]
           type = "GROUND"
           light_effects = Light_Effect.new(event,type)
           light_effects.light.zoom_x = 2
           light_effects.light.zoom_y = 2
           light_effects.light.opacity = 100
           @light_effects.push(light_effects)
         end
         if event.list[i].code == 108 and event.list[i].parameters == ["FIRE"]
           type = "FIRE"
           light_effects = Light_Effect.new(event,type)
           light_effects.light.zoom_x = 300 / 100.0
           light_effects.light.zoom_y = 300 / 100.0
           light_effects.light.opacity = 100
           @light_effects.push(light_effects)
         end
         if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT"]
           type = "LIGHT"
           light_effects = Light_Effect.new(event,type)
           light_effects.light.zoom_x = 1
           light_effects.light.zoom_y = 1
           light_effects.light.opacity = 150
           @light_effects.push(light_effects)
         end
         if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT2"]
           type = "LIGHT2"
           light_effects = Light_Effect.new(event,type)
           light_effects.light.zoom_x = 6
           light_effects.light.zoom_y = 6
           light_effects.light.opacity = 150
           @light_effects.push(light_effects)
         end
         if event.list[i].code == 108 and event.list[i].parameters == ["TORCH"]
           type = "TORCH"
           light_effects = Light_Effect.new(event,type)
           light_effects.light.zoom_x = 6
           light_effects.light.zoom_y = 6
           light_effects.light.opacity = 150
           @light_effects.push(light_effects)
         end
         if event.list[i].code == 108 and event.list[i].parameters == ["TORCH2"]
           type = "TORCH2"
           light_effects = Light_Effect.new(event,type)
           light_effects.light.zoom_x = 6
           light_effects.light.zoom_y = 6
           light_effects.light.opacity = 150
           @light_effects.push(light_effects)
         end
       end
     end
     for effect in @light_effects
       case effect.type
       when "GROUND"
         effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
         effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
         effect.light.blend_type = 1
       when "FIRE"
         effect.light.x = (effect.event.real_x - 600 - $game_map.display_x) / 8 + rand(6) - 3
         effect.light.y = (effect.event.real_y - 600 - $game_map.display_y) / 8 + rand(6) - 3
         effect.light.tone = Tone.new(255,-100,-255,   0)
         effect.light.blend_type = 1
       when "LIGHT"
         effect.light.x = (-0.25 / 2 * $game_map.display_x) + (effect.event.x * 32) - 15
         effect.light.y = (-0.25 / 2 * $game_map.display_y) + (effect.event.y * 32) - 15
         effect.light.blend_type = 1
       when "LIGHT2"
         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
         effect.light.blend_type = 1
       when "TORCH"
         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
         effect.light.tone = Tone.new(255,-100,-255,   0)
         effect.light.blend_type = 1
       when "TORCH2"
         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
         effect.light.tone = Tone.new(255,-100,-255,   0)
         effect.light.blend_type = 1
       end
     end
   end
   def update_light_effects
     if $game_switches[1]
       for effect in @light_effects
         next if effect.type == "FIRE" || effect.type == "TORCH" || effect.type == "LIGHT" || effect.type == "LIGHT2" || effect.type == "TORCH2" || effect.type == "GROUND"
         effect.light.visible = false
       end
     else
       for effect in @light_effects
         next if effect.type == "FIRE" || effect.type == "TORCH" || effect.type == "LIGHT" || effect.type == "LIGHT2" || effect.type == "TORCH2" || effect.type == "GROUND"
         effect.light.visible = true
       end
     end
     for effect in @light_effects
       case effect.type
       when "GROUND"
         effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
         effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
       when "FIRE"
         effect.light.x = (effect.event.real_x - 600 - $game_map.display_x) / 8 + rand(6) - 3
         effect.light.y = (effect.event.real_y - 600 - $game_map.display_y) / 8 + rand(6) - 3
         effect.light.opacity = rand(10) + 90
       when "LIGHT"
         effect.light.x = (-0.25 / 2 * $game_map.display_x) + (effect.event.x * 32) - 15
         effect.light.y = (-0.25 / 2 * $game_map.display_y) + (effect.event.y * 32) - 15
       when "LIGHT2"
         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
       when "TORCH"
         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20 + rand(20) - 10
         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8 + rand(20) - 10
         effect.light.opacity = rand(30) + 70
       when "TORCH2"
         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
         effect.light.opacity = rand(10) + 90
       end
     end
   end
end

class Light_Effect
   attr_accessor :light
   attr_accessor :event
   attr_accessor :type
   def initialize(event, type)
     @light = Sprite.new
     @light.bitmap = Cache.picture("le.png")
     @light.visible = true
     @light.z = 1000
     @event = event
     @type = type
   end
end

 

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

Que la lumière soit ! A bientot.

Auteur: pokermaster
Créé le: 2009-05-27 09:37:00
Dernières modifications: 2010-07-28 01:37:43
Cette page a été vues: 3889 fois

Prenez le temps de visiter nos partenaires

Au programme actu, sorties, photos, cosplays, objets dérivés, liens sympa,vidéos... Tout sur Kingdom Hearts, des actus, des soluces, des vidéos, des musiques et plus encore... Forum réservé pour makers, traitant de thème divers. iKara Rpg Maker Le site de tous les romans de jeux vidéos Premier site de gestion de recrutement et d'équipe pour rpgmaker ! Site officiel du studio Galfart. Jeux et projets Galfart y sont présentés, ainsi que des ressources, scripts, tutoriaux, logiciels sont disponibles. Site consacré à Indie Game Maker, tutoriels, forum, 1 license d'IGM à gagner

Création de Danny Coulombe [ Administration ]
Revu et recodé par Guillaume DIOT

Ajouter aux favoris Ajouter à mes favoris
Abonnement à au bulletin d'informations Newsletters
Abonnement aux flux d'actualités RSS M'abonner aux flux RSS

Espace membres

Pas encore membre ? Inscrivez-vous
Pass oublié ? Cliquez ici

RMoogle



Actuellement en ligne

Votez pour nous


rpg maker online com
votez