Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Lancio energia 1.0 by mikb89 per Lusianl
- # Info:
- # Molte delle impostazioni a seguire potranno essere superflue, ho voluto
- # metterne il più possibile per darti un maggiore adattamento. Quindi non
- # aver paura se a prima vista ti sembrano troppe!
- # A nemico colpito verrà attivato uno switch locale. Se vuoi farlo morire
- # con più colpi, ti basterà mettere questa pagina in processo parallelo,
- # quando si attiva aumentare una variabile e poi controllare: se raggiunge
- # un certo numero, attivi lo switch locale che indica il decesso, altrimenti
- # metti lo switch locale OFF, in modo da farlo tornare nemico.
- # Per il resto hai diverse opzioni di animazione e anche sonore!
- # Per qualsiasi cosa sai dove contattarmi.
- # Ah, se nel tuo progetto usi uno script per le 8 direzioni, questo script va
- # messo SOTTO. Importante! In questo caso anche l'energia verrà sparata nelle
- # eventuali direzioni oblique ^^
- module NRG
- # Configurazioni:
- # Grafica energia da visualizzare:
- NOME_FILE = "!Flame"
- INDICE_CHARA = 4 # 0-7
- ANIMAZIONE_INIZIALE = 1 # 0, 1 o 2
- ANIMAZIONE_PASSI = true
- # Effetti grafici:
- TIPO_BLENDING = 0
- OPACITA = 255
- # Movimento energia:
- VELOCITA_MOVIMENTI = 10
- FREQUENZA_MOVIMENTI = 5
- # Opzioni interazione:
- TASTO_PER_ENERGIA = Input::X # Input::QUALCOSA
- BLOCCA_AL_LANCIO = false # Blocca il movimento durante l'animazione di lancio?
- SWITCH_PER_ENERGIA = 500 # Switch che deve essere ON per consentire il tutto
- VARIABILE_MAX_ENERGIA = 500 # Var. che contiene il n° max di energie lanciabili
- # Interazione nemici:
- COMMENTO_NEMICO = "ENEMY" # Cosa deve contenere il commento?
- SWITCH_LOCALE_NEMICO_COLPITO = 'A' # Switch Loc. ON appena colpito
- # Grafica giocatore al lancio energia:
- CHARA_LANCIO = "Actor1"
- INDICE_CHARA_LANCIO = 1 # 0-7
- ANIMA_PER_FRAME = 12 # Durata dell'animazione
- # Parte sonora:
- # Suono al lancio dell'energia:
- NOME_SUONO_AL_LANCIO = "Absorb2" # Lasciare "" per disattivare
- VOLUME_SUONO_AL_LANCIO = 80 # 0-100, ma puoi anche overclockare
- PITCH_SUONO_AL_LANCIO = 150 # 50-150, ma puoi anche overclockare
- # Suono a nemico colpito:
- NOME_SUONO_A_SEGNO = "Blow5" # Lasciare "" per disattivare
- VOLUME_SUONO_A_SEGNO = 80 # 0-100, ma puoi anche overclockare
- PITCH_SUONO_A_SEGNO = 50 # 50-150, ma puoi anche overclockare
- # Suono quando energia colpisce qualcosa:
- NOME_SUONO_BLOCCATO = "Battle2" # Lasciare "" per disattivare
- VOLUME_SUONO_BLOCCATO = 80 # 0-100, ma puoi anche overclockare
- PITCH_SUONO_BLOCCATO = 100 # 50-150, ma puoi anche overclockare
- end
- # Codice:
- class Game_Energy < Game_Character
- attr_reader :to_destroy
- def initialize(dir)
- @to_destroy = false
- super()
- @character_name = NRG::NOME_FILE
- @character_index = NRG::INDICE_CHARA
- @opacity = NRG::OPACITA
- @blend_type = NRG::TIPO_BLENDING
- @direction = dir
- @pattern = NRG::ANIMAZIONE_INIZIALE
- @original_direction = dir
- @original_pattern = NRG::ANIMAZIONE_INIZIALE
- @move_speed = NRG::VELOCITA_MOVIMENTI
- @move_frequency = NRG::FREQUENZA_MOVIMENTI
- @walk_anime = NRG::ANIMAZIONE_PASSI
- @direction_fix = true
- moveto($game_player.x, $game_player.y)
- end
- def update_self_movement
- if @stop_count > 30 * (5 - @move_frequency)
- move_forward
- end
- end
- def passable?(x, y)
- result = super
- unless result
- destroy
- RPG::SE.new(NRG::NOME_SUONO_BLOCCATO,
- NRG::VOLUME_SUONO_BLOCCATO,
- NRG::PITCH_SUONO_BLOCCATO).play if NRG::NOME_SUONO_BLOCCATO != ""
- end
- result
- end
- def map_passable?(x, y)
- return super || $game_map.ship_passable?(x, y)
- end
- def check_event_trigger_touch(x, y)
- return false if $game_map.interpreter.running?
- result = false
- for event in $game_map.events_xy(x, y)
- if event.priority_type == 1
- for code in event.list
- if [108, 408].include?(code.code) && code.parameters.include?(NRG::COMMENTO_NEMICO)
- key = [$game_map.map_id, event.id, NRG::SWITCH_LOCALE_NEMICO_COLPITO]
- $game_self_switches[key] = true
- $game_map.need_refresh = true
- result = true
- end
- end
- end
- end
- if result
- destroy
- RPG::SE.new(NRG::NOME_SUONO_A_SEGNO,
- NRG::VOLUME_SUONO_A_SEGNO,
- NRG::PITCH_SUONO_A_SEGNO).play if NRG::NOME_SUONO_A_SEGNO != ""
- end
- result
- end
- def destroy
- @to_destroy = true
- end
- end
- class Game_Map
- unless method_defined?(:update_events_b4_energy)
- alias_method :update_events_b4_energy, :update_events
- end
- def update_events
- update_events_b4_energy
- return if @nrgs.nil?
- for nrg in 0...@nrgs.size
- next if @nrgs[nrg].nil?
- @nrgs[nrg].update
- if @nrgs[nrg].to_destroy
- @nrgs.delete_at(nrg)
- $scene.spriteset.destroy_nrg(nrg)
- end
- end
- end
- def can_add_nrg?
- return true if @nrgs.nil?
- if $game_switches[NRG::SWITCH_PER_ENERGIA]
- if @nrgs.compact.size < $game_variables[NRG::VARIABILE_MAX_ENERGIA] ||
- $game_variables[NRG::VARIABILE_MAX_ENERGIA] <= 0
- return true
- end
- end
- end
- def add_nrg(nrg)
- (@nrgs ||= [])[$scene.spriteset.add_nrg(nrg)] = nrg
- end
- end
- class Game_Player
- unless method_defined?(:move_by_input_b4_energy)
- alias_method :move_by_input_b4_energy, :move_by_input
- end
- def move_by_input
- unless @anims.nil?
- if @anims == 0
- @character_name = @ex_ch_nm
- @character_index = @ex_ch_ix
- @step_anime = false
- else
- @anims -= 1
- end
- end
- move_by_input_b4_energy if (NRG::BLOCCA_AL_LANCIO && (@anims || 0) == 0) ||
- !NRG::BLOCCA_AL_LANCIO
- if Input.trigger?(NRG::TASTO_PER_ENERGIA) && $game_map.can_add_nrg?
- unless @step_anime
- @ex_ch_nm = @character_name
- @ex_ch_ix = @character_index
- end
- @character_name = NRG::CHARA_LANCIO
- @character_index = NRG::INDICE_CHARA_LANCIO
- @step_anime = true
- RPG::SE.new(NRG::NOME_SUONO_AL_LANCIO,
- NRG::VOLUME_SUONO_AL_LANCIO,
- NRG::PITCH_SUONO_AL_LANCIO).play if NRG::NOME_SUONO_AL_LANCIO != ""
- @anims = NRG::ANIMA_PER_FRAME
- nrg = Game_Energy.new(@direction)
- $game_map.add_nrg(nrg)
- end
- end
- end
- class Spriteset_Map
- unless method_defined?(:create_characters_b4_nrg)
- alias_method :create_characters_b4_nrg, :create_characters
- end
- def create_characters
- create_characters_b4_nrg
- @chnum = @character_sprites.size
- end
- def add_nrg(nrg)
- @character_sprites.push(Sprite_Character.new(@viewport1, nrg))
- @character_sprites.size - 1 - @chnum
- end
- def destroy_nrg(nrg)
- nrg += @chnum
- @character_sprites[nrg].dispose
- @character_sprites.delete_at(nrg)
- $game_map.need_refresh = true
- end
- end
- class Scene_Map
- attr_accessor :spriteset
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement