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

923 connectés actuellement

30729529 visiteurs
depuis l'ouverture

3146 visiteurs
aujourd'hui



Barre de séparation

Partenaires

Indiexpo

Akademiya RPG Maker

Blog Alioune Fall

Fairy Tail Constellations

Zarok

Le Temple de Valor

Leo-Games

Tous nos partenaires

Devenir
partenaire



Ring Menu 1.2

Le menu par défaut est remplacé par un menu circulaire avec des icônes.

Script pour RPG Maker VX Ace
Ecrit par Zangther
Publié par Necromandien (lui envoyer un message privé)
Signaler un script cassé

❤ 0

Script : Ring Menu
Auteur : Zangther
Logiciel : RPG Maker VX Ace

Description : Ce script permet d'avoir un menu déroulant en forme d'anneau, l’icône en surbrillance se situe en haut.

Cette version-ci corrige certains bugs présents dans l'ancienne version proposée par Necromandien :

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
#==============================================================================
# ** Ring Menu - RPG Maker VX ACE
#------------------------------------------------------------------------------
#  This is a simple ring menu.
#          - Core classes are in module Zangther including
#                  - Scene_RingMenu
#                  - Spriteset_Iconring
#                  - Sprite_Icon
#          - Configuration is in the module Zangther::RingMenu::Config
#          - You can change fade_in and fade_out methods, they are into
#              Zangther::RingMenu::Config::Fade
#          - Some edits to Scene_Map, Scene_Item, Scene_File and Scene_End are
#              made at the end of the file in order to make them compatible
#              with this ring menu.
#             (#call_menu for Scene_Map and #return_scene for the others)
#------------------------------------------------------------------------------
# Version : 1.2 by Zangther
#     If any questions, contact me at zangther@gmail.com
#------------------------------------------------------------------------------
# Changelog :
#     v 1.2   : Make non selected icon grayish
#     v 1.1   : Add Scene_HeroFormation
#     v 1.0.1 : Cleaning
#     v 1.0   : Base script
#------------------------------------------------------------------------------
#       Special thanks to Raho, Nuki, S4suk3 and Grim from Funkywork
#         for advises and constant support ! [ http://funkywork.jeun.fr ]
#==============================================================================
module Zangther
  module RingMenu
    module Config
      # Menus' commands
      MENU_COMMAND = [
         # {name: "Name", icon: ID, action: -> {Scene}, prepare: -> {SceneManager.scene.prepare(arguments)} }
         {name: "Items", icon: 261, action: -> {Scene_Item}},
         {name: "Skills", icon: 116, action: -> {Scene_HeroMenu}, prepare: -> {SceneManager.scene.prepare(Scene_Skill)} },
         {name: "Equip", icon: 434, action: -> {Scene_HeroMenu}, prepare: -> {SceneManager.scene.prepare(Scene_Equip)} },
         {name: "Status", icon: 121, action: -> {Scene_HeroMenu}, prepare: -> {SceneManager.scene.prepare(Scene_Status)} },
         {name: "Formation", icon: 11, action: -> {Scene_HeroFormation}},
         {name: "File", icon: 117, action: -> {Scene_Save}},
         {name: "Exit", icon: 12, action: -> {Scene_End}}
      ]
 
      # Angle de base
      START_ANGLE = 1.5 * Math::PI
      # Distance
      DISTANCE = 50
    end
 
    #==============================================================================
    # ** Fade
    #------------------------------------------------------------------------------
    #  Contains methods about fade in and fade out for ring menu.
    #==============================================================================
    module Fade
      #--------------------------------------------------------------------------
      # * Fade in
      #--------------------------------------------------------------------------
      def fade_in(distance)
        distance = distance.to_i
        total_spin
        dist_step = (distance - @distance) / (6.28 / @step)
        opa_step = 255 / (6.28 / @step)
        recede(distance,  dist_step)
        change_opacity(255, opa_step)
        @state = :openning
      end
      #--------------------------------------------------------------------------
      # * Fade out
      #--------------------------------------------------------------------------
      def fade_out(distance)
        distance = distance.to_i
        total_spin
        dist_step = (distance - @distance) / (6.28 / @step)
        opa_step = 255 / (6.28 / @step)
        approach(distance,  dist_step)
        change_opacity(0, -opa_step)
        @state = :closing
      end
    end
 
    #==============================================================================
    # ** Icon
    #------------------------------------------------------------------------------
    #  Add sevreal methods related to icons
    #==============================================================================
    module Icon
      #--------------------------------------------------------------------------
      # * Place the sprite
      #--------------------------------------------------------------------------
      def place(x, y, distance, angle)
        # Force values to numeric
        distance = distance.to_i
        angle = angle.to_f
        # Polar coordinations calculation
        self.x = x.to_i + (Math.cos(angle)*distance)
        self.y = y.to_i + (Math.sin(angle)*distance)
        update
      end
    end
  end
 
  #==============================================================================
  # ** Sprite_Icon
  #------------------------------------------------------------------------------
  #  Just inherit from Sprite and Icon
  #==============================================================================
  class Sprite_Icon < Sprite_Base
    include RingMenu::Icon
  end
 
  #==============================================================================
  # ** Game_CharacterIcon
  #------------------------------------------------------------------------------
  #  Inherits from Game_Character, add some utility methods and changes
  #    move_speed default value
  #==============================================================================
  class Game_CharacterIcon < Game_Character
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
      super
      @move_speed = 1
    end
    #--------------------------------------------------------------------------
    # * Stop movement
    #--------------------------------------------------------------------------
    def stand_still
      @step_anime = false
      straighten
    end
    #--------------------------------------------------------------------------
    # * Make walk
    #--------------------------------------------------------------------------
    def walk
      @step_anime = true
    end
 
  end
 
  #==============================================================================
  # ** Sprite_Character_Icon
  #------------------------------------------------------------------------------
  #  Just inherit from Sprite_Character and Icon, changes update to prevent
  #    placement issues
  #==============================================================================
  class Sprite_Character_Icon < Sprite_Icon
    #--------------------------------------------------------------------------
    # * Public Instance Variables
    #--------------------------------------------------------------------------
    attr_reader :character
    #--------------------------------------------------------------------------
    # * Object Initialization
    #     viewport  : viewport
    #     character : character (Game_Character)
    #--------------------------------------------------------------------------
    def initialize(viewport, character = nil)
      super(viewport)
      @character = character
      update
    end
    #--------------------------------------------------------------------------
    # * Update
    #--------------------------------------------------------------------------
    def update
      super
      @character.update
      update_bitmap
      update_src_rect
      self.z = @character.screen_z
    end
 
    private
    #--------------------------------------------------------------------------
    # * Update Transfer Origin Bitmap
    #--------------------------------------------------------------------------
    def update_bitmap
      if graphic_changed?
        @character_name = @character.character_name
        @character_index = @character.character_index
        set_character_bitmap
      end
    end
    #--------------------------------------------------------------------------
    # * Determine if Graphic Changed
    #--------------------------------------------------------------------------
    def graphic_changed?
      @character_name != @character.character_name ||
        @character_index != @character.character_index
    end
    #--------------------------------------------------------------------------
    # * Set Character Bitmap
    #--------------------------------------------------------------------------
    def set_character_bitmap
      self.bitmap = Cache.character(@character_name)
      sign = @character_name[/^[\!\$]./]
      if sign && sign.include?('$')
        @cw = bitmap.width / 3
        @ch = bitmap.height / 4
      else
        @cw = bitmap.width / 12
        @ch = bitmap.height / 8
      end
      self.ox = @cw / 2
      self.oy = @ch
    end
    #--------------------------------------------------------------------------
    # * Update Transfer Origin Rectangle
    #--------------------------------------------------------------------------
    def update_src_rect
      index = @character.character_index
      pattern = @character.pattern < 3 ? @character.pattern : 1
      sx = (index % 4 * 3 + pattern) * @cw
      sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
      self.src_rect.set(sx, sy, @cw, @ch)
    end
  end
 
  #==============================================================================
  # ** Spriteset_Iconring
  #------------------------------------------------------------------------------
  #  This class manages Sprite_Icon and make then spin around a point.
  #==============================================================================
  class Spriteset_Iconring
    #--------------------------------------------------------------------------
    # * Module inclusions
    #--------------------------------------------------------------------------
    include RingMenu::Fade
    #--------------------------------------------------------------------------
    # * Public Instance Variables
    #--------------------------------------------------------------------------
    attr_reader :x
    attr_reader :y
    attr_reader :distance
    attr_reader :angle
    attr_reader :direction
    attr_reader :actual_direction
    attr_reader :index
    #--------------------------------------------------------------------------
    # * Constants
    #--------------------------------------------------------------------------
    PI_2 = 6.28
    #--------------------------------------------------------------------------
    # * Object Initialization
    #     x, y, distance, speed : int
    #     angle : int (radians)
    #     sprites : Enumeration of RingMenu::Icon
    #     index : int
    #     direction :  :trigo, :antitrigo, :+, :-, :positif, :negatif
    #--------------------------------------------------------------------------
    def initialize(x, y, distance, speed, angle, sprites, index = 0, direction=:trigo)
      # Argument test
      sprites = Array(sprites)
      unless sprites.all? { |sp| (sp.is_a?(RingMenu::Icon)) }
        raise(ArgumentError, "sprite isn't an array of Sprite_Icons")
      end
      # Adjust numeric arguments
      @x = x.to_i + 16
      @y = y.to_i + 16
      @distance = @future_distance = 0
      @speed = speed.to_i
      @angle = (angle.to_f - (index.to_f * (PI_2 / sprites.size))).modulo PI_2
      # Settings
      @shift = {:trigo => 0, :antitrigo => 0}
      @direction = @actual_direction = direction
      @index = index.to_i
      @opacity = @future_opacity = 0
      @icons = sprites
      @state = :closed
      self.step = :default
      fade_in(distance)
      update(true)
    end
    #--------------------------------------------------------------------------
    # * Update
    #  need_refresh : force refresh
    #--------------------------------------------------------------------------
    def update(need_refresh=false)
      return unless @icons
      if moving?
        if spinning?
          reverse_direction if need_reverse?
          update_angle
        end
        update_distance
        need_refresh = true
      end
      update_opacity
      update_state
      refresh if need_refresh
    end
    #--------------------------------------------------------------------------
    # * Prepare terminate method
    #--------------------------------------------------------------------------
    def pre_terminate
      fade_out(0)
    end
    #--------------------------------------------------------------------------
    # * Dispose
    #--------------------------------------------------------------------------
    def dispose
      @icons.each {|icon| icon.dispose}
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      @icons.size.times do |i|
        icon = @icons[i]
        angle = @angle + ((PI_2/(@icons.size))*i)
        icon.place(@x,@y,@distance,angle)
        icon.opacity = @opacity
        icon.tone.gray = (i == @index) ? 0 : 255
        icon.update
      end
    end
    #--------------------------------------------------------------------------
    # * Spin
    #--------------------------------------------------------------------------
    def spin
      unless spinning?
        number_of_icons = @icons.size
        @shift[@direction] += PI_2/number_of_icons
        if @direction == :trigo
          @index += 1
        else
          @index -= 1
        end
        @index = @index.modulo number_of_icons
      end
    end
    #--------------------------------------------------------------------------
    # * Change direction
    #     direction :  :trigo, :antitrigo, :+, :-, :positif, :negatif
    #--------------------------------------------------------------------------
    def change_direction(direction)
      case direction
      when :trigo, :+, :positif
        @direction = :trigo
      when :antitrigo, :-, :negatif
        @direction = :antitrigo
      end
    end
    #--------------------------------------------------------------------------
    # * Change center
    #   x,y : Entiers
    #--------------------------------------------------------------------------
    def changer_centre(x, y)
      @x = x.to_i
      @y = y.to_i
    end
    #--------------------------------------------------------------------------
    # * Set angle
    #--------------------------------------------------------------------------
    def angle=(angle)
      if angle > PI_2 || angle < 0
        angle = 0
      end
      @angle = angle.to_f
    end
    #--------------------------------------------------------------------------
    # * Maj step
    #--------------------------------------------------------------------------
    def step=(step=1)
      if step == :default
        number_of_icons = @icons.size
        @step = PI_2 / (number_of_icons*100) * @speed
      else
        @step = step.to_f * @speed
      end
    end
    #--------------------------------------------------------------------------
    # * Spin right
    #--------------------------------------------------------------------------
    def spin_right
      change_direction(:+)
      spin
    end
    #--------------------------------------------------------------------------
    # * Spin left
    #--------------------------------------------------------------------------
    def spin_left
      change_direction(:-)
      spin
    end
    #--------------------------------------------------------------------------
    # * Move away from center
    #--------------------------------------------------------------------------
    def recede(distance, step = 1)
      @future_distance = distance.to_i
      @distance_step = step.abs
    end
    #--------------------------------------------------------------------------
    # * Move back to center
    #--------------------------------------------------------------------------
    def approach(distance, step = 1)
      @future_distance = distance.to_i
      @distance_step = - step.abs
    end
    #--------------------------------------------------------------------------
    # * Changes opacity
    #--------------------------------------------------------------------------
    def change_opacity(opacity, step = 1)
      if opacity > 255
        @future_opacity = 255
      elsif opacity < 0
        @future_opacity = 0
      else
        @future_opacity = opacity.to_i
      end
      @opacity_step = step.to_i
    end
    #--------------------------------------------------------------------------
    # * Is closed ?
    #--------------------------------------------------------------------------
    def closed?
      @state == :closed
    end
    #--------------------------------------------------------------------------
    # * Is opened ?
    #--------------------------------------------------------------------------
    def opened?
      @state == :opened
    end
    #--------------------------------------------------------------------------
    # * Is closing ?
    #--------------------------------------------------------------------------
    def closing?
      @state == :closing
    end
    #--------------------------------------------------------------------------
    # * Is openning ?
    #--------------------------------------------------------------------------
    def openning?
      @state == :openning
    end
 
    private
    #--------------------------------------------------------------------------
    # * Updates angle positionning
    #--------------------------------------------------------------------------
    def update_angle
      direction = @actual_direction
      shift = @shift[direction]
      step = @step > shift ? shift : @step
      step *= -1 if direction == :trigo
      temp = @angle + step
      if direction == :trigo && temp < 0
        temp += PI_2
      elsif direction == :antitrigo && temp > PI_2
        temp -= PI_2
      end
      @angle = temp
      @shift[direction] = shift - @step
      @shift[direction] = 0 if @shift[direction] < 0
    end
    #--------------------------------------------------------------------------
    # * Updates distance positionning
    #--------------------------------------------------------------------------
    def update_distance
      return if @future_distance == @distance
      temp = @distance + @distance_step
      # Checks if @future_distance is between temp and @distance
      # If so, that's mean that @distance_step is bigger than the gap between @distance & @future_distance
      if (@distance..temp).include?(@future_distance) || (temp..@distance).include?(@future_distance)
        @distance = @future_distance
      else
        @distance += @distance_step
      end
    end
    #--------------------------------------------------------------------------
    # * Updates opacity
    #--------------------------------------------------------------------------
    def update_opacity
      shift = @future_opacity - @opacity
      return if shift == 0
      @opacity += @opacity_step
      if shift > 0
        @opacity = @future_opacity if @opacity > @future_opacity
      else
        @opacity = @future_opacity if @opacity < @future_opacity
      end
    end
    #--------------------------------------------------------------------------
    # * Updates state
    #--------------------------------------------------------------------------
    def update_state
      unless spinning?
        if @state == :closing
          @state = :closed
        elsif @state == :openning
          @state = :opened
        end
      end
    end
    #--------------------------------------------------------------------------
    # * Reverse the direction
    #--------------------------------------------------------------------------
    def reverse_direction
      @actual_direction = (@actual_direction == :trigo ? :antitrigo : :trigo)
    end
    #--------------------------------------------------------------------------
    # * Need revesing direction ?
    #--------------------------------------------------------------------------
    def need_reverse?
      @shift[@actual_direction] <= 0
    end
    #--------------------------------------------------------------------------
    # * Spinning
    #--------------------------------------------------------------------------
    def spinning?
      @shift.any? {|key,val| val > 0}
    end
    #--------------------------------------------------------------------------
    # * Moving ?
    #--------------------------------------------------------------------------
    def moving?
      spinning? || (@future_distance != @distance)
    end
    #--------------------------------------------------------------------------
    # * Make one complete spin
    #--------------------------------------------------------------------------
    def total_spin
      @shift[@direction] += PI_2 unless spinning?
    end
  end
 
  #==============================================================================
  # ** Spriteset_IconCrescent
  #------------------------------------------------------------------------------
  #  This class manages Sprite_Icon and place them as a crescent.
  #==============================================================================
  class Spriteset_IconCrescent
    #--------------------------------------------------------------------------
    # * Fade in
    #--------------------------------------------------------------------------
    attr_reader :index
    attr_reader :pending_index
    #--------------------------------------------------------------------------
    # * Object Initialization
    #     x, y : int
    #     sprites : RingMenu::Icon array
    #--------------------------------------------------------------------------
    def initialize(x, y, sprites)
      unless sprites.all? { |sp| (sp.is_a?(RingMenu::Icon)) }
        raise(ArgumentError, "sprite isn't an array of Sprite_Icons")
      end
      @sprites = sprites
      @distance = RingMenu::Config::DISTANCE
      @x = x
      @y = y
      @index = 0
      @pending_index = 0
      select(0)
      update
    end
    #--------------------------------------------------------------------------
    # * Update
    #--------------------------------------------------------------------------
    def update
      @sprites.each_with_index do |sprite, i|
        update_position(sprite, i)
        sprite.update
      end
    end
    #--------------------------------------------------------------------------
    # * Move
    #--------------------------------------------------------------------------
    def move(direction)
      unselect
      case direction
      when :right
        increment_index
      when :left
        decrement_index
      end
      select(@index)
    end
    #--------------------------------------------------------------------------
    # * Chose a char
    #--------------------------------------------------------------------------
    def chose
      half = @sprites.size / 2
      if @index + 1 > half
        @sprites[@index].character.set_direction(4) # Face left
      else
        @sprites[@index].character.set_direction(6) # Face right
      end
    end
    #--------------------------------------------------------------------------
    # * Unchose a char
    #--------------------------------------------------------------------------
    def unchose
      @sprites[@index].character.set_direction(2)
    end
    #--------------------------------------------------------------------------
    # * Can two swap ?
    #     direction : :right, :left
    #--------------------------------------------------------------------------
    def can_swap?(direction)
      case direction
      when :right
        can_swap_right?
      when :left
        can_swap_left?
      end
    end
    #--------------------------------------------------------------------------
    # * Swap
    #     direction : :right, :left
    #--------------------------------------------------------------------------
    def swap(direction)
      case direction
      when :right
        @pending_index = @index
        swap_right
      when :left
        @pending_index = @index
        swap_left
      end
      chose
    end
 
    private
    #--------------------------------------------------------------------------
    # * Can swap right
    #--------------------------------------------------------------------------
    def can_swap_right?
      @index < @sprites.size - 1
    end
    #--------------------------------------------------------------------------
    # * Can swap left
    #--------------------------------------------------------------------------
    def can_swap_left?
      @index != 0
    end
    #--------------------------------------------------------------------------
    # * Swap right
    #--------------------------------------------------------------------------
    def swap_right
      animated_swap(@sprites[@index], @sprites[@index+1])
      @sprites[@index], @sprites[@index+1] = @sprites[@index+1], @sprites[@index]
      increment_index
    end
    #--------------------------------------------------------------------------
    # * Swap left
    #--------------------------------------------------------------------------
    def swap_left
      animated_swap(@sprites[@index-1], @sprites[@index])
      @sprites[@index-1], @sprites[@index] = @sprites[@index], @sprites[@index-1]
      decrement_index
    end
    #--------------------------------------------------------------------------
    # * Animatte swap
    #     (it's empty but you can fill it fellah)
    #--------------------------------------------------------------------------
    def animated_swap(sprite_left, sprite_right)
    end
    #--------------------------------------------------------------------------
    # * Select char
    #--------------------------------------------------------------------------
    def select(index)
      @sprites[index].character.walk
    end
    #--------------------------------------------------------------------------
    # * Unselect char
    #--------------------------------------------------------------------------
    def unselect
      @sprites[@index].character.stand_still
    end
    #--------------------------------------------------------------------------
    # * Update position of a sprite
    #--------------------------------------------------------------------------
    def update_position(sprite, i)
      angle_gap = Math::PI / @sprites.size
      start_angle = angle_gap / 2 + Math::PI
      angle = start_angle + (angle_gap * i)
      sprite.place(@x,@y,@distance,angle)
    end
    #--------------------------------------------------------------------------
    # * Increment index
    #--------------------------------------------------------------------------
    def increment_index
      @index = (@index + 1) % @sprites.size
    end
    #--------------------------------------------------------------------------
    # * Decrement index
    #--------------------------------------------------------------------------
    def decrement_index
      @index -= 1
      @index = 0 if @index == @sprites.size
    end
 
  end
 
  #==============================================================================
  # ** Scene_RingMenu
  #------------------------------------------------------------------------------
  #  This scene used to be an adventurer like you, but then it took an arrow in the knee.
  #==============================================================================
  class Scene_RingMenu < Scene_MenuBase
    #--------------------------------------------------------------------------
    # * Start processing
    #--------------------------------------------------------------------------
    def start
      super
      create_background
      create_command_ring
      create_command_name
    end
    #--------------------------------------------------------------------------
    # * Termination Processing
    #--------------------------------------------------------------------------
    def terminate
      super
      dispose_background
      dispose_command_name
    end
    #--------------------------------------------------------------------------
    # * Frame Update
    #--------------------------------------------------------------------------
    def update
      super
      if @command_ring.closed?
        @command_ring.dispose
        change_scene
      else
        @command_ring.update
        update_command_name
        update_command_selection unless @command_ring.closing?
      end
    end
 
    private
    #--------------------------------------------------------------------------
    # * Create Command Ring
    #--------------------------------------------------------------------------
    def create_command_ring
      icons = Array.new
      RingMenu::Config::MENU_COMMAND.each do |command|
        icons.push(icon = Sprite_Icon.new)
        icon.bitmap = Cache.system("Iconset")
        index = command[:icon]
        x = index % 16 * 24
        y = (index / 16).truncate * 24
        icon.src_rect = Rect.new(x,y,24,24)
      end
      x = $game_player.screen_x - 28
      y = $game_player.screen_y - 44
      distance = RingMenu::Config::DISTANCE
      angle = RingMenu::Config::START_ANGLE
      @command_ring = Spriteset_Iconring.new(x, y, distance, 10, angle, icons, @index)
    end
    #--------------------------------------------------------------------------
    # * Create Command Text
    #--------------------------------------------------------------------------
    def create_command_name
      @command_name = Sprite.new
      distance = RingMenu::Config::DISTANCE
      width = distance * 2
      @command_name.bitmap = Bitmap.new(width, 24)
      @command_name.x = $game_player.screen_x  - distance
      @command_name.y = $game_player.screen_y + distance
    end
    #--------------------------------------------------------------------------
    # * Update Command Selection
    #--------------------------------------------------------------------------
    def update_command_selection
      if Input.trigger?(Input::B)
        Sound.play_cancel
        do_return
      elsif Input.trigger?(Input::LEFT)
        @command_ring.spin_left
      elsif Input.trigger?(Input::RIGHT)
        @command_ring.spin_right
      elsif Input.trigger?(Input::C)
        Sound.play_ok
        prepare_next_scene
      end
    end
    #--------------------------------------------------------------------------
    # * Update Command Text
    #--------------------------------------------------------------------------
    def update_command_name
      rect = @command_name.src_rect
      command = RingMenu::Config::MENU_COMMAND[@command_ring.index]
      bitmap = @command_name.bitmap
      bitmap.clear
      bitmap.draw_text(rect, command[:name], 1)
    end
    #--------------------------------------------------------------------------
    # * Dispose Command Text
    #--------------------------------------------------------------------------
    def dispose_command_name
      @command_name.dispose
    end
    #--------------------------------------------------------------------------
    # * Prepare transition for new scene
    #--------------------------------------------------------------------------
    def prepare_next_scene
      @index = @command_ring.index
      command = RingMenu::Config::MENU_COMMAND[@command_ring.index]
      @scene = command[:action].call
      @prepare = command.fetch(:prepare) { |el| -> {} }
      @command_ring.pre_terminate
    end
    #--------------------------------------------------------------------------
    # * Execute transition to new scene
    #--------------------------------------------------------------------------
    def change_scene
      if @scene == :none
        SceneManager.return
      else
        SceneManager.call(@scene)
        @prepare.call
      end
    end
    #--------------------------------------------------------------------------
    # * Load the next scene
    #--------------------------------------------------------------------------
    def do_return
      @scene = :none
      @command_ring.pre_terminate
    end
  end
 
  #==============================================================================
  # ** Scene_HeroMenu
  #------------------------------------------------------------------------------
  #  Dance like it hurts, Love like you need money, Work when people are watching.
  #==============================================================================
  class Scene_HeroMenu < Scene_RingMenu
    #--------------------------------------------------------------------------
    # * Initialize
    #--------------------------------------------------------------------------
    def prepare(scene)
      raise "scene must be a Class object !" unless scene.is_a?(Class)
      @scene = scene
    end
 
    private
    #--------------------------------------------------------------------------
    # * Create Command Ring
    #--------------------------------------------------------------------------
    def create_command_ring
      icons = $game_party.members.map do |actor|
        char = Game_Character.new
        char.set_graphic(actor.character_name,actor.character_index)
        Sprite_Character_Icon.new(@viewport, char)
      end
      x = $game_player.screen_x - 16
      y = $game_player.screen_y - 16
      distance = RingMenu::Config::DISTANCE
      angle = RingMenu::Config::START_ANGLE
      @command_ring = Spriteset_Iconring.new(x, y, distance, 10, angle, icons)
    end
    #--------------------------------------------------------------------------
    # * Create Command Text
    #--------------------------------------------------------------------------
    def create_command_name
      @command_name = Sprite.new
      distance = RingMenu::Config::DISTANCE
      width = distance * 2
      @command_name.bitmap = Bitmap.new(width, 24)
      @command_name.x = $game_player.screen_x  - distance
      @command_name.y = $game_player.screen_y + distance
    end
    #--------------------------------------------------------------------------
    # * Update Command Text
    #--------------------------------------------------------------------------
    def update_command_name
      rect = @command_name.src_rect
      hero = $game_party.members[@command_ring.index]
      bitmap = @command_name.bitmap
      bitmap.clear
      bitmap.draw_text(rect, hero.name, 1)
    end
    #--------------------------------------------------------------------------
    # * Load the next scene
    #--------------------------------------------------------------------------
    def prepare_next_scene
      $game_party.menu_actor = $game_party.members[@command_ring.index]
      @command_ring.pre_terminate
    end
    #--------------------------------------------------------------------------
    # * Execute transition to new scene
    #--------------------------------------------------------------------------
    def change_scene
      if @scene == :none
        SceneManager.return
      else
        SceneManager.goto(@scene)
      end
    end
  end
  #==============================================================================
  # ** Scene_HeroFormation
  #------------------------------------------------------------------------------
  #  A ring menu to handle formation issues.
  #==============================================================================
  class Scene_HeroFormation < Scene_MenuBase
    #--------------------------------------------------------------------------
    # * Start
    #--------------------------------------------------------------------------
    def start
      super
      create_command_crescent
      @chosing = false
    end
    #--------------------------------------------------------------------------
    # * Update
    #--------------------------------------------------------------------------
    def update
      super
      update_command_selection
      @command_ring.update
    end
 
    private
    #--------------------------------------------------------------------------
    # * Create command crescent
    #--------------------------------------------------------------------------
    def create_command_crescent
      icons = $game_party.members.map do |actor|
        char = Game_CharacterIcon.new
        char.set_graphic(actor.character_name,actor.character_index)
        Zangther::Sprite_Character_Icon.new(@viewport, char)
      end
      x = $game_player.screen_x
      y = $game_player.screen_y
      distance = Zangther::RingMenu::Config::DISTANCE
      angle = Zangther::RingMenu::Config::START_ANGLE
      @command_ring = Zangther::Spriteset_IconCrescent.new(x, y, icons)
    end
    #--------------------------------------------------------------------------
    # * Update Command Selection
    #--------------------------------------------------------------------------
    def update_command_selection
      if Input.trigger?(Input::B)
        Sound.play_cancel
        do_return
      elsif Input.trigger?(Input::LEFT)
        update_selection(:left)
      elsif Input.trigger?(Input::RIGHT)
        update_selection(:right)
      elsif Input.trigger?(Input::C)
        Sound.play_ok
        if @chosing
          @command_ring.unchose
        else
          @command_ring.chose
        end
        @chosing = !@chosing
      end
    end
    #--------------------------------------------------------------------------
    # * Load the next scene
    #--------------------------------------------------------------------------
    def do_return
      SceneManager.return
    end
 
    private
    #--------------------------------------------------------------------------
    # * Fade in
    #--------------------------------------------------------------------------
    def update_selection(direction)
      if @chosing
        if @command_ring.can_swap?(direction)
          Sound.play_escape
          @command_ring.swap(direction)
          $game_party.swap_order(@command_ring.index,
                                 @command_ring.pending_index)
        else
          Sound.play_buzzer
        end
      else
        Sound.play_cursor
        @command_ring.move(direction)
      end
    end
  end
end
 
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs the map screen processing.
#==============================================================================
class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # * Call Menu Screen
  #--------------------------------------------------------------------------
  def call_menu
    Sound.play_ok
    SceneManager.call(Zangther::Scene_RingMenu)
    Window_MenuCommand::init_command_position
  end
end




Mis à jour le 21 novembre 2020.






Necromandien - posté le 18/02/2015 à 18:44:17 (156 messages postés)

❤ 0

Des p'tits trous, des p'tits trous, TOUJOURS DES P'TITS TROUS !!!

Il y'avait quel genre de bug :susp

Un magicien n'est jamais en retard, ni en avance d'ailleurs, il arrive précisément à l'heure prévue !


Mac-AB - posté le 19/02/2015 à 12:51:10 (82 messages postés)

❤ 0

En tout cas le sien ne marche pas chez moi...
C'est la ligne 545 qui merde. Je peux la supprimer sans problème mais du coup ça ne change rien au script de Necromandien^^
Donc en gros c'est l'image qui permet de mettre l'icône en surbrillance qui manque. Il a ptête oublié de fournir cette image avec son code ?

Tout le monde souhaite être riche... Moi je souhaite que tout le monde soit pauvre...


verehn - posté le 19/02/2015 à 16:01:49 (9058 messages postés) - honor

❤ 0

Vhehrhehn

Script mis à jour à la demande de Zangther.

Eldrao ~ PakuPaku ~ Winged Light ~ Ruin ~ Ma galerie ~ LTDAD ~ Don de graphismes plateforme 2D


Mac-AB - posté le 19/02/2015 à 19:00:12 (82 messages postés)

❤ 0

Cette fois ça marche nickel !
Mais ya pas moyen de mettre l'icone sélectionné en surbrillance ou mettre un icone (genre l'icone 143) en arrière plan pour montrer sur lequel en est ?
Je dis ça car au début je croyais que c'était l'îcone du bas qui fallait regarder alors que c'est celle du haut^^

Tout le monde souhaite être riche... Moi je souhaite que tout le monde soit pauvre...


verehn - posté le 20/03/2015 à 23:42:59 (9058 messages postés) - honor

❤ 0

Vhehrhehn

20/03: Nouvelle mise à jour de Zangther. :kirby

Eldrao ~ PakuPaku ~ Winged Light ~ Ruin ~ Ma galerie ~ LTDAD ~ Don de graphismes plateforme 2D


OmeGarus - posté le 13/06/2015 à 16:32:48 (133 messages postés)

❤ 0

Script très intéressant et qui marche xD

Merci pour ce script

Discord: Unlucky young men#1150


Linith - posté le 15/11/2017 à 18:10:18 (5 messages postés)

❤ 0

Ça aurait été bien une image pour illustrer! :sourit

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