Bienvenue visiteur !
|
Statistiques
Liste des membres
Contact
Mentions légales
222 connectés actuellement
30730018 visiteurs depuis l'ouverture
3635 visiteurs aujourd'hui
Partenaires
Tous nos partenaires
Devenir partenaire
|
daylights -
posté le 06/07/2012 à 14:32:23 (54 messages postés)
| | Domaine concerné: script Logiciel utilisé: RMXP Bonjours !!
Je travail sur mon menu et j'ai un petit problème, j'aimerais faire une animation pour chaque personnage dans l'équipe en 8X1 ex:
Mais je ne sais pas comment faire pour séparer le sprite en 8 et modifier pour le faire animé.
Merci d'avance !
|
Mack -
posté le 06/07/2012 à 14:37:45 (2310 messages postés)
- - | | Tu l'affiches comment ?
Dans une fenêtre, ou c'est un sprite ?
|
( Je prend note de tout les commentaires, même si je n'y répond pas ) |
daylights -
posté le 06/07/2012 à 14:39:47 (54 messages postés)
| | Je l'affiche comme un sprite
|
Mack -
posté le 06/07/2012 à 14:53:18 (2310 messages postés)
- - | |
1
| self.src_rect.set(pos_x, pos_y, largeur, hauteur) |
Pos_x, pos_y c'est les positions de départ du rectangle de sélection.
Largeur et Hauteur, c'est les dimensions du rectangle de sélection.
Donc pour toi, te faut un truc du genre :
1
2
3
4
5
| largeur = 120
hauteur = 112
pos_x = 120*@timer
pos_y = 0
self.src_rect.set(pos_x, pos_y, largeur, hauteur) |
Timer c'est une variable qui va augmenter pour changer l'animation.
Dans la def update du sprite, te faut un truc du genre :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
@wait += 1
if @wait >= 20
@wait = 0
@timer += 1
if @timer > 6
@timer = 0
end
end
largeur = 120
hauteur = 112
pos_x = 120*@timer
pos_y = 0
self.src_rect.set(pos_x, pos_y, largeur, hauteur) |
J'utilise une variable @wait, parce que sinon, ton animation va être beaucoup trop rapide.
( Mais à 20, j'pense que ça sera lent, donc à toi de voir. )
Si timer est plus grand que 6, ça te renvoie au début, sinon, l'image va découpé du "vide".
( Penses à initialisé @timer et @wait à 0 dans la def initialize. )
J'pense que tu devrais y arriver ^^.
|
( Je prend note de tout les commentaires, même si je n'y répond pas ) |
daylights -
posté le 06/07/2012 à 15:43:45 (54 messages postés)
| | Donc si j'ai bien compris je fais ça
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
| #--------------------------------------------------------------------------
# * Draw Anime Character
# actor : actor
#--------------------------------------------------------------------------
def drw_anim(actor, x, y)
anim = RPG::Cache.picture(actor.name + DAY::ANIMATED_CHARACTER) rescue nada
largeur = 120
hauteur = 112
pos_x = 120*@timer
pos_y = 0
self.src_rect.set(pos_x, pos_y, largeur, hauteur)
#-------------------------------------------------------------------------
# * Animated Character Update
#-------------------------------------------------------------------------
def update
@wait += 1
if @wait >= 20
@wait = 0
@timer += 1
if @timer > 6
@timer = 0
end
end
largeur = 120
hauteur = 112
pos_x = 120*@timer
pos_y = 0
self.src_rect.set(pos_x, pos_y, largeur, hauteur)
end
end |
Par la suite je l'ajoute au fiche de personnage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
| self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 121
y = 158
actor = $game_party.actors[0]
self.contents.font.name = DAY::MAIN_FONT
if $script["TP_System"] == true
draw_actor_tp(actor, x + 285, y - 5,4)
else
end
drw_bs(actor, x, y + 80)
drw_bsc(actor, x + 0, y -31)
drw_anim(actor, x + 38, y -100)
draw_maphp3(actor, x - 38, y + 41)
draw_mapsp3(actor, x - 12, y + 58)
draw_mexp2(actor, x - 120, y - 15)
draw_actor_state(actor, x - 10, y - 151)
end
|
Mais je ne voit pas de def initialize, sauf pour la compteur de temps, donc est-ce que je dois le créer ?
|
Mack -
posté le 06/07/2012 à 16:01:29 (2310 messages postés)
- - | | Non, en faite tu l'affiches dans une fenêtre sans passer par un sprite.
T'affiches directement le bitmap dans la fenêtre ?
J'ai tord ?
( Fait voir ton script en entier )
|
( Je prend note de tout les commentaires, même si je n'y répond pas ) |
daylights -
posté le 06/07/2012 à 16:12:56 (54 messages postés)
| |
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
| module MOG
# BASIC MENU CONFIGURATION
# Main Menu Graphics Used
MAIN_LAYOUT = "Layout-Menu" # Main Menu Graphics
MAIN_BACKGROUND = "Back-Menu" # Animated background graphic
MAIN_CURSOR = "MogCursor" # Animated cursor graphic
MAIN_CURSOR_FX = false # Animated cursor fx on/off switch
SECOND_CURSOR = "MogCursor_2" # Animated secondary cursor graphic
SECOND_CURSOR_FX = false # Animated second cursor fx
FACE_SMALL = "_Fl" # Suffix for face graphics (small)
BACK_SELECTION = "_Bs" # Suffix for background selection
CHARACTER_SELECTION = "_Bsc" # Suffix for character selection
ANIMATED_CHARACTER = "_Anim" # Suffix for character animation
BACK_CHANGE = "_Bs3" # Suffix for background Party change
MAIN_MAPNAME = true # If true, shows the map name
# Menu
MAIN_FX = 0 # Back FX (0=Moving/ 1=Still/ 2=Map)
MAIN_TRAN_TIME = 20 # Transition Time.
MAIN_TRAN_TYPE = "006-Stripe02" # Transition Type (Name)
# Font Used
MAIN_FONT = "Arial" # Font used in Main Menu
# MENU GAUGE GRAPHICS
# Empty Bars
MAIN_BAR_E = "BAR0" # Blank bar
MAIN_BAR_XP_E = "Exp_Back" # Blank bar for EXP
# Fill Bars
MAIN_BAR_HP = "HP_Bar" # Fill bar for HP
MAIN_BAR_SP = "SP_Bar" # Fill bar for SP
MAIN_BAR_XP = "Exp_Meter" # Fill bar for EXP
# Gauge Texts
MAIN_TEXT_HP = "HP_Tx" # Text graphic for HP
MAIN_TEXT_SP = "SP_Tx" # Text graphic for SP
MAIN_TEXT_XP = "Exp_tx" # Text graphic for EXP
MAIN_TEXT_LV = "LV_tx" # Text graphic for Level
end
# Mogscript global
$mogscript = {} if $mogscript == nil
$mogscript["menu_itigo"] = true
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
def now_exp
#--------------------------------------------------------------------------
# * Get EXP
#--------------------------------------------------------------------------
return @exp - @exp_list[@level]
end
#--------------------------------------------------------------------------
# * Get Next Level EXP
#--------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# This class handles the map. It includes scrolling and passable determining
# functions. Refer to "$game_map" for the instance of this class.
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :map_id # map id
#--------------------------------------------------------------------------
# * Map Name
#--------------------------------------------------------------------------
def mpname
$mpname = load_data("Data/MapInfos.rxdata")
$mpname[@map_id].name
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw Empty Face
#--------------------------------------------------------------------------
def nada
face = RPG::Cache.picture("")
end
#--------------------------------------------------------------------------
# * Draw Face
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def drw_face(actor, x, y)
face = RPG::Cache.picture(actor.name + MOG::FACE_SMALL) rescue nada
cw = face.width
ch = face.height
src_rect = Rect.new( 0, 0, cw, ch)
self.contents.blt(x , y - ch, face, src_rect)
end
#--------------------------------------------------------------------------
# * Draw Back Selection
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def drw_bs(actor, x, y)
bs = RPG::Cache.picture(actor.name + MOG::BACK_SELECTION) rescue nada
cw = bs.width
ch = bs.height
src_rect = Rect.new( 0, 0, cw, ch)
self.contents.blt(x, y - ch, bs, src_rect)
self.z = 7
end
#--------------------------------------------------------------------------
# * Draw Character Selection
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def drw_bsc(actor, x, y)
bsc = RPG::Cache.picture(actor.name + MOG::CHARACTER_SELECTION) rescue nada
cw = bsc.width
ch = bsc.height
src_rect = Rect.new( 0, 0, cw, ch)
self.contents.blt(x, y - ch, bsc, src_rect)
self.z = 7
end
#--------------------------------------------------------------------------
# * Draw Back Selection For Party Change
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def drw_bs3(actor, x, y)
bs3 = RPG::Cache.picture(actor.name + MOG::BACK_CHANGE) rescue nada
cw = bs3.width
ch = bs3.height
src_rect = Rect.new( 0, 0, cw, ch)
self.contents.blt(x, y - ch, bs3, src_rect)
self.opacity = 0
end
#--------------------------------------------------------------------------
# * Draw Anime Character
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def drw_anim(actor, x, y)
anim = RPG::Cache.picture(actor.name + MOG::ANIMATED_CHARACTER) rescue nada
largeur = 120
hauteur = 112
pos_x = 120*@timer
pos_y = 0
self.src_rect.set(pos_x, pos_y, largeur, hauteur)
#-------------------------------------------------------------------------
# * Animated Character Update
#-------------------------------------------------------------------------
def update
@wait += 1
if @wait >= 20
@wait = 0
@timer += 1
if @timer > 6
@timer = 0
end
end
largeur = 120
hauteur = 112
pos_x = 120*@timer
pos_y = 0
self.src_rect.set(pos_x, pos_y, largeur, hauteur)
end
end
#--------------------------------------------------------------------------
# * Draw HP from Image
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_maphp3(actor, x, y)
back = RPG::Cache.picture(MOG::MAIN_BAR_E)
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw - 0, ch)
self.contents.blt(x + 65, y - ch + 30, back, src_rect)
meter = RPG::Cache.picture(MOG::MAIN_BAR_HP)
cw = meter.width * actor.hp / actor.maxhp
ch = meter.height
src_rect = Rect.new(0, 0, cw - 0, ch)
self.contents.blt(x + 65, y - ch - 30, meter, src_rect)
text = RPG::Cache.picture(MOG::MAIN_TEXT_HP)
cw = text.width
ch = text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 35, y - ch + 30, text, src_rect)
self.contents.font.color = Color.new(0, 0, 0, 255)
self.contents.draw_text(x + 81, y - 1, 48, 32, actor.hp.to_s, 2)
self.contents.font.color = Color.new(55, 25, 55, 255)
self.contents.draw_text(x + 80, y - 2, 48, 32, actor.hp.to_s, 2)
end
#--------------------------------------------------------------------------
# * Draw SP from Image
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_mapsp3(actor, x, y)
back = RPG::Cache.picture(MOG::MAIN_BAR_E)
cw = back.width
ch = back.height
src_rect = Rect.new(x + 65, y - ch + 30, back, src_rect)
self.contents.blt(x , y - ch, back, src_rect)
meter = RPG::Cache.picture(MOG::MAIN_BAR_SP)
cw = meter.width * actor.sp / actor.maxsp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, meter, src_rect)
sp_tx = RPG::Cache.picture(MOG::MAIN_TEXT_SP)
cw = sp_tx.width
ch = sp_tx.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - 35, y - ch + 40, sp_tx, src_rect)
self.contents.font.color = Color.new(0, 0, 0, 255)
self.contents.draw_text(x + 81, y + 20, 48, 32, actor.sp.to_s, 2)
self.contents.font.color = Color.new(255, 255, 255, 255)
self.contents.draw_text(x + 80, y + 21, 48, 32, actor.sp.to_s, 2)
end
#--------------------------------------------------------------------------
# * Draw EXP from Image
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_mexp2(actor, x, y)
bitmap2 = RPG::Cache.picture(MOG::MAIN_BAR_XP_E)
cw = bitmap2.width
ch = bitmap2.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 125 , y - ch + 10, bitmap2, src_rect)
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
bitmap = RPG::Cache.picture(MOG::MAIN_BAR_XP)
if actor.level < 99
cw = bitmap.width * rate
else
cw = bitmap.width
end
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 125 , y - ch + 10, bitmap, src_rect)
exp_tx = RPG::Cache.picture(MOG::MAIN_TEXT_XP)
cw = exp_tx.width
ch = exp_tx.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 120 , y - ch + 10, exp_tx, src_rect)
lv_tx = RPG::Cache.picture(MOG::MAIN_TEXT_LV)
cw = lv_tx.width
ch = lv_tx.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 200 , y - ch + 10, lv_tx, src_rect)
self.contents.font.color = Color.new(0, 0, 0, 255)
self.contents.draw_text(x + 235, y - 13, 24, 32, actor.level.to_s, 1)
self.contents.font.color = Color.new(255, 255, 255, 255)
self.contents.draw_text(x + 234, y - 13, 24, 32, actor.level.to_s, 1)
end
#--------------------------------------------------------------------------
# * Draw State
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#--------------------------------------------------------------------------
def draw_actor_state(actor, x, y, width = 200)
text = make_battler_state_text(actor, width, true)
self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
self.contents.draw_text(x, y, width, 32, text, 2)
end
end
#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
# This window displays party member status on the menu screen.
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 615, 480)
self.contents = Bitmap.new(width - 20, height - 20)
self.windowskin = RPG::Cache.windowskin("")
self.opacity = 0
self.z = 15
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 121
y = 158
actor = $game_party.actors[0]
self.contents.font.name = MOG::MAIN_FONT
if $mogscript["TP_System"] == true
draw_actor_tp(actor, x + 285, y - 5,4)
else
end
drw_bs(actor, x, y + 80)
drw_bsc(actor, x + 0, y -31)
drw_anim(actor, x + 38, y -100)
draw_maphp3(actor, x - 38, y + 41)
draw_mapsp3(actor, x - 12, y + 58)
draw_mexp2(actor, x - 120, y - 15)
draw_actor_state(actor, x - 10, y - 151)
end
for i in 0...$game_party.actors.size
x = 262
y = 158
actor = $game_party.actors[1]
self.contents.font.name = MOG::MAIN_FONT
if $mogscript["TP_System"] == true
draw_actor_tp(actor, x + 285, y - 5,4)
else
end
drw_bs(actor, x, y + 80)
drw_bsc(actor, x -90, y -31)
drw_anim(actor, x + 38, y -100)
draw_maphp3(actor, x - 38, y + 41)
draw_mapsp3(actor, x - 12, y + 59)
draw_mexp2(actor, x - 120, y - 15)
draw_actor_state(actor, x - 83, y -132)
end
for i in 0...$game_party.actors.size
x = 121
y = 269
actor = $game_party.actors[2]
self.contents.font.name = MOG::MAIN_FONT
if $mogscript["TP_System"] == true
draw_actor_tp(actor, x + 285, y - 5,4)
else
end
drw_bs(actor, x, y + 80)
drw_bsc(actor, x + 115, y -143)
drw_anim(actor, x + 38, y -100)
draw_maphp3(actor, x - 38, y +41)
draw_mapsp3(actor, x - 12, y + 59)
draw_mexp2(actor, x - 120, y - 15)
draw_actor_state(actor, x + 127, y -263 )
end
for i in 0...$game_party.actors.size
x = 262
y = 269
actor = $game_party.actors[3]
self.contents.font.name = MOG::MAIN_FONT
if $mogscript["TP_System"] == true
draw_actor_tp(actor, x + 285, y - 5,4)
else
end
drw_bs(actor, x, y + 80)
drw_bsc(actor, x +45, y -143)
drw_anim(actor, x + 38, y -100)
draw_maphp3(actor, x - 38, y + 41)
draw_mapsp3(actor, x - 12, y + 59)
draw_mexp2(actor, x - 120, y - 15)
draw_actor_state(actor, x + 54, y - 243)
end
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(5, @index * 62, self.width - 32, 50)
end
end
end
#==============================================================================
# ** Window_Gold
#------------------------------------------------------------------------------
# This window displays amount of gold.
#==============================================================================
class Window_Gold < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.color = Color.new(0, 0, 0, 255)
self.windowskin = RPG::Cache.windowskin("")
self.opacity = 0
self.z = 15
refresh
end
end
#==============================================================================
# ** Window_PlayTime
#------------------------------------------------------------------------------
# This window displays play time on the menu screen.
#==============================================================================
class Window_PlayTime < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.windowskin = RPG::Cache.windowskin("")
self.opacity = 0
self.z = 15
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = Color.new(0, 0, 0, 255)
self.contents.draw_text(4, 32, 120, 32, text, 2)
end
end
#==============================================================================
# ** Window_Steps
#------------------------------------------------------------------------------
# This window displays step count on the menu screen.
#==============================================================================
class Window_Steps < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.windowskin = RPG::Cache.windowskin("")
self.opacity = 0
self.z = 15
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = Color.new(0, 0, 0, 255)
self.contents.draw_text(4, 32, 120, 32, $game_party.steps.to_s, 2)
end
end
#==============================================================================
# ** Window_Map_Name
#------------------------------------------------------------------------------
# This window displays the map name on the menu screen.
#==============================================================================
class Window_Map_Name < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = MOG::MAIN_FONT
self.windowskin = RPG::Cache.windowskin("")
self.opacity = 0
self.z = 15
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.name = MOG::MAIN_FONT
self.contents.font.color = Color.new(0, 0, 0, 255)
self.contents.draw_text(4, 32, 120, 32, $game_map.mpname.to_s, 1)
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs menu screen processing.
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
s1 = ""
s2 = ""
s3 = ""
s4 = ""
s5 = ""
s6 = ""
s7 = ""
s8 = ""
s9 = ""
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8,s9])
@command_window.index = @menu_index
if $game_party.actors.size == 0
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
@backup = Sprite.new
@backup = RPG::Cache.picture("Layout-Menu")
@command_window.visible = false
@command_window.x = -640
@mnlay = Sprite.new
@mnlay.bitmap = RPG::Cache.picture(MOG::MAIN_LAYOUT)
@mnlay.z = 10
@mnlay.opacity = 0
@mnlay.x = -100
if MOG::MAIN_FX == 0
@mnback = Plane.new
@mnback.bitmap = RPG::Cache.picture(MOG::MAIN_BACKGROUND)
@mnback.blend_type = 0
@mnback.z = 5
@mnback2 = Plane.new
@mnback2.bitmap = RPG::Cache.picture(MOG::MAIN_BACKGROUND)
@mnback2.blend_type = 0
@mnback2.z = 5
@mnback2.opacity = 60
elsif MOG::MAIN_FX == 1
@mnback = Plane.new
@mnback.bitmap = RPG::Cache.picture(MOG::MAIN_BACKGROUND)
@mnback.blend_type = 0
@mnback.z = 5
else
@spriteset = Spriteset_Map.new
end
@actsel = Sprite.new
@actsel.bitmap = RPG::Cache.picture($game_party.actors[2].name + MOG::CHARACTER_SELECTION)
@actsel.z = 25
@actsel.x = 10
@actsel.y = 110
@actsel.opacity = 0
@mnsel = Sprite.new
@mnsel.bitmap = RPG::Cache.picture(MOG::MAIN_CURSOR)
@mnsel.z = 20
@mnsel.x = 0
@mnsel.y = 110
@mnop = 150
if $game_system.save_disabled
@command_window.disable_item(4)
end
@playtime_window = Window_PlayTime.new
@playtime_window.x = 373
@playtime_window.y = 32
@playtime_window.contents_opacity = 0
if MOG::MAIN_MAPNAME == true
@mapname_window = Window_Map_Name.new
@mapname_window.x = 383
@mapname_window.y = -18
@mapname_window.contents_opacity = 0
end
@steps_window = Window_Steps.new
@steps_window.x = 460
@steps_window.y = 60
@steps_window.contents_opacity = 0
@gold_window = Window_Gold.new
@gold_window.x = 320
@gold_window.y = 90
@gold_window.contents_opacity = 0
@status_window = Window_MenuStatus.new
@status_window.x = 295
@status_window.y = 110
@status_window.contents_opacity = 0
@status_window.z = 20
if MOG::MAIN_FX == 0
Graphics.transition(MOG::MAIN_TRAN_TIME, "Graphics/Transitions/" +
MOG::MAIN_TRAN_TYPE)
elsif MOG::MAIN_FX == 1
Graphics.transition(MOG::MAIN_TRAN_TIME, "Graphics/Transitions/" +
MOG::MAIN_TRAN_TYPE)
else
Graphics.transition
end
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
for i in 0..10
if MOG::MAIN_FX == 0
@mnback.oy += 0
@mnback.ox += 0
@mnback2.oy += 1
@mnback2.ox -= 1
end
@status_window.x += 20
@status_window.contents_opacity -= 25
@mnsel.opacity -= 25
@mnsel.zoom_x += 0.03
@mnlay.x -= 10
@mnlay.opacity -= 25
if MOG::MAIN_MAPNAME == true
@mapname_window.x += 5
@mapname_window.contents_opacity -= 20
end
@steps_window.contents_opacity -= 25
@gold_window.contents_opacity -= 25
@playtime_window.contents_opacity -= 25
Graphics.update
end
Graphics.freeze
@command_window.dispose
@playtime_window.dispose
@steps_window.dispose
@gold_window.dispose
@status_window.dispose
@mnlay.dispose
if MOG::MAIN_FX == 0
@mnback.dispose
@mnback2.dispose
elsif MOG::MAIN_FX == 1
@mnback.dispose
else
@spriteset.dispose
end
@mnsel.dispose
@actsel.dispose
@mapname_window.dispose if MOG::MAIN_MAPNAME == true
Graphics.update
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
if MOG::MAIN_CURSOR_FX
if @mnsel.zoom_x <= 1.6
@mnsel.zoom_x += 0.03
@mnsel.opacity -= 10
@char_sel.opacity += 10
elsif @mnsel.zoom_x > 1.6
@mnsel.zoom_x = 1.0
@mnsel.opacity = 255
end
end
if @mnlay.x < 0
@mnlay.opacity += 25
@mnlay.x += 10
elsif @mnlay.x >= 0
@mnlay.opacity = 255
@mnlay.x = 0
end
@command_window.update if @command_window.active
@playtime_window.update
@status_window.update if @status_window.active
if MOG::MAIN_FX == 0
@mnback.oy += 0
@mnback.ox += 0
@mnback2.oy += 1
@mnback2.ox -= 1
end
@mnop += 5
# Secondary Cursor
if @command_window.active == true
@mnsel.bitmap = RPG::Cache.picture(MOG::MAIN_CURSOR)
else
@mnsel.bitmap = RPG::Cache.picture(MOG::SECOND_CURSOR)
unless MOG::SECOND_CURSOR_FX
@mnsel.zoom_x = 1
@mnsel.opacity = 255
end
end
@mapname_window.contents_opacity += 15 if MOG::MAIN_MAPNAME == true
@playtime_window.contents_opacity += 15
@gold_window.contents_opacity += 15
@playtime_window.contents_opacity += 15
@steps_window.contents_opacity += 15
if @status_window.x > 195
@status_window.x -= 10
@status_window.contents_opacity += 10
elsif @status_window.x <= 195
@status_window.x = 195
@status_window.contents_opacity = 255
end
if @mnop >= 255
@mnop = 120
end
if @command_window.active
update_command
return
end
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
case @command_window.index
when 0
@mnsel.bitmap = RPG::Cache.picture("CH_ID1")
@mnsel.x = 0
@mnsel.y = 0
when 1
@mnsel.bitmap = RPG::Cache.picture("CH_ID2")
@mnsel.x = 0
@mnsel.y = 0
when 2
@mnsel.bitmap = RPG::Cache.picture("CH_ID3")
@mnsel.x = 0
@mnsel.y = 0
when 3
@mnsel.bitmap = RPG::Cache.picture("CH_ID4")
@mnsel.x = 0
@mnsel.y = 0
when 4
@mnsel.bitmap = RPG::Cache.picture("CH_ID5")
@mnsel.x = 0
@mnsel.y = 0
when 5
@mnsel.bitmap = RPG::Cache.picture("CH_ID6")
@mnsel.x = 0
@mnsel.y = 0
when 6
@mnsel.bitmap = RPG::Cache.picture("CH_ID7")
@mnsel.x = 0
@mnsel.y = 0
when 7
@mnsel.bitmap = RPG::Cache.picture("CH_ID8")
@mnsel.x = 0
@mnsel.y = 0
when 8
@mnsel.bitmap = RPG::Cache.picture("CH_ID9")
@mnsel.x = 0
@mnsel.y = 0
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
if $game_party.actors.size == 0 and @command_window.index < 4
$game_system.se_play($data_system.buzzer_se)
return
end
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item.new
when 1
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4
$game_system.se_play($data_system.decision_se)
$scene = Scene_Transformations.new
when 5
$game_system.se_play($data_system.decision_se)
$scene = Scene_Summons.new
when 6
$game_system.se_play($data_system.decision_se)
$scene = Scene_PartySwitch.new
when 7
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Save.new
when 8
$game_system.se_play($data_system.decision_se)
$scene = Scene_End.new
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when status window is active)
#--------------------------------------------------------------------------
def update_status
case @status_window.index
when 0
@actsel.bitmap = RPG::Cache.picture($game_party.actors[0].name + MOG::BACK_CHANGE)
@actsel.opacity = 255
@actsel.x = 0
@actsel.y = 0
@mnsel.bitmap = RPG::Cache.picture("S1")
@mnsel.x = 0
@mnsel.y = 0
@mnsel.z = 30
when 1
@actsel.bitmap = RPG::Cache.picture($game_party.actors[1].name + MOG::BACK_CHANGE)
@actsel.opacity = 255
@actsel.x = 0
@actsel.y = 0
@mnsel.bitmap = RPG::Cache.picture("S2")
@mnsel.x = 0
@mnsel.y = 0
@mnsel.z = 30
when 2
@actsel.bitmap = RPG::Cache.picture($game_party.actors[2].name + MOG::BACK_CHANGE)
@actsel.opacity = 255
@mnsel.bitmap = RPG::Cache.picture("S3")
@mnsel.x = 0
@mnsel.y = 0
@mnsel.z = 30
when 3
@actsel.bitmap = RPG::Cache.picture($game_party.actors[3].name + MOG::BACK_CHANGE)
@actsel.opacity = 255
@mnsel.bitmap = RPG::Cache.picture("S4")
@mnsel.x = 0
@mnsel.y = 0
@mnsel.z = 30
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@status_window.active = false
@status_window.index = -1
@actsel.dispose
return
end
if Input.trigger?(Input::C)
case @command_window.index
when 1
if $game_party.actors[@status_window.index].restriction >= 2
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Skill.new(@status_window.index)
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(@status_window.index)
when 3
$game_system.se_play($data_system.decision_se)
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end |
Donc je l'ai créé a la ligne 161 et a la ligne 345 je l'affiche (puisque chaque héro a son personnage animé)
Désolé si ma méthode n'est pas super, je suis pas tres bon en script j'apprend de ce que je vois sur les autre scripts !
|
Mack -
posté le 06/07/2012 à 20:06:38 (2310 messages postés)
- - | | Un peu la flemme de tout te faire, mais en gros le principe est le même qu'avant.
Y a juste la méthode qu'est un peu différente :
1
2
3
|
rect = Rect.new(pos_x,pos_y,largeur,hauteur)
self.contents.blt(pos_x2, pos_y2, bmp, rect, 255) |
pos_x2 et pos_y2 c'est là où ton sprite va être afficher.
Après, dans les lignes 360 c'pareil, tu prends le code du dessus.
Si je dis pas de connerie, en mettant :
@timer = @wait = 0
à la ligne 319, ça devrait être bon ^^.
|
( Je prend note de tout les commentaires, même si je n'y répond pas ) |
daylights -
posté le 07/07/2012 à 05:53:55 (54 messages postés)
| | J'ai beau essayer ce que tu m'as dit mais cela ne fonctionne pas. J'ai sois un erreur avec le timer et le wait sinon c'est le sprite qui ne s'affiche simplement pas ... Es-ce que tu croix qu'il serai plus facile de modifier le script pour qu'il affiche l'animation photo après photo et que je sépare le template pour afficher !
(J'avais déjà essayé au début mais je n'es pas réussi)
J'avais fait un truc du genre
1
2
3
4
5
6
7
8
9
| def drw_anim(actor, x, y)
anim = RPG::Cache.picture(actor.name + MOG::ANIMATED_CHARACTER + $game_variable[40]) rescue nada
cw = anim.width
ch = anim.height
src_rect = Rect.new( 0, 0, cw, ch)
self.contents.blt(x, y - ch, anim, src_rect)
self.z = 7
end
|
Mais même avec cette essai je n'ai pas réussi a faire augmenter la variable -_- !
|
Mack -
posté le 08/07/2012 à 19:08:27 (2310 messages postés)
- - | | J'ai du te refaire une partie, parce que c'était vraiment coder à l'arrache ...
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
| #==============================================================================
# ** MOG Scene Menu Itigo V1.5
# By Moghunter
# http://www.atelier-rgss.com
#------------------------------------------------------------------------------
# ** Reinvisioned version
#
# This variant has retooled the MOG module by adding more configurables for
# the user. No longer are the graphics hardwired into the code but are now
# able to be altered in the revised configuration serction.
#
# Also, certain classes have been renamed back to their original versions.
# As such... classes such as Window_Gold2 and Window_MenuStatus2 have been
# renamed back to Window_Gold and Window_MenuStatus. This change within the
# script also allowed for the deletion of unnecessary and redundant methods
# within the script:
#
# Classes and methods renamed:
# * Window_MenuStatus2
# * Window_Gold2
# * Window_PlayTime2
# * Window_Steps2
# * draw_actor_state2 (in the Window_Base class)
#
# Methods deleted from the original system:
# * refresh (Window_Gold)
# * update (Window_Playtime)
# * initialize (Scene_Menu)
#==============================================================================
module MOG
# BASIC MENU CONFIGURATION
# Main Menu Graphics Used
MAIN_LAYOUT = "Layout-Menu" # Main Menu Graphics
MAIN_BACKGROUND = "Back-Menu" # Animated background graphic
MAIN_CURSOR = "MogCursor" # Animated cursor graphic
MAIN_CURSOR_FX = false # Animated cursor fx on/off switch
SECOND_CURSOR = "MogCursor_2" # Animated secondary cursor graphic
SECOND_CURSOR_FX = false # Animated second cursor fx
FACE_SMALL = "_Fl" # Suffix for face graphics (small)
BACK_SELECTION = "_Bs" # Suffix for background selection
CHARACTER_SELECTION = "_Bsc" # Suffix for character selection
ANIMATED_CHARACTER = "_Anim" # Suffix for character animation
BACK_CHANGE = "_Bs3" # Suffix for background Party change
MAIN_MAPNAME = true # If true, shows the map name
# Menu
MAIN_FX = 0 # Back FX (0=Moving/ 1=Still/ 2=Map)
MAIN_TRAN_TIME = 20 # Transition Time.
MAIN_TRAN_TYPE = "006-Stripe02" # Transition Type (Name)
# Font Used
MAIN_FONT = "Arial" # Font used in Main Menu
# MENU GAUGE GRAPHICS
# Empty Bars
MAIN_BAR_E = "BAR0" # Blank bar
MAIN_BAR_XP_E = "Exp_Back" # Blank bar for EXP
# Fill Bars
MAIN_BAR_HP = "HP_Bar" # Fill bar for HP
MAIN_BAR_SP = "SP_Bar" # Fill bar for SP
MAIN_BAR_XP = "Exp_Meter" # Fill bar for EXP
# Gauge Texts
MAIN_TEXT_HP = "HP_Tx" # Text graphic for HP
MAIN_TEXT_SP = "SP_Tx" # Text graphic for SP
MAIN_TEXT_XP = "Exp_tx" # Text graphic for EXP
MAIN_TEXT_LV = "LV_tx" # Text graphic for Level
end
# Mogscript global
$mogscript = {} if $mogscript == nil
$mogscript["menu_itigo"] = true
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
def now_exp
#--------------------------------------------------------------------------
# * Get EXP
#--------------------------------------------------------------------------
return @exp - @exp_list[@level]
end
#--------------------------------------------------------------------------
# * Get Next Level EXP
#--------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# This class handles the map. It includes scrolling and passable determining
# functions. Refer to "$game_map" for the instance of this class.
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :map_id # map id
#--------------------------------------------------------------------------
# * Map Name
#--------------------------------------------------------------------------
def mpname
$mpname = load_data("Data/MapInfos.rxdata")
$mpname[@map_id].name
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw Empty Face
#--------------------------------------------------------------------------
def nada
face = RPG::Cache.picture("")
end
#--------------------------------------------------------------------------
# * Draw Face
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def drw_face(actor, x, y)
face = RPG::Cache.picture(actor.name + MOG::FACE_SMALL) rescue nada
cw = face.width
ch = face.height
src_rect = Rect.new( 0, 0, cw, ch)
self.contents.blt(x , y - ch, face, src_rect)
end
#--------------------------------------------------------------------------
# * Draw Back Selection
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def drw_bs(actor, x, y)
bs = RPG::Cache.picture(actor.name + MOG::BACK_SELECTION) rescue nada
cw = bs.width
ch = bs.height
src_rect = Rect.new( 0, 0, cw, ch)
self.contents.blt(x, y - ch, bs, src_rect)
self.z = 7
end
#--------------------------------------------------------------------------
# * Draw Character Selection
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def drw_bsc(actor, x, y)
bsc = RPG::Cache.picture(actor.name + MOG::CHARACTER_SELECTION) rescue nada
cw = bsc.width
ch = bsc.height
src_rect = Rect.new( 0, 0, cw, ch)
self.contents.blt(x, y - ch, bsc, src_rect)
self.z = 7
end
#--------------------------------------------------------------------------
# * Draw Back Selection For Party Change
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def drw_bs3(actor, x, y)
bs3 = RPG::Cache.picture(actor.name + MOG::BACK_CHANGE) rescue nada
cw = bs3.width
ch = bs3.height
src_rect = Rect.new( 0, 0, cw, ch)
self.contents.blt(x, y - ch, bs3, src_rect)
self.opacity = 0
end
#--------------------------------------------------------------------------
# * Draw HP from Image
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_maphp3(actor, x, y)
back = RPG::Cache.picture(MOG::MAIN_BAR_E)
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw - 0, ch)
self.contents.blt(x + 65, y - ch + 30, back, src_rect)
meter = RPG::Cache.picture(MOG::MAIN_BAR_HP)
cw = meter.width * actor.hp / actor.maxhp
ch = meter.height
src_rect = Rect.new(0, 0, cw - 0, ch)
self.contents.blt(x + 65, y - ch - 30, meter, src_rect)
text = RPG::Cache.picture(MOG::MAIN_TEXT_HP)
cw = text.width
ch = text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 35, y - ch + 30, text, src_rect)
self.contents.font.color = Color.new(0, 0, 0, 255)
self.contents.draw_text(x + 81, y - 1, 48, 32, actor.hp.to_s, 2)
self.contents.font.color = Color.new(55, 25, 55, 255)
self.contents.draw_text(x + 80, y - 2, 48, 32, actor.hp.to_s, 2)
end
#--------------------------------------------------------------------------
# * Draw SP from Image
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_mapsp3(actor, x, y)
back = RPG::Cache.picture(MOG::MAIN_BAR_E)
cw = back.width
ch = back.height
src_rect = Rect.new(x + 65, y - ch + 30, back, src_rect)
self.contents.blt(x , y - ch, back, src_rect)
meter = RPG::Cache.picture(MOG::MAIN_BAR_SP)
cw = meter.width * actor.sp / actor.maxsp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, meter, src_rect)
sp_tx = RPG::Cache.picture(MOG::MAIN_TEXT_SP)
cw = sp_tx.width
ch = sp_tx.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - 35, y - ch + 40, sp_tx, src_rect)
self.contents.font.color = Color.new(0, 0, 0, 255)
self.contents.draw_text(x + 81, y + 20, 48, 32, actor.sp.to_s, 2)
self.contents.font.color = Color.new(255, 255, 255, 255)
self.contents.draw_text(x + 80, y + 21, 48, 32, actor.sp.to_s, 2)
end
#--------------------------------------------------------------------------
# * Draw EXP from Image
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_mexp2(actor, x, y)
bitmap2 = RPG::Cache.picture(MOG::MAIN_BAR_XP_E)
cw = bitmap2.width
ch = bitmap2.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 125 , y - ch + 10, bitmap2, src_rect)
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
bitmap = RPG::Cache.picture(MOG::MAIN_BAR_XP)
if actor.level < 99
cw = bitmap.width * rate
else
cw = bitmap.width
end
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 125 , y - ch + 10, bitmap, src_rect)
exp_tx = RPG::Cache.picture(MOG::MAIN_TEXT_XP)
cw = exp_tx.width
ch = exp_tx.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 120 , y - ch + 10, exp_tx, src_rect)
lv_tx = RPG::Cache.picture(MOG::MAIN_TEXT_LV)
cw = lv_tx.width
ch = lv_tx.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 200 , y - ch + 10, lv_tx, src_rect)
self.contents.font.color = Color.new(0, 0, 0, 255)
self.contents.draw_text(x + 235, y - 13, 24, 32, actor.level.to_s, 1)
self.contents.font.color = Color.new(255, 255, 255, 255)
self.contents.draw_text(x + 234, y - 13, 24, 32, actor.level.to_s, 1)
end
#--------------------------------------------------------------------------
# * Draw State
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#--------------------------------------------------------------------------
def draw_actor_state(actor, x, y, width = 200)
text = make_battler_state_text(actor, width, true)
self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
self.contents.draw_text(x, y, width, 32, text, 2)
end
end
#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
# This window displays party member status on the menu screen.
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 615, 480)
self.contents = Bitmap.new(width - 20, height - 20)
self.windowskin = RPG::Cache.windowskin("")
self.opacity = 0
self.z = 5000
@wait = 0
@frame = 0
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 121 + (141*(i%2))
y = 158 + (111*(i/2))
actor = $game_party.actors[i]
self.contents.font.name = MOG::MAIN_FONT
if $mogscript["TP_System"] == true
draw_actor_tp(actor, x + 285, y - 5,4)
end
drw_bs(actor, x, y + 80)
#drw_bsc(actor, 121 + (i%4)*60 , 158 -31)
drw_anim(actor, 121 + (i%4)*60 , 158 -31)
draw_maphp3(actor, x - 38, y + 41)
draw_mapsp3(actor, x - 12, y + 58)
draw_mexp2(actor, x - 120, y - 15)
draw_actor_state(actor, x - 10, y)
end
self.z = 9999
end
def drw_anim(actor,x,y)
bmp = RPG::Cache.picture(actor.name + MOG::ANIMATED_CHARACTER)
cw = bmp.width
ch = bmp.height
src_rect = Rect.new( 120*@frame, 0, 120, 112)
self.contents.blt(x, y - ch, bmp, src_rect)
end
def update_anim
@wait += 1
if @wait > 4
@wait = 0
refresh
@frame += 1
if @frame > 5
@frame = 0
end
end
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(5, @index * 62, self.width - 32, 50)
end
end
end
#==============================================================================
# ** Window_Gold
#------------------------------------------------------------------------------
# This window displays amount of gold.
#==============================================================================
class Window_Gold < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.color = Color.new(0, 0, 0, 255)
self.windowskin = RPG::Cache.windowskin("")
self.opacity = 0
self.z = 15
refresh
end
end
#==============================================================================
# ** Window_PlayTime
#------------------------------------------------------------------------------
# This window displays play time on the menu screen.
#==============================================================================
class Window_PlayTime < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.windowskin = RPG::Cache.windowskin("")
self.opacity = 0
self.z = 15
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = Color.new(0, 0, 0, 255)
self.contents.draw_text(4, 32, 120, 32, text, 2)
end
end
#==============================================================================
# ** Window_Steps
#------------------------------------------------------------------------------
# This window displays step count on the menu screen.
#==============================================================================
class Window_Steps < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.windowskin = RPG::Cache.windowskin("")
self.opacity = 0
self.z = 15
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = Color.new(0, 0, 0, 255)
self.contents.draw_text(4, 32, 120, 32, $game_party.steps.to_s, 2)
end
end
#==============================================================================
# ** Window_Map_Name
#------------------------------------------------------------------------------
# This window displays the map name on the menu screen.
#==============================================================================
class Window_Map_Name < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = MOG::MAIN_FONT
self.windowskin = RPG::Cache.windowskin("")
self.opacity = 0
self.z = 15
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.name = MOG::MAIN_FONT
self.contents.font.color = Color.new(0, 0, 0, 255)
self.contents.draw_text(4, 32, 120, 32, $game_map.mpname.to_s, 1)
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs menu screen processing.
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
s1 = ""
s2 = ""
s3 = ""
s4 = ""
s5 = ""
s6 = ""
s7 = ""
s8 = ""
s9 = ""
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8,s9])
@command_window.index = @menu_index
if $game_party.actors.size == 0
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
if $game_variables[1] <= 5
$game_variables[1] += 1
elsif $game_variables[1] == 5
$game_variables[1] = 0
end
@backup = Sprite.new
@backup = RPG::Cache.picture("Layout-Menu")
@command_window.visible = false
@command_window.x = -640
@mnlay = Sprite.new
@mnlay.bitmap = RPG::Cache.picture(MOG::MAIN_LAYOUT)
@mnlay.z = 10
@mnlay.opacity = 0
@mnlay.x = -100
if MOG::MAIN_FX == 0
@mnback = Plane.new
@mnback.bitmap = RPG::Cache.picture(MOG::MAIN_BACKGROUND)
@mnback.blend_type = 0
@mnback.z = 5
@mnback2 = Plane.new
@mnback2.bitmap = RPG::Cache.picture(MOG::MAIN_BACKGROUND)
@mnback2.blend_type = 0
@mnback2.z = 5
@mnback2.opacity = 60
elsif MOG::MAIN_FX == 1
@mnback = Plane.new
@mnback.bitmap = RPG::Cache.picture(MOG::MAIN_BACKGROUND)
@mnback.blend_type = 0
@mnback.z = 5
else
@spriteset = Spriteset_Map.new
end
@actsel = Sprite.new
@actsel.bitmap = RPG::Cache.picture($game_party.actors[2].name + MOG::CHARACTER_SELECTION)
@actsel.z = 25
@actsel.x = 10
@actsel.y = 110
@actsel.opacity = 0
@mnsel = Sprite.new
@mnsel.bitmap = RPG::Cache.picture(MOG::MAIN_CURSOR)
@mnsel.z = 20
@mnsel.x = 0
@mnsel.y = 110
@mnop = 150
if $game_system.save_disabled
@command_window.disable_item(4)
end
@playtime_window = Window_PlayTime.new
@playtime_window.x = 373
@playtime_window.y = 32
@playtime_window.contents_opacity = 0
if MOG::MAIN_MAPNAME == true
@mapname_window = Window_Map_Name.new
@mapname_window.x = 383
@mapname_window.y = -18
@mapname_window.contents_opacity = 0
end
@steps_window = Window_Steps.new
@steps_window.x = 460
@steps_window.y = 60
@steps_window.contents_opacity = 0
@gold_window = Window_Gold.new
@gold_window.x = 320
@gold_window.y = 90
@gold_window.contents_opacity = 0
@status_window = Window_MenuStatus.new
@status_window.x = 295
@status_window.y = 110
@status_window.contents_opacity = 0
@status_window.z = 5000
if MOG::MAIN_FX == 0
Graphics.transition(MOG::MAIN_TRAN_TIME, "Graphics/Transitions/" +
MOG::MAIN_TRAN_TYPE)
elsif MOG::MAIN_FX == 1
Graphics.transition(MOG::MAIN_TRAN_TIME, "Graphics/Transitions/" +
MOG::MAIN_TRAN_TYPE)
else
Graphics.transition
end
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
for i in 0..10
if MOG::MAIN_FX == 0
@mnback.oy += 0
@mnback.ox += 0
@mnback2.oy += 1
@mnback2.ox -= 1
end
@status_window.x += 20
@status_window.contents_opacity -= 25
@mnsel.opacity -= 25
@mnsel.zoom_x += 0.03
@mnlay.x -= 10
@mnlay.opacity -= 25
if MOG::MAIN_MAPNAME == true
@mapname_window.x += 5
@mapname_window.contents_opacity -= 20
end
@steps_window.contents_opacity -= 25
@gold_window.contents_opacity -= 25
@playtime_window.contents_opacity -= 25
Graphics.update
end
Graphics.freeze
@command_window.dispose
@playtime_window.dispose
@steps_window.dispose
@gold_window.dispose
@status_window.dispose
@mnlay.dispose
if MOG::MAIN_FX == 0
@mnback.dispose
@mnback2.dispose
elsif MOG::MAIN_FX == 1
@mnback.dispose
else
@spriteset.dispose
end
@mnsel.dispose
@actsel.dispose
@mapname_window.dispose if MOG::MAIN_MAPNAME == true
Graphics.update
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@status_window.update_anim
if MOG::MAIN_CURSOR_FX
if @mnsel.zoom_x <= 1.6
@mnsel.zoom_x += 0.03
@mnsel.opacity -= 10
@char_sel.opacity += 10
elsif @mnsel.zoom_x > 1.6
@mnsel.zoom_x = 1.0
@mnsel.opacity = 255
end
end
if @mnlay.x < 0
@mnlay.opacity += 25
@mnlay.x += 10
elsif @mnlay.x >= 0
@mnlay.opacity = 255
@mnlay.x = 0
end
@command_window.update if @command_window.active
@playtime_window.update
@status_window.update if @status_window.active
if MOG::MAIN_FX == 0
@mnback.oy += 0
@mnback.ox += 0
@mnback2.oy += 1
@mnback2.ox -= 1
end
@mnop += 5
# Secondary Cursor
if @command_window.active == true
@mnsel.bitmap = RPG::Cache.picture(MOG::MAIN_CURSOR)
else
@mnsel.bitmap = RPG::Cache.picture(MOG::SECOND_CURSOR)
unless MOG::SECOND_CURSOR_FX
@mnsel.zoom_x = 1
@mnsel.opacity = 255
end
end
@mapname_window.contents_opacity += 15 if MOG::MAIN_MAPNAME == true
@playtime_window.contents_opacity += 15
@gold_window.contents_opacity += 15
@playtime_window.contents_opacity += 15
@steps_window.contents_opacity += 15
if @status_window.x > 195
@status_window.x -= 10
@status_window.contents_opacity += 10
elsif @status_window.x <= 195
@status_window.x = 195
@status_window.contents_opacity = 255
end
if @mnop >= 255
@mnop = 120
end
if @command_window.active
update_command
return
end
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
case @command_window.index
when 0
@mnsel.bitmap = RPG::Cache.picture("CH_ID1")
@mnsel.x = 0
@mnsel.y = 0
when 1
@mnsel.bitmap = RPG::Cache.picture("CH_ID2")
@mnsel.x = 0
@mnsel.y = 0
when 2
@mnsel.bitmap = RPG::Cache.picture("CH_ID3")
@mnsel.x = 0
@mnsel.y = 0
when 3
@mnsel.bitmap = RPG::Cache.picture("CH_ID4")
@mnsel.x = 0
@mnsel.y = 0
when 4
@mnsel.bitmap = RPG::Cache.picture("CH_ID5")
@mnsel.x = 0
@mnsel.y = 0
when 5
@mnsel.bitmap = RPG::Cache.picture("CH_ID6")
@mnsel.x = 0
@mnsel.y = 0
when 6
@mnsel.bitmap = RPG::Cache.picture("CH_ID7")
@mnsel.x = 0
@mnsel.y = 0
when 7
@mnsel.bitmap = RPG::Cache.picture("CH_ID8")
@mnsel.x = 0
@mnsel.y = 0
when 8
@mnsel.bitmap = RPG::Cache.picture("CH_ID9")
@mnsel.x = 0
@mnsel.y = 0
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
if $game_party.actors.size == 0 and @command_window.index < 4
$game_system.se_play($data_system.buzzer_se)
return
end
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item.new
when 1
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4
$game_system.se_play($data_system.decision_se)
$scene = Scene_Transformations.new
when 5
$game_system.se_play($data_system.decision_se)
$scene = Scene_Summons.new
when 6
$game_system.se_play($data_system.decision_se)
$scene = Scene_PartySwitch.new
when 7
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Save.new
when 8
$game_system.se_play($data_system.decision_se)
$scene = Scene_End.new
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when status window is active)
#--------------------------------------------------------------------------
def update_status
case @status_window.index
when 0
@actsel.bitmap = RPG::Cache.picture($game_party.actors[0].name + MOG::BACK_CHANGE)
@actsel.opacity = 255
@actsel.x = 0
@actsel.y = 0
@mnsel.bitmap = RPG::Cache.picture("S1")
@mnsel.x = 0
@mnsel.y = 0
@mnsel.z = 30
when 1
@actsel.bitmap = RPG::Cache.picture($game_party.actors[1].name + MOG::BACK_CHANGE)
@actsel.opacity = 255
@actsel.x = 0
@actsel.y = 0
@mnsel.bitmap = RPG::Cache.picture("S2")
@mnsel.x = 0
@mnsel.y = 0
@mnsel.z = 30
when 2
@actsel.bitmap = RPG::Cache.picture($game_party.actors[2].name + MOG::BACK_CHANGE)
@actsel.opacity = 255
@mnsel.bitmap = RPG::Cache.picture("S3")
@mnsel.x = 0
@mnsel.y = 0
@mnsel.z = 30
when 3
@actsel.bitmap = RPG::Cache.picture($game_party.actors[3].name + MOG::BACK_CHANGE)
@actsel.opacity = 255
@mnsel.bitmap = RPG::Cache.picture("S4")
@mnsel.x = 0
@mnsel.y = 0
@mnsel.z = 30
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@status_window.active = false
@status_window.index = -1
@actsel.opacity = 0
return
end
if Input.trigger?(Input::C)
case @command_window.index
when 1
if $game_party.actors[@status_window.index].restriction >= 2
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Skill.new(@status_window.index)
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(@status_window.index)
when 3
$game_system.se_play($data_system.decision_se)
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end
|
|
( Je prend note de tout les commentaires, même si je n'y répond pas ) |
daylights -
posté le 08/07/2012 à 20:02:38 (54 messages postés)
| | Wow c'est parfait ! Merci Mack de ton aide ^^
Et pour ce qui es des affichages des personnages désolé si c'était mal organisé, pour le nouveau desing du menu je voulais faire un carré d'une forme différante pour chaque personnage (donc chaque affichage sera différant ) pour mieu respecter le thème manga, et c'était la seul alternative que j'avais trouvé !
Merci encore de ton aide !
| Index du forum > Entraide > [RESOLU] [RMXP] Animer un personnage dans le menu
|
|
|