Day.png);">
Apprendre


Vous êtes
nouveau sur
Oniromancie?

Visite guidée
du site


Découvrir
RPG Maker


Apprendre
RPG Maker

Tutoriels
Guides
Making-of

Dans le
Forum

Section Entraide

Jeux: puie z / Jeux: Citymaime - Chapitre 1 / Jeux: Mer, îles et fous / News: Du neuf dans le making / News: Muma|Rope est disponible en (...) / Chat

Bienvenue
visiteur !




publicité RPG Maker!

Statistiques

Liste des
membres


Contact

Mentions légales

919 connectés actuellement

30729523 visiteurs
depuis l'ouverture

3140 visiteurs
aujourd'hui



Barre de séparation

Partenaires

Indiexpo

Akademiya RPG Maker

Blog Alioune Fall

Fairy Tail Constellations

Eclipso

Le Comptoir Du clickeur

Level Up!

Planète Glutko

Tous nos partenaires

Devenir
partenaire



Particle Engine 1.2

Permet d'utiliser des animations à particules en jeu.

Script pour RPG Maker VX
Ecrit par Anaryu
Publié par cari974 (lui envoyer un message privé)
Signaler un script cassé

❤ 0

Auteur : Anaryu
Logiciel : RPG Maker VX
Nombre de scripts : 2
Source : https://save-point.org/thread-2377.html

Fonctionnalités
- Ajoute un système de gestion des animations à particules (animations que l'on peut zoomer, faire disparaître graduellement ou déplacer pour simuler une flamme ou autre).
image

Conditions d'utilisation
- Vous devez créditer l'auteur (Anaryu)
- Vous ne pouvez pas utiliser ce script dans les projets commerciaux

Installation
Placez les deux scripts dans l'ordre au-dessus de Main.

Utilisation
Les explications sont dans le script et dans la démo.

Le système utilisant beaucoup d'images de la class Sprite, il est recommandé d'utiliser un anti-lag.

Portion de code : Tout sélectionner

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
#==============================================================================
# P A R T I C L E    E N G I N E    VX
#------------------------------------------------------------------------------
#  Author: Andrew McKellar (Anaryu) (anmckell@gmail.com)
#
#  Version: 1.2
#
#  1.2: Added animation support to Partile Engine.
#
#  This script is built to work with the default systems but can be adapated
#  to work with most, epsecially event-driven systems.
#
#  All particles should be loaded into the Pictures folder.
#
#  Please credit if used, not licensed for commercial use without consent.
#==============================================================================
 
#==============================================================================
# ** Particle Setting
#------------------------------------------------------------------------------
#  Instance of the settings for a particle
#==============================================================================
 
class Particle_Setting
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  # [Speed] is how many frames to wait before
  # making [Power] amount of the parctile
  # So [Power] of 2 and [Speed] of 3 means 2 particles every 3 frames
  attr_accessor       :power          # Power of the particle
  attr_accessor       :speed          # Speed of the particle generation
  # [Intensity] is the starting opacity 1-255 and
  # [burnout] is how how much the opacity changes a particle 
  # is considered "done" when opacity is more than 255 or less than 1
  attr_accessor       :intensity
  attr_accessor       :burnout
  # H and V scatter are how much of a random value the starting location
  # can have, so a [h_scatter] of 10 and a [v_scatter] of 0 means it will
  # generate all particles at the same y location, but with a random
  # difference of 10 pixels (in either direction) of it's x starting location
  attr_accessor       :h_scatter
  attr_accessor       :v_scatter
  # [Velocity] is how fast it changes in each direction [down, left, right, up]
  # [acceleration] is how much the [velocity] changes each frame
  # in each of the same directions [down, left, right, up]
  attr_accessor       :velocity
  attr_accessor       :acceleration
  # [Angle_change] is how much the angle should change each frame and
  # [achange_delta] is how much that angle change will chance each frame
  attr_accessor       :angle_change
  attr_accessor       :achange_delta
  # [zoom_start] is the start value of the zoom for the sprite [x,y]
  # [zoom_starts] is when the zoom transition starts (frame) [x,y]
  # [zoom_change] is the amount to change it [x,y]
  attr_accessor       :zoom_start
  attr_accessor       :zoom_starts
  attr_accessor       :zoom_change
  # [Move_type] decides the move type of the particle
  # 0: Standard Linear Movement
  # 1: Circular movement offset [x,y] used to define x and y radius
  # 2: Explode/collapse based on velocity being + or -
  # 3: Circular in X, linear in Y
  # 4: Circular in Y, linear in X
  attr_accessor       :move_type
  # [Lock] decides if the particle is locked on it's target or will
  # remain where it started
  attr_accessor       :lock
  # [wAmp] and [wLength] and [wSpeed] and [wPhase] are the default values
  # for the wave attributes (read VX documentation under "Sprite" for details)
  attr_accessor       :wamp
  attr_accessor       :wlength
  attr_accessor       :wspeed
  attr_accessor       :wphase
  # [Animation_Frames] if set will create an animated particle instead,
  # which will loop through an image assuming it's width / [animation_frames]
  # will produce the correct number of frames and will loops through
  # these with [Animation_Speed] pause between each frame.
  attr_accessor       :animation_frames
  attr_accessor       :animation_speed
  # The starting frame for the particle, if set to -1 it will be random
  # if set past the pattern limitation it will be the first
  attr_accessor       :animation_start_frame
end
 
#==============================================================================
# ** Particle
#------------------------------------------------------------------------------
#  A Particle is the actual particle itself.
#==============================================================================
 
class Combat_Effect_Setting
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor   :particle
  attr_accessor   :blend
  attr_accessor   :setting
  attr_accessor   :duration
  attr_accessor   :offset
end
 
#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass of the
# Game_Player and Game_Event classes.
#==============================================================================
 
class Game_Character
  #--------------------------------------------------------------------------
  # * Get X for Particle Engine System
  #--------------------------------------------------------------------------
  def get_pe_x
    return @real_x
  end
  #--------------------------------------------------------------------------
  # * Get Y for Particle Engine System
  #--------------------------------------------------------------------------
  def get_pe_y
    return @real_y
  end
end
 
#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  This class deals with events. It handles functions including event page 
# switching via condition determinants, and running parallel process events.
# It's used within the Game_Map class.
#==============================================================================
 
class Game_Event < Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader     :particles
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     map_id : map ID
  #     event  : event (RPG::Event)
  #--------------------------------------------------------------------------
  alias :pre_pe_initialize  :initialize
  def initialize(map_id, event)
    # Generate particle variables
    @particles = []
    @particles_created = false
    # Normal init
    pre_pe_initialize(map_id, event)
  end
  #--------------------------------------------------------------------------
  # * Create Particles
  #--------------------------------------------------------------------------
  def create_particles
    # Check to see if we have particles
    if @event.name.include?("PART") and not @particles_created
      # Add effects found in the event codes
      if self.list != nil
        for item in self.list
          if item.code == 108 and item.parameters[0].include?("PARTICLE=")
            id = item.parameters[0].split('=')
            particle_settings = id[1].to_s
            ps = particle_settings.split(',')
            if ps.size == 3
              particle = $scene.ap(ps[0].to_s, self, ps[1].to_i, -1, ps[2].to_s)
              @particles.push(particle)
            elsif ps.size == 5
              particle = $scene.ap(ps[0].to_s, self, ps[1].to_i, -1, ps[2].to_s, [ps[3].to_i, ps[4].to_i])
              @particles.push(particle)
            end
          end
        end
      end
    end
    @particles_created = true
  end
  #--------------------------------------------------------------------------
  # * Clear Starting Flag
  #--------------------------------------------------------------------------
  alias :pre_pe_clear_starting  :clear_starting
  def clear_starting
    pre_pe_clear_starting
    # Also clear particle flags and clear all particles
    for i in 0...@particles.size
      @particles[i].dispose
      @particles[i] = nil
    end
    @particles.delete(nil)
    @particles_created = false
  end
  #--------------------------------------------------------------------------
  # * Clear Starting Flag
  #--------------------------------------------------------------------------
  def clear_particles
    @particles = [] if @particles == nil
    # Also clear particle flags and clear all particles
    for i in 0...@particles.size
      @particles[i].dispose
      @particles[i] = nil
    end
    @particles.delete(nil)
    @particles_created = false
  end
end
 
#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
#  This class handles maps. It includes event starting determinants and map
# scrolling functions. The instance of this class is referenced by $game_map.
#==============================================================================
 
class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * Execute Player Transfer
  #--------------------------------------------------------------------------
  alias :pre_pe_perform_transfer  :perform_transfer
  def perform_transfer
    # Perform normal transfer
    pre_pe_perform_transfer
    # If we're staying on the same map, remake the particles
    if $game_map.map_id == @new_map_id
      for event in $game_map.events.values
        event.clear_particles
      end
    end
  end
end
 
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles data surrounding the system. Backround music, etc.
#  is managed here as well. Refer to "$game_system" for the instance of 
#  this class.
#==============================================================================
 
class Game_System
  attr_accessor   :particle_level
  attr_accessor   :particle_settings
  attr_accessor   :combat_settings
  alias :pre_pe_initialize  :initialize
  def initialize
    # Run original initialize
    pre_pe_initialize
    # Set new values
    @particle_level = 100
    @particle_settings = {}
    @combat_settings = {}
    battle_effect_settings
  end
end
 
#==============================================================================
# ** Interpreter
#------------------------------------------------------------------------------
#  This interpreter runs event commands. This class is used within the
#  Game_System class and the Game_Event class.
#==============================================================================
 
class Game_Interpreter
  attr_accessor   :effects
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias :pre_pe_initialize  :initialize
  def initialize(depth = 0, main = false)
    @effects = []
    pre_pe_initialize(depth, main)
  end
  #--------------------------------------------------------------------------
  # * Add Effect
  #--------------------------------------------------------------------------
  def add_effect(id, particle)
    # Initialize @effects if it's not initialized yet to cope
    # with late particle system integration
    @effects = [] if @effects == nil
    # Dispose of effect at given id if possible
    if @effects[id] == nil
      @effects[id] = particle
    else
      @effects[id].disposed = true
      @effects[id] = particle
    end
  end
  #--------------------------------------------------------------------------
  # * Dispose Effect
  #--------------------------------------------------------------------------
  def dispose_effect(id = 0)
    # Initialize @effects if it's not initialized yet to cope
    # with late particle system integration
    @effects = [] if @effects == nil
    # Dispose of effect at given id if possible
    if @effects[id] != nil
      @effects[id].disposed = true
    end
  end
end
 
#==============================================================================
# ** Particle_Effect
#------------------------------------------------------------------------------
#  A Particle_Effect will generate particles based on it's settings.
#==============================================================================
 
class Scene_Map
  #--------------------------------------------------------------------------
  # * Execute Screen Switch
  #--------------------------------------------------------------------------
  alias  :pre_pe_update_scene_change    :update_scene_change
  def update_scene_change
    # Set clear flag
    clear = ($game_temp.next_scene != nil)
    # Run normal function
    pre_pe_update_scene_change
    # Clear particles as the scene has changed
    if clear
      for event in $game_map.events.values
        event.clear_particles
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Add Particle Effect
  #--------------------------------------------------------------------------
  def ap(name, target, blend, duration, setting, offset = [0,0])
    s = $game_system.particle_settings[setting]
    if target?(target)
      return @spriteset.ap(name, target, blend, duration, s, offset.clone)
    else
      return @spriteset.ap(name, target.clone, blend, duration, s, offset.clone)
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias :pre_pe_update  :update
  def update
    # Run normal update
    pre_pe_update
    # Update particles
    if $scene.is_a?(Scene_Map)
      for event in $game_map.events.values
        event.create_particles
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Add Particle
  #--------------------------------------------------------------------------
  def add_particle(target, name, blend, setting, offset, v = nil, a = nil)
    @spriteset.add_particle(target, name, blend, setting, offset, v, a)
  end
  #--------------------------------------------------------------------------
  # * Add Particle
  #--------------------------------------------------------------------------
  def target?(t)
    return true if t.is_a?(Game_Character)
    return true if t.is_a?(Sprite_Battler)
    return false
  end
end
 
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================
 
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  alias :pre_pe_start   :start
  def start
    # Generate battle effect settings
    $game_system.battle_effect_settings
    # Run normal start
    pre_pe_start
  end
  #--------------------------------------------------------------------------
  # * Add Particle Effect
  #--------------------------------------------------------------------------
  def ap(name, target, blend, duration, setting, offset = [0,0])
    s = $game_system.particle_settings[setting]
    if target?(target)
      return @spriteset.ap(name, target, blend, duration, s, offset.clone)
    else
      return @spriteset.ap(name, target.clone, blend, duration, s, offset.clone)
    end
  end
  #--------------------------------------------------------------------------
  # * Add Particle
  #--------------------------------------------------------------------------
  def add_particle(target, name, blend, setting, offset, v = nil, a = nil)
    @spriteset.add_particle(target, name, blend, setting, offset, v, a)
  end
  #--------------------------------------------------------------------------
  # * Add Particle
  #--------------------------------------------------------------------------
  def target?(t)
    return true if t.is_a?(Game_Character)
    return true if t.is_a?(Sprite_Battler)
    return false
  end
end
 
#==============================================================================
# ** Sprite_Base
#------------------------------------------------------------------------------
#  A sprite class with animation display processing added.
#==============================================================================
 
class Sprite_Base < Sprite
  #--------------------------------------------------------------------------
  # * SE and Flash Timing Processing
  #     timing : timing data (RPG::Animation::Timing)
  #--------------------------------------------------------------------------
  alias   :pre_pe_animation_process_timing  :animation_process_timing
  def animation_process_timing(timing)
    c = timing.flash_color
    if c.alpha == 0 and c.red == 1
      e = $game_system.combat_settings[timing.flash_duration]
      if $scene.is_a?(Scene_Battle)
        offset = [e.offset[0], e.offset[1]]
        offset[0] += c.green
        offset[1] += c.blue
        $scene.ap(e.particle, self, e.blend, e.duration, e.setting, offset)
      end
    else
      pre_pe_animation_process_timing(timing)
    end
  end
  #--------------------------------------------------------------------------
  # * Get X for Particle Engine System
  #--------------------------------------------------------------------------
  def get_pe_x
    return (@battler.screen_x * 8)
  end
  #--------------------------------------------------------------------------
  # * Get Y for Particle Engine System
  #--------------------------------------------------------------------------
  def get_pe_y
    return ((@battler.screen_y * 8) - (@height * 4))
  end
end
 
#==============================================================================
# ** Spriteset
#------------------------------------------------------------------------------
#  A Particle_Effect will generate particles based on it's settings.
#==============================================================================
 
class Spriteset_Map
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader     :particles
  attr_reader     :effects
  #--------------------------------------------------------------------------
  # * Initialization
  #--------------------------------------------------------------------------
  alias :pre_pe_initialize  :initialize
  def initialize
    @frame = 0
    @particles = []
    @effects = []
    $game_system.particle_settings = {} if $game_system.particle_settings == nil
    $game_system.create_particle_settings
    pre_pe_initialize
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  alias :pre_pe_dispose :dispose
  def dispose
    for particle in @particles
      particle.dispose
    end
    pre_pe_dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias :pre_pe_update :update
  def update    
    # Set the particle level if it's nil to 100 (full amount)
    $game_system.particle_level = 100 if $game_system.particle_level == nil
    # Go through and update effects
    for i in 0...@effects.size
      # Update only if on_screen (or close)
      @effects[i].update if on_screen(@effects[i])
      # Nil it if it's time to dispose it
      @effects[i] = nil if @effects[i].dispose?
    end
    # Delete those disposed effects
    @effects.delete(nil)
    # Updated particles
    for i in 0...@particles.size
      # Update
      @particles[i].update
      # Check if disposed
      dispose = @particles[i].dispose?
      # If disposed dispose and nil it
      @particles[i].dispose if dispose
      @particles[i] = nil if dispose
    end
    # Delete disposed particles
    @particles.delete(nil)
    # Run standard update
    pre_pe_update
  end
  #--------------------------------------------------------------------------
  # * Add Particle
  #--------------------------------------------------------------------------
  def ap(name, target, blend, duration, setting, offset = [0,0])
    s = $game_system.particle_settings[setting]
    t = target
    t = target.clone if not target?(target)
    effect = Particle_Effect.new(name, target, blend, duration, setting, offset.clone)
    @effects.push(effect)
    return effect
  end
  #--------------------------------------------------------------------------
  # * Add Particle
  #--------------------------------------------------------------------------
  def add_particle(target, name, blend, setting, offset, v = nil, a = nil)
    particle = Particle.new(@viewport1, target, name, blend, setting, offset, v, a)
    @particles.push(particle)
  end
  #--------------------------------------------------------------------------
  # * On Screen
  #--------------------------------------------------------------------------
  def on_screen(effect)
    x = effect.origin[0]
    y = effect.origin[1]
    x_range = ((x <= ($game_map.display_x + 4352)) and (x >= ($game_map.display_x - 512)))
    y_range = ((y <= ($game_map.display_y + 3072)) and (y >= ($game_map.display_y - 512)))
    if x_range and y_range
      return true
    end
    return false
  end
  #--------------------------------------------------------------------------
  # * Add Particle
  #--------------------------------------------------------------------------
  def target?(t)
    return true if t.is_a?(Game_Character)
    return true if t.is_a?(Sprite_Battler)
    return false
  end
end
 
#==============================================================================
# ** Spriteset
#------------------------------------------------------------------------------
#  A Particle_Effect will generate particles based on it's settings.
#==============================================================================
 
class Spriteset_Battle
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader     :particles
  attr_reader     :effects
  #--------------------------------------------------------------------------
  # * Initialization
  #--------------------------------------------------------------------------
  alias :pre_pe_initialize  :initialize
  def initialize
    @particles = []
    @effects = []
    $game_system.particle_settings = {} if $game_system.particle_settings == nil
    $game_system.create_particle_settings
    pre_pe_initialize
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  alias :pre_pe_dispose :dispose
  def dispose
    for particle in @particles
      particle.dispose
    end
    pre_pe_dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias :pre_pe_update :update
  def update
    # Set the particle level if it's nil to 100 (full amount)
    $game_system.particle_level = 100 if $game_system.particle_level == nil
    # Go through and update effects
    for i in 0...@effects.size
      # Update only if on_screen (or close)
      @effects[i].update
      # Nil it if it's time to dispose it
      @effects[i] = nil if @effects[i].dispose?
    end
    # Delete those disposed effects
    @effects.delete(nil)
    # Updated particles
    for i in 0...@particles.size
      # Update
      @particles[i].update
      # Check if disposed
      dispose = @particles[i].dispose?
      # If disposed dispose and nil it
      @particles[i].dispose if dispose
      @particles[i] = nil if dispose
    end
    # Delete disposed particles
    @particles.delete(nil)
    # Run standard update
    pre_pe_update
  end
  #--------------------------------------------------------------------------
  # * Add Particle
  #--------------------------------------------------------------------------
  def ap(name, target, blend, duration, setting, offset = [0,0])
    s = $game_system.particle_settings[setting]
    t = target
    t = target.clone if not target?(target)
    effect = Particle_Effect.new(name, target, blend, duration, setting, offset.clone)
    @effects.push(effect)
    return effect
  end
  #--------------------------------------------------------------------------
  # * Add Particle
  #--------------------------------------------------------------------------
  def add_particle(target, name, blend, setting, offset, v = nil, a = nil)
    particle = Particle.new(@viewport1, target, name, blend, setting, offset, v, a)
    @particles.push(particle)
  end
  #--------------------------------------------------------------------------
  # * Add Particle
  #--------------------------------------------------------------------------
  def target?(t)
    return true if t.is_a?(Game_Character)
    return true if t.is_a?(Sprite_Battler)
    return false
  end
end
 
#==============================================================================
# ** Particle_Effect
#------------------------------------------------------------------------------
#  A Particle_Effect will generate particles based on it's settings.
#==============================================================================
 
class Particle_Effect
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor   :origin       # starting location in realx/realy location
  attr_accessor   :target       # game character or starting [x,y] origin
  attr_reader     :power        # higher power means more particles per tick
  attr_reader     :speed        # higher speed means faster particle generation
  attr_reader     :blend        # blend type 0 = normal, 1 = add, 2 = subtract
  attr_reader     :velocity     # initial speed [x,y]
  attr_reader     :acceleration # amount to change speed [x,y]
  attr_reader     :duration     # length of frames to produce particles
  attr_reader     :h_scatter    # magnitude of random horizontal offsets
  attr_reader     :v_scatter    # magnitude of random vertical offsets
  attr_reader     :particle     # name of the picture file to use
  attr_reader     :lock         # locked on target or not?
  attr_reader     :offset       # [x,y] offset
  attr_accessor   :disposed     # should this be disposed of now?
  attr_reader     :frame        # frames, starts at zero and increases over time
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(name, target, blend, duration, setting, offset)
    # Assign starting values
    if target?(target)
      @origin = [target.get_pe_x, target.get_pe_y]
      @target = target
    else
      @origin = [target[0], target[1]]
      @target = target.clone
    end
    @name = name
    @setting = setting
    @blend = blend
    @duration = duration
    @particle = name
    @offset = offset
    @frames = 0
    @powered = 0
    @disposed = false
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Add new particles if necessary
    gen_frame = (@frames % @setting.speed == 0)
    powed = (@powered[1] == 0 or (@powered[0] > 0 and @frames % @powered[1] == 0))
    # Check if the level of particles set will allow us to generate or not
    rand = $game_system.particle_level > rand(100)
    # Use the checks to determine if we should generate a particle right now
    if (gen_frame or powed) and rand
      # If we're going to generate more than one per tick, do it!
      @setting.power[1] == 0 ? @repeat = @setting.power[0] : @repeat = 1
      for i in 0...@repeat
        # Set the powered value 
        @powered = @setting.power.clone if @powered[0] <= 0
        # Generate scattered start points
        x_rand = rand(@setting.h_scatter+1)
        y_rand = rand(@setting.v_scatter+1)
        # Scatter in all directions, not just one
        neg1 = rand(2)
        x_rand *= -1 if neg1 == 1
        neg2 = rand(2)
        y_rand *= -1 if neg2 == 1
        # Apply the scatter values
        offset = [@offset[0] + x_rand, @offset[1] + y_rand]
        # Set the particles starting conditions based on move_type
        case @setting.move_type
        when 0, 1, 3, 4
          # Create the particles with the offset
          offset = [@offset[0] + x_rand, @offset[1] + y_rand]
          $scene.add_particle(@target, @name, @blend, @setting, offset)
        when 2
          # Get a scatter value
          x_mod = x_rand.abs * 1.0 / (@setting.h_scatter + 1)
          y_mod = y_rand.abs * 1.0 / (@setting.v_scatter + 1)
          # Clone our velocity and accelerate to accomodate random start place
          # but identical ending location
          v = [@setting.velocity[0] * x_mod, @setting.velocity[1] * y_mod]
          a = [@setting.acceleration[0] * x_mod, @setting.acceleration[1] * y_mod]
          # Invert values if necessary
          if neg1 == 1
            v = [v[0] * -1.0, v[1]]
            a = [a[0] * -1.0, a[1]]
          end
          if neg2 == 1
            v = [v[0], v[1] * -1.0]
            a = [a[0], a[1] * -1.0]
          end
          # Fix origin to accomodate moving characters
          if target?(target)
            @origin = [target.get_pe_x, target.get_pe_y]
          end
          # Add the particle
          $scene.add_particle(@target, @name, @blend, @setting, offset, v, a)
        end
        # Reduced our powered value
        @powered[0] -= 1
      end
    end
    # Increase frame
    @frames += 1
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def dispose?
    # Return true if we're set to be disposed
    return true if @disposed
    # Return false immediately if our duration is 01
    return false if @duration == -1
    # Return true if our frames are at or past duration
    if @frames > @duration
      return true
    end
    # Default false
    return false
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def dispose
    @disposed = true
  end
  #--------------------------------------------------------------------------
  # * Add Particle
  #--------------------------------------------------------------------------
  def target?(t)
    return true if t.is_a?(Game_Character)
    return true if t.is_a?(Sprite_Battler)
    return false
  end
end
 
 
#==============================================================================
# ** Particle
#------------------------------------------------------------------------------
#  A Particle is the actual particle itself.
#==============================================================================
 
class Particle < Sprite
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader     :target       # game character or starting [x,y] origin
  attr_reader     :velocity     # initial speed [x,y]
  attr_reader     :acceleration # amount to change speed [x,y]
  attr_reader     :duration     # length of frames to produce particles
  attr_reader     :particle     # name of the picture file to use
  attr_reader     :offset       # [x,y] offset
  attr_reader     :opacity      # current opacity
  attr_reader     :achange      # angle change
  attr_reader     :opacity      # current opacity
  attr_reader     :setting      # the particle settings to use
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(viewport, target, name, blend, setting, offset = [0,0], v = nil, a = nil)
    super(viewport)
    self.bitmap = Cache.picture(name)
    # Set the setting variable
    @s = setting
    # Set x/y based on target
    @target = target
    @offset = offset.clone
    # Set wave and angle defaults
    self.wave_amp = @s.wamp if @s.wamp != nil
    self.wave_length = @s.wlength if @s.wlength != nil
    self.wave_speed = @s.wspeed if @s.wspeed != nil
    self.wave_phase = @s.wphase if @s.wphase != nil
    @angle = self.angle
    # Set the angle values
    @achange = @s.angle_change
    # Set starting point based on target type (character vs. array)
    if target?(@target)
      self.x = (@target.get_pe_x / 8) + @offset[0]
      self.y = (@target.get_pe_y / 8) + @offset[1]
      @origin = [(@target.get_pe_x / 8) + @offset[0], (@target.get_pe_y / 8) + @offset[1]]
    else
      self.x = @target[0] + @offset[0]
      self.y = @target[1] + @offset[1]
      @origin = [@target[0] + @offset[0], @target[1] + @offset[1]]
    end
    # Set zoome values if they're there
    if @s.zoom_start != nil
      @zoom = [(@s.zoom_start[0] / 100.0), (@s.zoom_start[1] / 100.0)]
      self.zoom_x = @zoom[0]
      self.zoom_y = @zoom[1]
    end
    # Set width and height for animation
    @width = self.bitmap.width
    @width = self.bitmap.width / @s.animation_frames if animated?
    @height = self.bitmap.height
    # Offset x/y based on our sprite size
    self.ox = (@width / 2)
    self.oy = (@height / 2)
    # Set default extra x/y for tile offset
    @x_extra = 0
    @y_extra = 0
    # Set the extra offset if we're a special case type
    set_extra_offset
    # Set blend type and other values
    self.blend_type = blend
    @opacity = @s.intensity
    @velocity = @s.velocity.clone
    @acceleration = @s.acceleration.clone
    @velocity = v if v != nil
    @acceleration = a if a != nil
    # Set internal variables
    @delta = [0,0]
    @frame = 0
    # Set pattern and animation variables
    if @s.animation_start_frame != nil
      if @s.animation_start_frame == -1
        @pattern = rand((@s.animation_frames+1))
      else
        if @s.animation_start_frame > @s.animation_frames
          @pattern = 0
        else
          @pattern = @s.animation_start_frame
        end
      end
    end
    # Run first frame
    update
    update_pattern
  end
  #--------------------------------------------------------------------------
  # * Should I be disposed?
  #--------------------------------------------------------------------------
  def dispose?
    # We're dead if our opacity is zero
    return ((@opacity <= 0) or (@opacity > 255))
  end
  #--------------------------------------------------------------------------
  # * Should I be disposed?
  #--------------------------------------------------------------------------
  def animated?
    # We're dead if our opacity is zero
    return (@s.animation_frames != nil and @s.animation_frames > 0)
  end
  #--------------------------------------------------------------------------
  # * Update Transfer Origin Rectangle
  #--------------------------------------------------------------------------
  def update_pattern
    if animated?
      sx = @pattern * @width
      sy = 0
      self.src_rect.set(sx, sy, @width, @height)
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Change angle
    @achange = @achange + @s.achange_delta
    @angle = @angle + @achange
    self.angle = @angle
    # Decay opacity
    @opacity -= @s.burnout
    self.opacity = @opacity
    # Update animation
    # working
    if animated?
      if @s.animation_speed > 0 and @frame % @s.animation_speed == 0
        @pattern = ((@pattern + 1) % @s.animation_frames)
        update_pattern
      end
    end
    # Change velocity
    @velocity[0] += @acceleration[0]
    @velocity[1] += @acceleration[1]
    @delta[0] += @velocity[0]
    @delta[1] += @velocity[1]
    # Check zoom changes
    if @s.zoom_starts != nil
      # Check each zoom starts frame to see if we start on that axis yet
      if @s.zoom_starts[0] <= @frame
        @zoom[0] += (@s.zoom_change[0] / 100.0)
      end
      if @s.zoom_starts[1] <= @frame
        @zoom[1] += (@s.zoom_change[1] / 100.0)
      end
      # Reset zoom values
      self.zoom_x = @zoom[0]
      self.zoom_y = @zoom[1]
    end
    # Set Z value
    if @target.is_a?(Game_Character)
      if @target.priority_type != nil and @target.priority_type == 2
        self.z = @target.screen_z + 1000
      else
        if self.y > (@target.screen_y - 64)
          self.z = @target.screen_z + 32 + @delta[1]
        else
          self.z = @target.screen_z - 16 + @delta[1]
        end
      end
    elsif @target.is_a?(Sprite_Base)
      self.z = @target.z + 100
    elsif $game_player != nil
      if self.y > ($game_player.screen_y - 16)
        self.z = $game_player.screen_z + 32 + @delta[1]
      else
        self.z = $game_player.screen_z - 16 + @delta[1]
      end
    end
    # Set Screen offsets
    x_screen = 0
    y_screen = 0
    if $game_map != nil
      x_screen = $game_map.display_x / 8
      y_screen = $game_map.display_y / 8
    end
    # Set x/y location
    case @s.move_type
    # Standard acceleration based vector movement
    when 0, 2
      if target?(@target)
        if @s.lock
          self.x = (@target.get_pe_x / 8) + @offset[0] + @delta[0] + @x_extra - x_screen
          self.y = (@target.get_pe_y / 8) + @offset[1] + @delta[1] + @y_extra - y_screen
        else
          self.x = @origin[0] + @offset[0] + @delta[0] + @x_extra - x_screen
          self.y = @origin[1] + @offset[1] + @delta[1] + @y_extra - y_screen
        end
      else
        if @s.lock
          self.x = @target[0] + @offset[0] + @delta[0] + @x_extra - x_screen
          self.y = @target[1] + @offset[1] + @delta[1] + @y_extra - y_screen
        else
          self.x = @origin[0] + @offset[0] + @delta[0] + @x_extra - x_screen
          self.y = @origin[1] + @offset[1] + @delta[1] + @y_extra - y_screen
        end
      end
    # Circles around the target
    when 1
      if target?(@target)
        if @s.lock
          self.x = ((@target.get_pe_x / 8) + @x_extra) + @offset[0] * Math.cos(@velocity[0]*@frame) - x_screen
          self.y = ((@target.get_pe_y / 8) + @y_extra) + @offset[1] * Math.sin(@velocity[1]*@frame) - y_screen
        else
          self.x = @origin[0] + @offset[0] * Math.cos(@velocity[0]*@frame) - x_screen
          self.y = @origin[1] + @offset[1] * Math.sin(@velocity[1]*@frame) - y_screen
        end
      else
        if @s.lock
          self.x = (@target[0] + @x_extra) + @offset[0] * Math.cos(@velocity[0]*@frame) - x_screen
          self.y = (@target[1] + @y_extra) + @offset[1] * Math.sin(@velocity[1]*@frame) - y_screen
        else
          self.x = @origin[0] + @offset[0] * Math.cos(@velocity[0]*@frame) - x_screen
          self.y = @origin[1] + @offset[1] * Math.sin(@velocity[1]*@frame) - y_screen
        end
      end
    # Circles around the X moves in Y
    when 3
      if target?(@target)
        if @s.lock
          self.x = ((@target.get_pe_x / 8) + @x_extra) + @offset[0] * Math.cos(@velocity[0]*@frame) - x_screen
          self.y = (@target.get_pe_y / 8) + @offset[1] + @delta[1] + @y_extra - y_screen
        else
          self.x = @origin[0] + @offset[0] * Math.cos(@velocity[0]*@frame) - x_screen
          self.y = @origin[1] + @offset[1] + @delta[1] + @y_extra - y_screen
        end
      else
        if @s.lock
          self.x = (@target[0] + @x_extra) + @offset[0] * Math.cos(@velocity[0]*@frame) - x_screen
          self.y = @target[1] + @offset[1] + @delta[1] + @y_extra - y_screen
        else
          self.x = @origin[0] + @offset[0] * Math.cos(@velocity[0]*@frame) - x_screen
          self.y = @origin[1] + @offset[1] + @delta[1] + @y_extra - y_screen
        end
      end
    # Circles around the Y and moves in X
    when 4
      if target?(@target)
        if @s.lock
          self.x = (@target.get_pe_x / 8) + @offset[0] + @delta[0] + @x_extra - x_screen
          self.y = ((@target.get_pe_y / 8) + @y_extra) + @offset[1] * Math.sin(@velocity[1]*@frame) - y_screen
        else
          self.x = @origin[0] + @offset[0] + @delta[0] + @x_extra - x_screen
          self.y = @origin[1] + @offset[1] * Math.sin(@velocity[1]*@frame) - y_screen
        end
      else
        if @s.lock
          self.x = @target[0] + @offset[0] + @delta[0] + @x_extra - x_screen
          self.y = (@target[1] + @y_extra) + @offset[1] * Math.sin(@velocity[1]*@frame) - y_screen
        else
          self.x = @origin[0] + @offset[0] + @delta[0] + @x_extra - x_screen
          self.y = @origin[1] + @offset[1] * Math.sin(@velocity[1]*@frame) - y_screen
        end
      end
    end
    # Increase frame count
    @frame += 1
  end
  #--------------------------------------------------------------------------
  # * Add Particle
  #--------------------------------------------------------------------------
  def target?(t)
    return true if t.is_a?(Game_Character)
    return true if t.is_a?(Sprite_Battler)
    return false
  end
  #--------------------------------------------------------------------------
  # * Add Particle
  #--------------------------------------------------------------------------
  def set_extra_offset
    if @target.is_a?(Game_Character)
      @x_extra = 16
      @y_extra = 16
    end
  end
end



Portion de code : Tout sélectionner

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles data surrounding the system. Backround music, etc.
#  is managed here as well. Refer to "$game_system" for the instance of 
#  this class.
#==============================================================================
 
class Game_System
  # [Power] is the number of particles to make in a [a,b] format:
  # [a] is the number of particles, [b] is the pause between each of those
  # [Speed] is the amount of time between each new [Power]
  # For example, [power] of [3,5] and [speed] of 50 would
  # create one particle every 5 frames until after 3 have been made,
  # then 50 frames after it started another 3 would be made with a 5 frame pause
  # and it would continue to do so until the particle was done
  #power          
  #speed          
  # [Intensity] is the starting opacity 1-255 and
  # [burnout] is how how much the opacity changes a particle 
  # is considered "done" when opacity is more than 255 or less than 1
  #intensity
  #burnout
  # H and V scatter are how much of a random value the starting location
  # can have, so a [h_scatter] of 10 and a [v_scatter] of 0 means it will
  # generate all particles at the same y location, but with a random
  # difference of 10 pixels (in either direction) of it's x starting location
  #h_scatter
  #v_scatter
  # [Velocity] is how fast it changes in each direction [x,y]
  # [acceleration] is how much the [velocity] changes each frame
  # in each of the same directions [x,y]
  #velocity
  #acceleration
  # [Angle_change] is how much the angle should change each frame and
  # [achange_delta] is how much that angle change will chance each frame
  #angle_change
  #achange_delta
  # [zoom_start] is the start value of the zoom for the sprite [x,y]
  # [zoom_starts] is when the zoom transition starts (frame) [x,y]
  # [zoom_change] is the amount to change it [x,y]
  #zoom_start
  #zoom_starts
  #zoom_change
  # [Move_type] decides the move type of the particle
  # 0: Standard Linear Movement
  # 1: Circular movement offset [x,y] used to define x and y radius
  # 2: Explode/collapse based on velocity being + or -
  # 3: Circular in X, linear in Y
  # 4: Circular in Y, linear in X
  #move_type
  # [Lock] decides if the particle is locked on it's target or will
  # remain where it started
  #lock
  # [wAmp] and [wLength] and [wSpeed] and [wPhase] are the default values
  # for the wave attributes (read VX documentation under "Sprite" for details)
  #wamp
  #wlength
  #wspeed
  #wphase
  #--------------------------------------------------------------------------
  # * Particle Settings
  #--------------------------------------------------------------------------
  def create_particle_settings
    
    id = "FloatingSmoke"
    p = Particle_Setting.new
    p.power = [5,3]
    p.speed = 15
    p.intensity = 255
    p.burnout = 10
    p.h_scatter = 25
    p.v_scatter = 25
    p.velocity = [0,-1.5]
    p.acceleration = [0,-0.1]
    p.angle_change = 0
    p.achange_delta = 0
    p.move_type = 0
    p.lock = false
    @particle_settings[id] = p.clone
    
    id = "Glitter"
    p = Particle_Setting.new
    p.power = [5,10]
    p.speed = 50
    p.intensity = 255
    p.burnout = 5
    p.h_scatter = 8
    p.v_scatter = 4
    p.velocity = [0,-0.6]
    p.acceleration = [0,0]
    p.angle_change = 5
    p.achange_delta = 0
    p.move_type = 0
    p.lock = false
    @particle_settings[id] = p.clone
    
    id = "LittleFire"
    p = Particle_Setting.new
    p.power = [5,3]
    p.speed = 15
    p.intensity = 255
    p.burnout = 12
    p.h_scatter = 2
    p.v_scatter = 0
    p.velocity = [0,-1]
    p.acceleration = [0,0.05]
    p.angle_change = 0
    p.achange_delta = 0
    p.zoom_start = [50,50]
    p.move_type = 0
    p.lock = false
    @particle_settings[id] = p.clone
    
    id = "MediumFire"
    p = Particle_Setting.new
    p.power = [2,0]
    p.speed = 1
    p.intensity = 255
    p.burnout = 6
    p.h_scatter = 5
    p.v_scatter = 5
    p.velocity = [0,-2]
    p.acceleration = [0,0.05]
    p.angle_change = 0
    p.achange_delta = 0
    p.zoom_start = [120,120]
    p.zoom_starts = [0,0]
    p.zoom_change = [-3,-3]
    p.move_type = 0
    p.lock = false
    @particle_settings[id] = p.clone
    
    id = "LargeFire"
    p = Particle_Setting.new
    p.power = [5,1]
    p.speed = 5
    p.intensity = 255
    p.burnout = 12
    p.h_scatter = 20
    p.v_scatter = 6
    p.velocity = [0,-3]
    p.acceleration = [0,0.05]
    p.angle_change = 0
    p.achange_delta = 0
    p.zoom_start = [80,80]
    p.move_type = 0
    p.lock = false
    @particle_settings[id] = p.clone
    
    id = "LargeSmoke"
    p = Particle_Setting.new
    p.power = [5,1]
    p.speed = 15
    p.intensity = 255
    p.burnout = 10
    p.h_scatter = 25
    p.v_scatter = 10
    p.velocity = [0,-1]
    p.acceleration = [0,-0.05]
    p.angle_change = 0
    p.achange_delta = 0
    p.move_type = 0
    p.zoom_start = [80,80]
    p.zoom_starts = [0,0]
    p.zoom_change = [4,4]
    p.lock = false
    @particle_settings[id] = p.clone
    
    id = "LittleSmoke"
    p = Particle_Setting.new
    p.power = [5,10]
    p.speed = 50
    p.intensity = 255
    p.burnout = 8
    p.h_scatter = 2
    p.v_scatter = 4
    p.velocity = [0,-0.5]
    p.acceleration = [0,-0.1]
    p.angle_change = 0
    p.achange_delta = 0
    p.move_type = 0
    p.lock = false
    @particle_settings[id] = p.clone
    
    id = "ExplodeMedium"
    p = Particle_Setting.new
    p.power = [4,0]
    p.speed = 2
    p.intensity = 255
    p.burnout = 15
    p.h_scatter = 5
    p.v_scatter = 5
    p.velocity = [1,1]
    p.acceleration = [0.5,0.5]
    p.angle_change = 0
    p.achange_delta = 0
    p.move_type = 2
    p.lock = false
    @particle_settings[id] = p.clone
    
    id = "ExplodeLarge"
    p = Particle_Setting.new
    p.power = [4,0]
    p.speed = 2
    p.intensity = 255
    p.burnout = 15
    p.h_scatter = 8
    p.v_scatter = 8
    p.velocity = [2,2]
    p.acceleration = [0.5,0.5]
    p.angle_change = 0
    p.achange_delta = 0
    p.move_type = 2
    p.lock = false
    @particle_settings[id] = p.clone
    
    id = "ExplodeLargePulse"
    p = Particle_Setting.new
    p.power = [4,0]
    p.speed = 2
    p.intensity = 255
    p.burnout = 15
    p.h_scatter = 4
    p.v_scatter = 4
    p.velocity = [6,6]
    p.acceleration = [-0.1,-0.1]
    p.angle_change = 0
    p.achange_delta = 0
    p.move_type = 2
    p.zoom_start = [25,25]
    p.zoom_starts = [0,0]
    p.zoom_change = [10,10]
    p.lock = false
    @particle_settings[id] = p.clone
    
    id = "Spinning"
    p = Particle_Setting.new
    p.power = [2,10]
    p.speed = 20
    p.intensity = 255
    p.burnout = 15
    p.h_scatter = 8
    p.v_scatter = 8
    p.velocity = [0.1,0.1]
    p.acceleration = [0,0]
    p.angle_change = 0
    p.achange_delta = 0
    p.move_type = 1
    p.lock = false
    @particle_settings[id] = p.clone
    
    id = "StaticFade"
    p = Particle_Setting.new
    p.power = [3,20]
    p.speed = 60
    p.intensity = 255
    p.burnout = 5
    p.h_scatter = 0
    p.v_scatter = 0
    p.velocity = [0,0]
    p.acceleration = [0,0]
    p.angle_change = 0
    p.achange_delta = 0
    p.move_type = 0
    p.lock = false
    @particle_settings[id] = p.clone
    
    id = "StaticFade2x"
    p = Particle_Setting.new
    p.power = [3,20]
    p.speed = 60
    p.intensity = 255
    p.burnout = 5
    p.h_scatter = 0
    p.v_scatter = 0
    p.velocity = [0,0]
    p.acceleration = [0,0]
    p.zoom_start = [200,200]
    p.angle_change = 0
    p.achange_delta = 0
    p.move_type = 0
    p.lock = false
    @particle_settings[id] = p.clone
    
    id = "FloatLeft"
    p = Particle_Setting.new
    p.power = [1,5]
    p.speed = 5
    p.intensity = 255
    p.burnout = 12
    p.h_scatter = 5
    p.v_scatter = 2
    p.velocity = [-1,-1]
    p.acceleration = [0,-0.1]
    p.angle_change = 0
    p.achange_delta = 0
    p.move_type = 0
    p.lock = false
    @particle_settings[id] = p.clone
    
    id = "FloatRight"
    p = Particle_Setting.new
    p.power = [1,5]
    p.speed = 5
    p.intensity = 255
    p.burnout = 12
    p.h_scatter = 5
    p.v_scatter = 2
    p.velocity = [1,-1]
    p.acceleration = [0,-0.1]
    p.angle_change = 0
    p.achange_delta = 0
    p.move_type = 0
    p.lock = false
    @particle_settings[id] = p.clone
    
    id = "FloatLeft2x"
    p = Particle_Setting.new
    p.power = [1,5]
    p.speed = 5
    p.intensity = 255
    p.burnout = 12
    p.h_scatter = 5
    p.v_scatter = 2
    p.velocity = [-1,-2]
    p.acceleration = [0,-0.1]
    p.angle_change = 0
    p.zoom_start = [200,200]
    p.achange_delta = 0
    p.move_type = 0
    p.lock = false
    @particle_settings[id] = p.clone
    
    id = "FloatRight2x"
    p = Particle_Setting.new
    p.power = [1,5]
    p.speed = 5
    p.intensity = 255
    p.burnout = 12
    p.h_scatter = 5
    p.v_scatter = 2
    p.velocity = [1,-2]
    p.acceleration = [0,-0.1]
    p.angle_change = 0
    p.zoom_start = [200,200]
    p.achange_delta = 0
    p.move_type = 0
    p.lock = false
    @particle_settings[id] = p.clone
    
    id = "AnimatedFade"
    p = Particle_Setting.new
    p.power = [5,10]
    p.speed = 50
    p.intensity = 255
    p.burnout = 5
    p.h_scatter = 8
    p.v_scatter = 4
    p.velocity = [0,-0.6]
    p.acceleration = [0,0]
    p.angle_change = 5
    p.achange_delta = 0
    p.move_type = 0
    p.lock = false
    p.animation_frames = 4
    p.animation_speed = 20
    p.animation_start_frame = -1
    @particle_settings[id] = p.clone
   
  end
  
  #* class Combat_Effect_Setting
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  #attr_accessor   :particle
  #attr_accessor   :blend
  #attr_accessor   :setting
  #attr_accessor   :duration
  #attr_accessor   :offset
  #--------------------------------------------------------------------------
  # * Particle Declarations
  #--------------------------------------------------------------------------
  def battle_effect_settings
    
    @combat_settings = {}
    
    id = 1
    ces = Combat_Effect_Setting.new
    ces.particle = "fireball"
    ces.blend = 1
    ces.setting = "ExplodeMedium"
    ces.duration = 24
    ces.offset = [0,0]
    @combat_settings[id] = ces.clone
    
    id = 2
    ces = Combat_Effect_Setting.new
    ces.particle = "energy-ball-white"
    ces.blend = 1
    ces.setting = "FloatingSmoke"
    ces.duration = 35
    ces.offset = [0,0]
    @combat_settings[id] = ces.clone
    
    id = 3
    ces = Combat_Effect_Setting.new
    ces.particle = "fireball"
    ces.blend = 1
    ces.setting = "MediumFire"
    ces.duration = 120
    ces.offset = [0,0]
    @combat_settings[id] = ces.clone
    
    id = 4
    ces = Combat_Effect_Setting.new
    ces.particle = "energy-ball-white"
    ces.blend = 1
    ces.setting = "LittleSmoke"
    ces.duration = 160
    ces.offset = [0,0]
    @combat_settings[id] = ces.clone
    
    id = 5
    ces = Combat_Effect_Setting.new
    ces.particle = "thunder1-add"
    ces.blend = 1
    ces.setting = "FloatLeft2x"
    ces.duration = 42
    ces.offset = [0,0]
    @combat_settings[id] = ces.clone
    
    id = 6
    ces = Combat_Effect_Setting.new
    ces.particle = "thunder2-add"
    ces.blend = 1
    ces.setting = "FloatRight2x"
    ces.duration = 42
    ces.offset = [0,0]
    @combat_settings[id] = ces.clone
    
    id = 7
    ces = Combat_Effect_Setting.new
    ces.particle = "bolt1-add"
    ces.blend = 1
    ces.setting = "StaticFade2x"
    ces.duration = 42
    ces.offset = [0,0]
    @combat_settings[id] = ces.clone
    
    id = 8
    ces = Combat_Effect_Setting.new
    ces.particle = "bolt2-add"
    ces.blend = 1
    ces.setting = "StaticFade2x"
    ces.duration = 42
    ces.offset = [0,0]
    @combat_settings[id] = ces.clone
    
  end
end



Démo :
Démo (Miroir 1, Miroir 2)


Mis à jour le 20 novembre 2020.





Aucun commentaire n'a été posté pour le moment.

Suite à de nombreux abus, le post en invités a été désactivé. Veuillez vous inscrire si vous souhaitez participer à la conversation.

Haut de page

Merci de ne pas reproduire le contenu de ce site sans autorisation.
Contacter l'équipe - Mentions légales

Plan du site

Communauté: Accueil | Forum | Chat | Commentaires | News | Flash-news | Screen de la semaine | Sorties | Tests | Gaming-Live | Interviews | Galerie | OST | Blogs | Recherche
Apprendre: Visite guidée | RPG Maker 95 | RPG Maker 2003 | RPG Maker XP | RPG Maker VX | RPG Maker MV | Tutoriels | Guides | Making-of
Télécharger: Programmes | Scripts/Plugins | Ressources graphiques / sonores | Packs de ressources | Midis | Eléments séparés | Sprites
Jeux: Au hasard | Notre sélection | Sélection des membres | Tous les jeux | Jeux complets | Le cimetière | RPG Maker 95 | RPG Maker 2000 | RPG Maker 2003 | RPG Maker XP | RPG Maker VX | RPG Maker VX Ace | RPG Maker MV | Autres | Proposer
Ressources RPG Maker 2000/2003: Chipsets | Charsets | Panoramas | Backdrops | Facesets | Battle anims | Battle charsets | Monstres | Systems | Templates
Ressources RPG Maker XP: Tilesets | Autotiles | Characters | Battlers | Window skins | Icônes | Transitions | Fogs | Templates
Ressources RPG Maker VX: Tilesets | Charsets | Facesets | Systèmes
Ressources RPG Maker MV: Tilesets | Characters | Faces | Systèmes | Title | Battlebacks | Animations | SV/Ennemis
Archives: Palmarès | L'Annuaire | Livre d'or | Le Wiki | Divers