Day.png);">
Apprendre


Vous êtes
nouveau sur
Oniromancie?

Visite guidée
du site


Découvrir
RPG Maker

RM 95
RM 2000/2003
RM XP
RM VX/VX Ace
RM MV/MZ

Apprendre
RPG Maker

Tutoriels
Guides
Making-of

Dans le
Forum

Section Entraide

Tutos: Checklist de la composition (...) / Sorties: Dread Mac Farlane - episode 8 / Sorties: Dread Mac Farlane - episode 7 / Jeux: Ce qui vit Dessous / News: Quoi de neuf sur Oniromancie (...) / Chat

Bienvenue
visiteur !




publicité RPG Maker!

Statistiques

Liste des
membres


Contact

Mentions légales

464 connectés actuellement

29385161 visiteurs
depuis l'ouverture

5 visiteurs
aujourd'hui



Barre de séparation

Partenaires

Indiexpo

Akademiya RPG Maker

Blog Alioune Fall

Fairy Tail Constellations

Leo-Games

Tashiroworld

Le Temple de Valor

Planète Glutko

Tous nos partenaires

Devenir
partenaire



forums

Index du forum > Entraide > [RESOLU] [Vx ace] Deplacement pixel par pixel & evenement


yruama69 - posté le 14/04/2013 à 12:13:20 (7 messages postés)

❤ 0

Domaine concerné: script / événement
Logiciel utilisé: Vx ace
Bonjour.


Dans mon projet, j'ai voulu mettre en place un déplacement pixel par pixel. J'ai donc choisi celui de Victor. Il fonction parfaitement, le seul problème que j'ai ... c'est que depuis qu'il est mit en place, mes événements ne fonctionnes presque plus comem si je n'etais pas sur la case. Ce qui est assez chiant ...


merci.


Geeks - posté le 14/04/2013 à 12:43:18 (56 messages postés)

❤ 0

Plop,

J'avoue avoir du mal à te relire ! Commence par faire un petit effort de ponctuation, d'espacement et de frappe de texte.

Au pire, tu peux essayer de te corriger avec le site suivant : http://bonpatron.com/fr/

Voila, quand ça sera plus lisible, je ne pense pas que tu n'ai pas de réponse à ta question.

Good luck.

Projet en cours Luximel / Mon site.


Mack - posté le 14/04/2013 à 12:49:53 (2288 messages postés) - staff

❤ 0

Normalement, le script est fournit avec une démo non ?
( Ou alors je me plante de script. )

Si oui vérifie que sur la démo ça marche.

( Je prend note de tout les commentaires, même si je n'y répond pas )


yruama69 - posté le 14/04/2013 à 13:04:32 (7 messages postés)

❤ 0

yruama69 a dit:



Bonjour.


Dans mon projet, j'ai voulu mettre en place un déplacement pixel par pixel.
J'ai donc choisis celui de Victor. Il fonction parfaitement j'ai juste un problème avec les événements. Lorsque je suis sur la case (ou a coté de cette case) l'evenement n'a pas lui comme si j'etais pas sur la case pour activer l'evenement.

merci.



@Mack -> Non il n'y a aps démo (enfin pas là ou je l'ai téléchargé)


arttroy - posté le 14/04/2013 à 13:10:07 (2394 messages postés)

❤ 0

Just working

Place tes scripts dans un message avec la balise code, ce sera plus simple pour tout le monde de t'aider :clindoeil3.

Anti-inconstructivité / Pétition pour que le mot making soit inscrit dans le dictionnaire ?


yruama69 - posté le 14/04/2013 à 13:31:20 (7 messages postés)

❤ 0

Celui la c'est pour le deplacement pixel - pixel

Portion de code : Tout sélectionner

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
#==============================================================================
# ** Victor Engine - Pixel Movement
#------------------------------------------------------------------------------
# Author : Victor Sant
#
# Version History:
#  v 1.00 - 2012.05.29 > First release
#  v 1.01 - 2012.05.29 > Compatibility with Terrain States
#  v 1.02 - 2012.07.03 > Compatibility with Basic Module 1.23
#  v 1.03 - 2012.07.05 > Added 'over event' tag for objects over blocked tiles
#                      > Added Steps settings for events
#  v 1.04 - 2012.07.24 > Compatibility with Moving Platform
#                      > Added <each step trigger> tag for events
#  v 1.05 - 2012.07.30 > Fixed issue when characters moves toward the same spot
#  v 1.06 - 2012.08.03 > Compatibility with Anti Lag
#  v 1.07 - 2012.08.03 > Fixed collision with tile graphics events
#  v 1.08 - 2012.08.18 > Fixed issue with Pixel Movement and Vehicles
#                      > Fixed issue with some notetags
#                      > Fixed issue with chasing events
#  v 1.09 - 2013.01.07 > Fixed issue with vehicles passing through all tiles
#  v 1.10 - 2013.01.24 > Fixed issue with diagonal movement and VE_DIAGONAL_FIX
#------------------------------------------------------------------------------
#  This script allows to replace the tile based movement where the player
# walks a whole 32 pixel tile each step with one that he walks only 4 pixels.
# It also give a better collision system for events.
#------------------------------------------------------------------------------
# Compatibility
#   Requires the script 'Victor Engine - Basic Module' v 1.25 or higher
#   If used with 'Victor Engine - Animated Battle' place this bellow it.
#   If used with 'Victor Engine - Follower Control' place this bellow it.
#   If used with 'Victor Engine - Follower Options' place this bellow it.
#
# * Overwrite methods
#   class Game_Actor < Game_Battler
#     def turn_end_on_map
#
#   class Game_Map
#     def layered_tiles(x, y)
#     def events_xy(x, y)
#     def events_xy_nt(x, y)
#     def x_with_direction(x, d, times = 1)
#     def y_with_direction(y, d, times = 1)
#     def round_x_with_direction(x, d)
#     def round_y_with_direction
#
#   class Game_CharacterBase
#     def region_id
#     def move_straight(d, turn_ok = true)
#     def move_diagonal(horz, vert)
#     def collide_with_events?(x, y)
#     def collide_with_vehicles?(x, y)
#
#   class Game_Player < Game_Character
#     def check_event_trigger_there(triggers)
#     def start_map_event(x, y, triggers, normal)
#     def update_nonmoving(last_moving)
#     def get_on_vehicle
#     def increase_steps
#
#   class Game_Follower < Game_Character
#     def chase_preceding_character
#
#   class Game_Event < Game_Character
#     def collide_with_player_characters?(x, y)
#
#   class Game_Vehicle < Game_Character
#     def land_ok?(x, y, d)
#
# * Alias methods
#   class Game_Actor < Game_Battler
#     def check_floor_effect
#
#   class Game_CharacterBase
#     def init_public_members
#     def update
#
#   class Game_Event < Game_Character
#     def start
#
#   class Game_Player < Game_Character
#     def get_off_vehicle
#     def clear_transfer_info
#     def update
#
#   class Game_Event < Game_Character
#     def start
#
#------------------------------------------------------------------------------
# Instructions:
#  To instal the script, open you script editor and paste this script on
#  a new section bellow the Materials section. This script must also
#  be bellow the script 'Victor Engine - Basic'
#
#------------------------------------------------------------------------------
# Event Comment boxes note tags:
#   Tags to be used on events Comment boxes.
#
#  <move steps: x>
#   Setup the number of steps each "Move" command will execute. The default
#   value is 8 (1 tile)
#     x : number of steps
#
#  <event size: x, y>
#   Collision area size, in pixels for event collisions.
#     x : collision area width
#     y : collision area height
#
#  <front collision>
#   Events with this tag won't start if the the collision between events and
#   the player occur between their edges.
#
#  <no side collision fix>
#   Events with this tag won't have the "slide" effect when the edges of the
#   events collide with the player
#
#  <over tile>
#   Events with this tag will start even when placed over blocked tiles.
#   By default, if the passage is blocked the event don't start.
#
#  <each step trigger>
#   By default, events with through or bellow character priority triggers
#   only one time for each 8 steps above them. With this tag though, the
#   event will trigger every step.
#
#------------------------------------------------------------------------------
# Additional instructions:
#
#  All events and tiles have a "slide" effect when the player faces the edge
#  of a tile or event. I added this function since it would be a pain to
#  be in the exact position to go throug a narrow path.
#  This can be disabled for events, but not for tiles.
#
#  By default, event collision size is the same as the event bitmap box, no
#  matter how the sprite is set inside of the box. If you want different
#  collision size you must setup manually in the event with the tag
#  <event size: x, y>
#
#==============================================================================
 
#==============================================================================
# ** Victor Engine
#------------------------------------------------------------------------------
#   Setting module for the Victor Engine
#==============================================================================
 
module Victor_Engine
  #--------------------------------------------------------------------------
  # * Player collision area
  #   Different from events, player collision don't rely on the graphic size
  #   Player collision area can be of 2 types:
  #   - 32 x 32 box if VE_PLAYER_BIG_COLLISION = true
  #   - 24 x 24 box if VE_PLAYER_BIG_COLLISION = false
  #--------------------------------------------------------------------------
  VE_PLAYER_BIG_COLLISION = true
  #--------------------------------------------------------------------------
  # * required
  #   This method checks for the existance of the basic module and other
  #   VE scripts required for this script to work, don't edit this
  #--------------------------------------------------------------------------
  def self.required(name, req, version, type = nil)
    if !$imported[:ve_basic_module]
      msg = "The script '%s' requires the script\n"
      msg += "'VE - Basic Module' v%s or higher above it to work properly\n"
      msg += "Go to http://victorscripts.wordpress.com/ to download this script."
      msgbox(sprintf(msg, self.script_name(name), version))
      exit
    else
      self.required_script(name, req, version, type)
    end
  end
  #--------------------------------------------------------------------------
  # * script_name
  #   Get the script name base on the imported value
  #--------------------------------------------------------------------------
  def self.script_name(name, ext = "VE")
    name = name.to_s.gsub("_", " ").upcase.split
    name.collect! {|char| char == ext ? "#{char} -" : char.capitalize }
    name.join(" ")
  end
end
 
$imported ||= {}
$imported[:ve_pixel_movement] = 1.10
Victor_Engine.required(:ve_pixel_movement, :ve_basic_module, 1.25, :above)
Victor_Engine.required(:ve_pixel_movement, :ve_map_battle, 1.00, :bellow)
Victor_Engine.required(:ve_pixel_movement, :ve_diagonal_move, 1.00, :bellow)
 
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles actors. It's used within the Game_Actors class
# ($game_actors) and referenced by the Game_Party class ($game_party).
#==============================================================================
 
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Overwrite method: turn_end_on_map
  #--------------------------------------------------------------------------
  def turn_end_on_map
    if $game_player.steps % (steps_for_turn * 8) == 0
      on_turn_end
      perform_map_damage_effect if @result.hp_damage > 0
    end
  end
  #--------------------------------------------------------------------------
  # * Alias method: init_public_members
  #--------------------------------------------------------------------------
  alias :check_floor_effect_ve_pixel_movement :check_floor_effect
  def check_floor_effect
    return if check_damage_floor
    check_floor_effect_ve_pixel_movement
  end
  #--------------------------------------------------------------------------
  # * New method: check_damage_floor
  #--------------------------------------------------------------------------
  def check_damage_floor
    $game_player.damage_floor % 8 != 0
  end
end
 
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
#  This class handles maps. It includes scrolling and passage determination
# functions. The instance of this class is referenced by $game_map.
#==============================================================================
 
class Game_Map
  #--------------------------------------------------------------------------
  # * Overwrite method: layered_tiles
  #--------------------------------------------------------------------------
  def layered_tiles(x, y)
    x2 = (x - 0.5).ceil
    y2 = (y - 0.125).ceil
    [2, 1, 0].collect {|z| tile_id(x2, y2, z) }
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: events_xy
  #--------------------------------------------------------------------------
  def events_xy(x, y)
    event_list.select {|event| event.near?(x, y) }
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: events_xy_nt
  #--------------------------------------------------------------------------
  def events_xy_nt(x, y)
    event_list.select {|event| event.near_nt?(x, y) }
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: x_with_direction
  #--------------------------------------------------------------------------
  def x_with_direction(x, d, times = 1)
    x + (d == 6 ? times * 0.125 : d == 4 ? -times * 0.125 : 0)
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: y_with_direction
  #--------------------------------------------------------------------------
  def y_with_direction(y, d, times = 1)
    y + (d == 2 ? times * 0.125 : d == 8 ? -times * 0.125 : 0)
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: round_x_with_direction
  #--------------------------------------------------------------------------
  def round_x_with_direction(x, d)
    round_x(x + (d == 6 ? 0.125 : d == 4 ? -0.125 : 0))
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: round_y_with_direction
  #--------------------------------------------------------------------------
  def round_y_with_direction(y, d)
    round_y(y + (d == 2 ? 0.125 : d == 8 ? -0.125 : 0))
  end
  #--------------------------------------------------------------------------
  # * New method: check_x_with_direction
  #--------------------------------------------------------------------------
  def check_x_with_direction(x, d)
    round_x(x + (d == 6 ? 1 : d == 4 ? -1 : 0))
  end
  #--------------------------------------------------------------------------
  # * New method: check_y_with_direction
  #--------------------------------------------------------------------------
  def check_y_with_direction(y, d)
    round_y(y + (d == 2 ? 1 : d == 8 ? -1 : 0))
  end
end
 
#==============================================================================
# ** Game_CharacterBase
#------------------------------------------------------------------------------
#  This class deals with characters. Common to all characters, stores basic
# data, such as coordinates and graphics. It's used as a superclass of the
# Game_Character class.
#==============================================================================
 
class Game_CharacterBase
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :next_movement
  attr_accessor :side_collision
  attr_accessor :damage_floor
  attr_accessor :move_list
  attr_accessor :steps
  #--------------------------------------------------------------------------
  # * Overwrite method: region_id
  #--------------------------------------------------------------------------
  def region_id
    $game_map.region_id((@x - 0.5).ceil, (@y - 0.125).ceil)
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: collide_with_events?
  #--------------------------------------------------------------------------
  def collide_with_events?(x, y)
    $game_map.events_xy_nt(x, y).any? do |event|
      event.collision_condition?(x, y, bw, bh, event?, @id, @side_collision)
    end
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: collide_with_vehicles?
  #--------------------------------------------------------------------------
  def collide_with_vehicles?(x, y)
    $game_map.vehicles.compact.any? do |vehicle|
      next if vehicle.map_id != $game_map.map_id
      vehicle.collision_condition?(x, y, bw, bh, self)
    end
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: move_straight
  #--------------------------------------------------------------------------
  def move_straight(d, turn_ok = true)
    @move_list += [{d: [d], turn: turn_ok}] * step_times
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: move_straight
  #--------------------------------------------------------------------------
  def move_diagonal(horz, vert)
    @move_list += [{d: [horz, vert], turn: true}] * step_times
  end
  #--------------------------------------------------------------------------
  # * Alias method: init_public_members
  #--------------------------------------------------------------------------
  alias :init_public_members_ve_pixel_movement :init_public_members
  def init_public_members
    init_public_members_ve_pixel_movement
    @move_list     = []
    @next_movement = []
    @over_event    = 0
    @damage_floor  = 0
    @steps         = 0
  end
  #--------------------------------------------------------------------------
  # * Alias method: update
  #--------------------------------------------------------------------------
  alias :update_ve_pixel_movement :update
  def update
    update_move_straight
    update_move_diagonal
    update_ve_pixel_movement
  end
  #--------------------------------------------------------------------------
  # * New method: update_move_straight
  #--------------------------------------------------------------------------
  def update_move_straight
    return if moving? || @move_list.empty?
    return if @move_list.first[:d].size > 1
    @move_value = @move_list.shift
    d           = @move_value[:d].first
    if passable?(@x, @y, d)
      move_straight_pixel(d)
    elsif @move_value[:turn]
      @move_list.clear
      check_event_trigger_move(d)
    else
      @move_list.clear
    end
  end
  #--------------------------------------------------------------------------
  # * New method: move_straight_pixel
  #--------------------------------------------------------------------------
  def move_straight_pixel(d)
    @diagonal_move = false
    setup_movement(d, d)
    @real_x = $game_map.x_with_direction(@x, reverse_dir(d))
    @real_y = $game_map.y_with_direction(@y, reverse_dir(d))
    @moved  = player?
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: update_move_diagonal
  #--------------------------------------------------------------------------
  def update_move_diagonal
    return if moving? || @move_list.empty?
    return if @move_list.first[:d].size < 2
    @move_value = @move_list.shift
    horz        = @move_value[:d].first
    vert        = @move_value[:d].last
    move_diagonal_pixel(horz, vert) if diagonal_passable?(x, y, horz, vert)
  end
  #--------------------------------------------------------------------------
  # * New method: move_diagonal_pixel
  #--------------------------------------------------------------------------
  def move_diagonal_pixel(horz, vert)
    @diagonal_move = true
    setup_movement(horz, vert)
    @real_x = $game_map.x_with_direction(@x, reverse_dir(horz))
    @real_y = $game_map.y_with_direction(@y, reverse_dir(vert))
    @moved = player?
  end
  #--------------------------------------------------------------------------
  # * New method: character_collision?
  #--------------------------------------------------------------------------
  def character_collision?(x, y, d)
    x2 = $game_map.round_x_with_direction(x, d)
    y2 = $game_map.round_y_with_direction(y, d)
    @through || debug_through? || !collide_with_characters?(x2, y2)
  end
  #--------------------------------------------------------------------------
  # * New method: step_times
  #--------------------------------------------------------------------------
  def step_times
    return 8
  end
  #--------------------------------------------------------------------------
  # * New method: near_nt?
  #--------------------------------------------------------------------------
  def near_nt?(x, y)
    near?(x, y) && !@through
  end
  #--------------------------------------------------------------------------
  # * New method: near?
  #--------------------------------------------------------------------------
  def near?(x, y)
    w = step_over? ? [bw * 0.625, 0.5].max : [bw, 1.0].max 
    h = step_over? ? [bh * 0.625, 0.5].max : [bh, 1.0].max 
    @real_x > x - w && @real_x < x + w && @real_y > y - h && @real_y < y + h
  end
  #--------------------------------------------------------------------------
  # * New method: setup_movement
  #--------------------------------------------------------------------------
  def setup_movement(horz, vert)
    @x = $game_map.round_x_with_direction(@x, horz)
    @y = $game_map.round_y_with_direction(@y, vert)
    add_next_movement(horz == vert ? horz : [horz, vert])
    set_direction(horz) if @direction == reverse_dir(horz) || horz == vert
    set_direction(vert) if @direction == reverse_dir(vert) && horz != vert
    follower_control_move_update(horz, vert)
    increase_steps
  end
  #--------------------------------------------------------------------------
  # * New method: check_event_trigger_move
  #--------------------------------------------------------------------------
  def check_event_trigger_move(d)
    set_direction(d)
    check_event_trigger_touch_front
  end
  #--------------------------------------------------------------------------
  # * New method: collision_condition?
  #--------------------------------------------------------------------------
  def collision_condition?(x, y, bw, bh, event, event_id, side)
    return false if event && self.id == event_id
    return false unless collision?(x, y, bw, bh)
    return false unless normal_priority? || event
    return false if side && !side_collision?
    return true
  end
  #--------------------------------------------------------------------------
  # * New method: follower_control_move_update
  #--------------------------------------------------------------------------
  def follower_control_move_update(horz, vert)
    return unless $imported[:ve_followers_options] 
    return unless player? || follower?
    add_move_update(horz == vert ? [horz] : [horz, vert])
  end
  #--------------------------------------------------------------------------
  # * New method: passable?
  #--------------------------------------------------------------------------
  def passable?(x, y, d)
    x = fix_position(x)
    y = fix_position(y)
    passable1 = passable_tile?(x, y, d)
    passable2 = character_collision?(x, y, d)
    fix_movement(x, y, d)  if player? && !passable1 && passable2
    fix_collision(x, y, d) if player? && !passable2 && passable1
    passable1 && passable2
  end
  #--------------------------------------------------------------------------
  # * New method: passable_tile?
  #--------------------------------------------------------------------------
  def passable_tile?(x, y, d)
    result = true
    result = passable_down?(x, y)  if d == 2
    result = passable_left?(x, y)  if d == 4
    result = passable_right?(x, y) if d == 6
    result = passable_up?(x, y)    if d == 8
    result
  end
  #--------------------------------------------------------------------------
  # * New method: locked_tile?
  #--------------------------------------------------------------------------
  def locked_tile?(x, y, d = 0)
    list = [2, 4, 6, 8] - [d]
    list.all? {|d| !map_passable?(x, y, d) }
  end
  #--------------------------------------------------------------------------
  # * New method: locked_move?
  #--------------------------------------------------------------------------
  def locked_move?(x, y)
    !passable_down?(x, y)  && !passable_left?(x, y)
    !passable_right?(x, y) && !passable_up?(x, y)
  end
  #--------------------------------------------------------------------------
  # * New method: passable_down?
  #--------------------------------------------------------------------------
  def passable_down?(x, y)
    passable_normal?(x.ceil, y.to_i, 2, 4, x.ceil?) &&
    passable_normal?(x.to_i, y.to_i, 2, 6, x.ceil?)
  end
  #--------------------------------------------------------------------------
  # * New method: passable_left?
  #--------------------------------------------------------------------------
  def passable_left?(x, y)
    passable_normal?(x.ceil, y.ceil, 4, 8, y.ceil?) &&
    passable_normal?(x.ceil, y.to_i, 4, 2, y.ceil?)
  end
  #--------------------------------------------------------------------------
  # * New method: passable_right?
  #--------------------------------------------------------------------------
  def passable_right?(x, y)
    passable_normal?(x.to_i, y.ceil, 6, 8, y.ceil?) &&
    passable_normal?(x.to_i, y.to_i, 6, 2, y.ceil?)
  end
  #--------------------------------------------------------------------------
  # * New method: passable_up?
  #--------------------------------------------------------------------------
  def passable_up?(x, y)
    passable_normal?(x.ceil, y.ceil, 8, 4, x.ceil?) && 
    passable_normal?(x.to_i, y.ceil, 8, 6, x.ceil?)
  end
  #--------------------------------------------------------------------------
  # * New method: passable_normal?
  #--------------------------------------------------------------------------
  def passable_normal?(x, y, d, d2, ceil = false)
    x1 = $game_map.round_x(x)
    y1 = $game_map.round_y(y)
    x2 = $game_map.check_x_with_direction(x1, d)
    y2 = $game_map.check_y_with_direction(y1, d)
    x3 = $game_map.round_x_with_direction(x1, d)
    y3 = $game_map.round_y_with_direction(y1, d)
    return false unless $game_map.valid?(x3, y3)
    return true  if @through || debug_through?
    return false unless map_passable?(x2, y2, d2) || !ceil
    return false unless move_passable1?(x1, y1, x2, y2, d)
    return false unless move_passable2?(x1, y1, x2, y2, d)
    return true
  end
  #--------------------------------------------------------------------------
  # * New method: move_passable1?
  #--------------------------------------------------------------------------
  def move_passable1?(x1, y1, x2, y2, d)
    map_passable?(x1, y1, d) || map_passable?(x2, y2, d)
  end
  #--------------------------------------------------------------------------
  # * New method: move_passable?
  #--------------------------------------------------------------------------
  def move_passable2?(x1, y1, x2, y2, d)
    map_passable?(x2, y2, reverse_dir(d)) && (map_passable?(x1, y1, d) ||
    locked_tile?(x1, y1))
  end
  #--------------------------------------------------------------------------
  # * New method: fix_movement
  #--------------------------------------------------------------------------
  def fix_movement(x, y, d)
    return if (@diagonal && @diagonal != 0) || @diagonal_move
    fix_movement_horiz(x, y, d) if (d == 2 || d == 8) && x.ceil?
    fix_movement_vert(x, y, d)  if (d == 4 || d == 6) && y.ceil?
  end
  #--------------------------------------------------------------------------
  # * New method: fix_movement_horiz
  #--------------------------------------------------------------------------
  def fix_movement_horiz(x, y, d)
    adjust = x - x.to_i
    fix_move_straight(4) if fix_movement_left?(x, y, d)  && adjust < 0.5
    fix_move_straight(6) if fix_movement_right?(x, y, d) && adjust > 0.5
  end
  #--------------------------------------------------------------------------
  # * New method: fix_movement_ver
  #--------------------------------------------------------------------------
  def fix_movement_vert(x, y, d)
    adjust = y - y.to_i
    fix_move_straight(2) if fix_movement_down?(x, y, d) && adjust > 0.5
    fix_move_straight(8) if fix_movement_up?(x, y, d)   && adjust < 0.5
  end
  #--------------------------------------------------------------------------
  # * New method: fix_movement_down?
  #--------------------------------------------------------------------------
  def fix_movement_down?(x, y, d)
    passable_normal?(x.to_i, y.ceil, d, 0, false) && movement_fix?(x, y, 2)
  end
  #--------------------------------------------------------------------------
  # * New method: fix_movement_left?
  #--------------------------------------------------------------------------
  def fix_movement_left?(x, y, d)
    passable_normal?(x.to_i, y.to_i, d, 0, false) && movement_fix?(x, y, 4)
  end
  #--------------------------------------------------------------------------
  # * New method: fix_movement_right?
  #--------------------------------------------------------------------------
  def fix_movement_right?(x, y, d)
    passable_normal?(x.ceil, y.to_i, d, 0, false) && movement_fix?(x, y, 6)
  end
  #--------------------------------------------------------------------------
  # * New method: fix_movement_up?
  #--------------------------------------------------------------------------
  def fix_movement_up?(x, y, d)
    passable_normal?(x.to_i, y.to_i, d, 0, false) && movement_fix?(x, y, 8)
  end
  #--------------------------------------------------------------------------
  # * New method: movement_fix?
  #--------------------------------------------------------------------------
  def movement_fix?(x, y, d)
    passable_tile?(x, y, d) && character_collision?(x, y, d)
  end
  #--------------------------------------------------------------------------
  # * New method: fix_collision
  #--------------------------------------------------------------------------
  def fix_collision(x, y, d)
    return if (@diagonal && @diagonal != 0) || @diagonal_move
    @side_collision = true
    fix_collision_horiz(x, y, d) if (d == 2 || d == 8)
    fix_collision_vert(x, y, d)  if (d == 4 || d == 6)
    @side_collision = false
  end
  #--------------------------------------------------------------------------
  # * New method: fix_collision_horiz
  #--------------------------------------------------------------------------
  def fix_collision_horiz(x, y, d)
    fix_move_straight(4) if fix_collision_left?(x, y, d)
    fix_move_straight(6) if fix_collision_right?(x, y, d)
  end
  #--------------------------------------------------------------------------
  # * New method: fix_collision_vert
  #--------------------------------------------------------------------------
  def fix_collision_vert(x, y, d)
    fix_move_straight(2) if fix_collision_down?(x, y, d)
    fix_move_straight(8) if fix_collision_up?(x, y, d)
  end
  #--------------------------------------------------------------------------
  # * New method: fix_collision_down?
  #--------------------------------------------------------------------------
  def fix_collision_down?(x, y, d)
    !character_collision?(x, y, d) && collision_fix?(x, y, d, 2)
  end
  #--------------------------------------------------------------------------
  # * New method: fix_collision_left?
  #--------------------------------------------------------------------------
  def fix_collision_left?(x, y, d)
    !character_collision?(x, y, d) && collision_fix?(x, y, d,  4)
  end
  #--------------------------------------------------------------------------
  # * New method: fix_collision_right?
  #--------------------------------------------------------------------------
  def fix_collision_right?(x, y, d)
    !character_collision?(x, y, d) && collision_fix?(x, y, d, 6)
  end
  #--------------------------------------------------------------------------
  # * New method: fix_collision_up?
  #--------------------------------------------------------------------------
  def fix_collision_up?(x, y, d)
    !character_collision?(x, y, d) && collision_fix?(x, y, d, 8)
  end
  #--------------------------------------------------------------------------
  # * New method: collision_fix?
  #--------------------------------------------------------------------------
  def collision_fix?(x, y, d, d2)
    side_collision_fix?(x, y, d, d2, 2) && side_fix?(x, y, d2)
  end
  #--------------------------------------------------------------------------
  # * New method: side_collision_fix?
  #--------------------------------------------------------------------------
  def side_collision_fix?(x, y, d, d2, t)
    t.times.any? do |i|
      x2, y2 = x, y
      y2 += (t - i) * 0.125 if d2 == 2
      x2 -= (t - i) * 0.125 if d2 == 4
      x2 += (t - i) * 0.125 if d2 == 6
      y2 -= (t - i) * 0.125 if d2 == 8
      character_collision?(x2, y2, d)
    end
  end
  #--------------------------------------------------------------------------
  # * New method: side_fix?
  #--------------------------------------------------------------------------
  def side_fix?(x, y, d)
    passable_tile?(x, y, d) && character_collision?(x, y, d)
  end
  #--------------------------------------------------------------------------
  # * New method: fix_move_straight
  #--------------------------------------------------------------------------
  def fix_move_straight(d)
    return if moving?
    @x = $game_map.round_x_with_direction(@x, d)
    @y = $game_map.round_y_with_direction(@y, d)
    follower_control_move_update(d, d)
    add_next_movement(d)
    increase_steps
    @moved = player?
  end
  #--------------------------------------------------------------------------
  # * New method: add_next_movement
  #--------------------------------------------------------------------------
  def add_next_movement(d)
    return unless follower? || player? 
    return if $imported[:ve_followers_control]# && follower_control_block
    @next_movement.push(d)
  end
  #--------------------------------------------------------------------------
  # * New method: follower_control_block
  #--------------------------------------------------------------------------
  def follower_control_block
    return true if follower? && origin_position
    return true if $game_player.followers.gathering_origin?
    return false
  end
  #--------------------------------------------------------------------------
  # * New method: front_collision?
  #--------------------------------------------------------------------------
  def front_collision?(x, y, d)
    return false if (@diagonal && @diagonal != 0) || @diagonal_move
    result = !front_collision_horiz(x, y, d) if (d == 2 || d == 8)
    result = !front_collision_vert(x, y, d)  if (d == 4 || d == 6)
    result
  end
  #--------------------------------------------------------------------------
  # * New method: front_collision_horiz
  #--------------------------------------------------------------------------
  def front_collision_horiz(x, y, d)
    side_collision_fix?(x, y, d, 4, 4) || side_collision_fix?(x, y, d, 6, 4) 
  end
  #--------------------------------------------------------------------------
  # * New method: front_collision_vert
  #--------------------------------------------------------------------------
  def front_collision_vert(x, y, d)
    side_collision_fix?(x, y, d, 2, 4) || side_collision_fix?(x, y, d, 8, 4)
  end
  #--------------------------------------------------------------------------
  # * New method: step_over?
  #--------------------------------------------------------------------------
  def step_over?
    @through
  end
  #--------------------------------------------------------------------------
  # * New method: bw
  #--------------------------------------------------------------------------
  def bw
    setup_bitmap_dimension unless @bw && character_name == @character_name_wh
    @bw
  end
  #--------------------------------------------------------------------------
  # * New method: bh
  #--------------------------------------------------------------------------
  def bh
    setup_bitmap_dimension unless @bh && character_name == @character_name_wh
    @bh
  end
  #--------------------------------------------------------------------------
  # * New method: setup_bitmap_dimension
  #--------------------------------------------------------------------------
  def setup_bitmap_dimension
    @character_name_wh = character_name
    bitmap = Cache.character(character_name).clone
    sign = @character_name[/^[\!\$]./]
    if character_name != "" && @tile_id == 0 && sign && sign.include?('$')
      @bw = bitmap.width  / 32.0 / frames
      @bh = bitmap.height / 32.0 / 4
    elsif character_name != "" && @tile_id == 0 
      @bw = bitmap.width  / 32.0 / (frames * 4) 
      @bh = bitmap.height / 32.0 / 8
    else
      @bw = 1.0
      @bh = 1.0
    end
    bitmap.dispose
  end
  #--------------------------------------------------------------------------
  # * New method: collision?
  #--------------------------------------------------------------------------
  def collision?(x, y, w, h)
    ax1, ay1, ax2, ay2 = setup_rect(x, y, w, h)
    bx1, by1, bx2, by2 = setup_rect(@x, @y, bw, bh)
    ax2 > bx1 && ax1 < bx2 && ay2 > by1 && ay1 < by2 
  end
  #--------------------------------------------------------------------------
  # * New method: over?
  #--------------------------------------------------------------------------
  def over?(x, y)
    ax1, ay1, ax2, ay2 = setup_rect(x, y - 0.125, 0, 0)
    bx1, by1, bx2, by2 = setup_rect(@real_x, @real_y, bw, bh - 0.125)
    ax2 >= bx1 && ax1 <= bx2 && ay2 >= by1 && ay1 <= by2
  end
  #--------------------------------------------------------------------------
  # * New method: setup_rect
  #--------------------------------------------------------------------------
  def setup_rect(x, y, w, h)
    x1 = x - w / 2.0
    y1 = y - h
    x2 = x1 + w
    y2 = y1 + h
    [x1, y1, x2, y2]
  end
  #--------------------------------------------------------------------------
  # * New method: align_with
  #--------------------------------------------------------------------------
  def align_with(x, y)
    d  = @direction
    @x = $game_map.round_x_with_direction(x, 0) if d == 2 || d == 8
    @y = $game_map.round_y_with_direction(y, 0) if d == 6 || d == 4
    dx = (d == 2 || d == 8) ? (@x - @real_x) / 0.125 : 0
    dy = (d == 4 || d == 6) ? (@y - @real_y) / 0.125 : 0
    set_direction(dx > 0 ? 6 : dx < 0 ? 4 : dy > 0 ? 2 : dy < 0 ? 8 : d)
    @real_x = $game_map.x_with_direction(@x, reverse_dir(@direction), dx.abs)
    @real_y = $game_map.y_with_direction(@y, reverse_dir(@direction), dy.abs)
    update_for_align while moving?
    @direction = d
  end
  #--------------------------------------------------------------------------
  # * New method: update_for_align
  #--------------------------------------------------------------------------
  def update_for_align
    SceneManager.scene.update_basic
    SceneManager.scene.spriteset.update
    $game_map.update(true)
    $game_timer.update
    update_animation
    update_move
  end
  #--------------------------------------------------------------------------
  # * New method: fix_position
  #--------------------------------------------------------------------------
  def fix_position(n)
    (n * 64 / 8).round / 8.0
  end
end
 
#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
#  This class handles maps. It includes event starting determinants and map
# scrolling functions. The instance of this class is referenced by $game_map.
#==============================================================================
 
class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :over_event
  attr_accessor :land_test
  #--------------------------------------------------------------------------
  # * Overwrite method: check_event_trigger_there
  #--------------------------------------------------------------------------
  def check_event_trigger_there(triggers)
    x2 = $game_map.round_x_with_direction(@x, @direction)
    y2 = $game_map.round_y_with_direction(@y, @direction)
    start_map_event(x2, y2, triggers, true)
    return if $game_map.any_event_starting?
    return unless counter_tile?
    x3 = $game_map.check_x_with_direction(x2, @direction)
    y3 = $game_map.check_y_with_direction(y2, @direction)
    start_map_event(x3, y3, triggers, true)
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: start_map_event
  #--------------------------------------------------------------------------
  def start_map_event(x, y, triggers, normal)
    return if $game_map.interpreter.running?
    $game_map.events_xy(x, y).each do |event|
      event.start if check_event_contiontion(x, y, event, triggers, normal)
    end
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: update_nonmoving
  #--------------------------------------------------------------------------
  def update_nonmoving(last_moving)
    return if $game_map.interpreter.running?
    moved  = @moved
    @moved = false
    if last_moving || moved
      $game_party.on_player_walk
      return if check_touch_event
    end
    if movable? && Input.trigger?(:C)
      return if get_on_off_vehicle
      return if check_action_event
    end
    @over_event -= 1 if @over_event > 0 && (last_moving || moved)
    update_encounter if last_moving || moved
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: get_on_vehicle
  #--------------------------------------------------------------------------
  def get_on_vehicle
    setup_vehicle
    enter_vehicle if vehicle
    @vehicle_getting_on
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: increase_steps
  #--------------------------------------------------------------------------
  def increase_steps
    super
    if normal_walk?
      @steps += 1
      $game_player.damage_floor  = 0 unless on_damage_floor?
      $game_player.damage_floor += 1
      $game_party.increase_steps if @steps % 8 == 0
    end
  end
  #--------------------------------------------------------------------------
  # * Alias method: clear_transfer_info
  #--------------------------------------------------------------------------
  alias :clear_transfer_info_ve_pixel_movement :clear_transfer_info
  def clear_transfer_info
    clear_transfer_info_ve_pixel_movement
    clear_next_movement
  end
  #--------------------------------------------------------------------------
  # * Alias method: update
  #--------------------------------------------------------------------------
  alias :update_ve_gp_pixel_movement :update
  def update
    @followers.move unless $imported[:ve_followers_options]
    update_ve_gp_pixel_movement
  end
  #--------------------------------------------------------------------------
  # * Alias method: move_by_input
  #--------------------------------------------------------------------------
  alias :move_by_input_ve_gp_pixel_movement :move_by_input
  def move_by_input
    return unless @move_list.empty?
    move_by_input_ve_gp_pixel_movement
  end
  #--------------------------------------------------------------------------
  # * Alias method: move_by_input
  #--------------------------------------------------------------------------
  alias :update_vehicle_get_on_ve_gp_pixel_movement :update_vehicle_get_on
  def update_vehicle_get_on
    return unless @move_list.empty?
    @followers.gather   unless @followers.gathered?
    @through = false    if @followers.gathered?
    clear_next_movement if @followers.gathered?
    update_vehicle_get_on_ve_gp_pixel_movement if @followers.gathered?
  end
  #--------------------------------------------------------------------------
  # * Alias method: update_vehicle_get_off
  #--------------------------------------------------------------------------
  alias :update_vehicle_get_off_ve_gp_pixel_movement :update_vehicle_get_off
  def update_vehicle_get_off
    return unless @move_list.empty?
    @followers.gather   unless @followers.gathered?
    clear_next_movement if @followers.gathered?
    @through = false    if !@followers.gathering? && vehicle.altitude == 0
    update_vehicle_get_off_ve_gp_pixel_movement if @followers.gathered?
  end
  #--------------------------------------------------------------------------
  # * Alias method: get_off_vehicle
  #--------------------------------------------------------------------------
  alias :get_off_vehicle_ve_gp_pixel_movement :get_off_vehicle
  def get_off_vehicle
    result = get_off_vehicle_ve_gp_pixel_movement
    clear_vehicle_off if result
    result
  end
  #--------------------------------------------------------------------------
  # * New method: clear_vehicle_off
  #--------------------------------------------------------------------------
  def clear_vehicle_off
    @through = true
    clear_next_movement
    @followers.synchronize(@x, @y, @direction)
  end
  #--------------------------------------------------------------------------
  # * New method: check_event_contiontion
  #--------------------------------------------------------------------------
  def check_event_contiontion(x, y, event, triggers, normal)
    passable = passable_tile?(@x, @y, @direction)
    w = (counter_tile? || !passable) ? 1.0 : bw
    h = (counter_tile? || !passable) ? 1.0 : bh
    return false unless event.trigger_in?(triggers)
    return false unless event.event_priority?(normal)
    return false unless passable || event.over_tile? || counter_tile?
    return false unless event.collision?(x, y, w, h) || !jumping?
    return false unless !event.in_front? || front_collision?(x, y, @direction)
    return true
  end
  #--------------------------------------------------------------------------
  # * New method: counter_tile?
  #--------------------------------------------------------------------------
  def counter_tile?
    x = $game_map.check_x_with_direction(@x, @direction)
    y = $game_map.check_y_with_direction(@y, @direction)
    $game_map.counter?(x, y)
  end
  #--------------------------------------------------------------------------
  # * New method: setup_vehicle
  #--------------------------------------------------------------------------
  def setup_vehicle
    $game_map.vehicles.compact.each do |vehicle|
      next unless vehicle.enter_vechicle?(@x, @y, @direction)
      @vehicle_type = vehicle.type
      break if vehicle
    end
  end
  #--------------------------------------------------------------------------
  # * New method: enter_vehicle
  #--------------------------------------------------------------------------
  def enter_vehicle
    align_with(vehicle.x, vehicle.y) unless in_airship?
    @vehicle_getting_on = true
    force_move_forward unless in_airship?
    @through = true
    @followers.gather
  end
  #--------------------------------------------------------------------------
  # * New method: clear_next_movement
  #--------------------------------------------------------------------------
  def clear_next_movement
    @next_movement.clear
    @followers.clear_move_list
    @followers.clear_next_movement
  end
  #--------------------------------------------------------------------------
  # * New method: step_times
  #--------------------------------------------------------------------------
  def step_times
    (move_route_forcing || not_driving?) ? super : 1
  end
  #--------------------------------------------------------------------------
  # * New method: not_driving?
  #--------------------------------------------------------------------------
  def not_driving?
    vehicle && !vehicle.driving
  end
  #--------------------------------------------------------------------------
  # * New method: move_straight
  #--------------------------------------------------------------------------
  def move_straight(d, turn_ok = true)
    super
  end
  #--------------------------------------------------------------------------
  # * New method: move_diagonal
  #--------------------------------------------------------------------------
  def move_diagonal(horz, vert)
    super
  end
  #--------------------------------------------------------------------------
  # * New method: setup_bitmap_dimension
  #--------------------------------------------------------------------------
  def setup_bitmap_dimension
    @bw = VE_PLAYER_BIG_COLLISION ? 1.0 : 0.75
    @bh = VE_PLAYER_BIG_COLLISION ? 1.0 : 0.75
  end
end
 
#==============================================================================
# ** Game_Follower
#------------------------------------------------------------------------------
#  This class handles the followers. Followers are the actors of the party
# that follows the leader in a line. It's used within the Game_Followers class.
#==============================================================================
 
class Game_Follower < Game_Character
  #--------------------------------------------------------------------------
  # * Overwrite method: chase_preceding_character
  #--------------------------------------------------------------------------
  def chase_preceding_character
    return if $imported[:ve_followers_control] && cant_follow_character
    return if $imported[:ve_followers_options]
    unless moving? || @move_list.size > 0
      move_size = @preceding_character.next_movement.size
      if move_size >= 8 || (move_size > 0 && gathering?)
        update_chasing
      elsif gathering? && !gathered?
        move_toward_player
        @move_list.clear if gathered?
      end
    end
  end
  #--------------------------------------------------------------------------
  # * New method: update_chasing
  #--------------------------------------------------------------------------
  def update_chasing
    next_move = @preceding_character.next_movement.shift
    move_straight(next_move)  if next_move.numeric?
    move_diagonal(*next_move) if next_move.array?
  end
  #--------------------------------------------------------------------------
  # * New method: gathered?
  #--------------------------------------------------------------------------
  def gathered?
    pos?($game_player.x, $game_player.y)
  end
  #--------------------------------------------------------------------------
  # * New method: move_straight
  #--------------------------------------------------------------------------
  def move_straight(d, turn_ok = true)
    super
  end
  #--------------------------------------------------------------------------
  # * New method: move_diagonal
  #--------------------------------------------------------------------------
  def move_diagonal(horz, vert)
    super
  end
  #--------------------------------------------------------------------------
  # * New method: movement_size
  #--------------------------------------------------------------------------
  def movement_size
    gathering? ? 0 : 8
  end
  #--------------------------------------------------------------------------
  # * New method: step_times
  #--------------------------------------------------------------------------
  def step_times
    move_route_forcing ? super : 1
  end
  #--------------------------------------------------------------------------
  # * New method: setup_bitmap_dimension
  #--------------------------------------------------------------------------
  def setup_bitmap_dimension
    @bw = VE_PLAYER_BIG_COLLISION ? 1.0 : 0.75
    @bh = VE_PLAYER_BIG_COLLISION ? 1.0 : 0.75
  end
end
 
#==============================================================================
# ** Game_Followers
#------------------------------------------------------------------------------
#  This class handles the followers. It's a wrapper for the built-in class
# "Array." It's used within the Game_Player class.
#==============================================================================
 
class Game_Followers
  #--------------------------------------------------------------------------
  # * New method: clear_next_movement
  #--------------------------------------------------------------------------
  def clear_next_movement
    each {|follower| follower.next_movement.clear }
  end
  #--------------------------------------------------------------------------
  # * New method: clear_move_list
  #--------------------------------------------------------------------------
  def clear_move_list
    each {|follower| follower.move_list.clear }
  end
  #--------------------------------------------------------------------------
  # * New method: gathered?
  #--------------------------------------------------------------------------
  def gathered?
    @data.all? {|follower| follower.gathered? }
  end
end
 
#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  This class deals with events. It handles functions including event page 
# switching via condition determinants, and running parallel process events.
# It's used within the Game_Map class.
#==============================================================================
 
class Game_Event < Game_Character
  #--------------------------------------------------------------------------
  # * Overwrite method: collide_with_player_characters?
  #--------------------------------------------------------------------------
  def collide_with_player_characters?(x, y)
    normal_priority? && player_collision?(x, y) 
  end
  #--------------------------------------------------------------------------
  # * Alias method: start
  #--------------------------------------------------------------------------
  alias :start_ve_pixel_movement :start
  def start
    start_ve_pixel_movement
    $game_player.over_event = 8 if step_over? && !step_trigger?
  end
  #--------------------------------------------------------------------------
  # * Alias method: setup_page_settings
  #--------------------------------------------------------------------------
  alias :setup_page_settings_ve_pixel_movement :setup_page_settings
  def setup_page_settings
    setup_page_settings_ve_pixel_movement
    @move_steps   = note =~ /<MOVE STEPS: (\d+)>/i ? $1.to_i : nil
    @step_trigger = note =~ /<EACH STEP TRIGGER>/i ? true : false
    @in_front     = note =~ /<FRONT COLLISION>/i   ? true : false
    @over_tile    = note =~ /<OVER TILE>/i         ? true : false
    @side_fix     = note =~ /<NO SIDE COLLISION FIX>/i ? false : true
  end
  #--------------------------------------------------------------------------
  # * New method: player_collision?
  #--------------------------------------------------------------------------
  def player_collision?(x, y)
    $game_map.actors.any? {|actor| actor.collision?(x, y, bh, bw)}
  end  
  #--------------------------------------------------------------------------
  # * New method: event_priority?
  #--------------------------------------------------------------------------
  def event_priority?(normal)
    (normal_priority? == normal || (@through && !normal)) &&
    (normal_priority? || @trigger == 0 || $game_player.over_event == 0)
  end
  #--------------------------------------------------------------------------
  # * New method: check_event_trigger_touch
  #--------------------------------------------------------------------------
  def check_event_trigger_touch(x, y)
    return if $game_map.interpreter.running?
    if @trigger == 2 && $game_player.collision?(x, y, bh, bw)
      start if !jumping? && normal_priority?
    end
  end
  #--------------------------------------------------------------------------
  # * New method: step_over?
  #--------------------------------------------------------------------------
  def step_over?
    super || (@character_name == "" && @tile_id == 0) || @priority_type == 0
  end
  #--------------------------------------------------------------------------
  # * New method: step_times
  #--------------------------------------------------------------------------
  def step_times
    @move_steps ? @move_steps : super
  end
  #--------------------------------------------------------------------------
  # * New method: step_trigger?
  #--------------------------------------------------------------------------
  def step_trigger?
    @step_trigger
  end
  #--------------------------------------------------------------------------
  # * New method: in_front?
  #--------------------------------------------------------------------------
  def in_front?
    @in_front
  end
  #--------------------------------------------------------------------------
  # * New method: over_tile?
  #--------------------------------------------------------------------------
  def over_tile?
    @over_tile
  end
  #--------------------------------------------------------------------------
  # * New method: side_collision?
  #--------------------------------------------------------------------------
  def side_collision?
    @side_fix
  end
  #--------------------------------------------------------------------------
  # * New method: setup_bitmap_dimension
  #--------------------------------------------------------------------------
  def setup_bitmap_dimension
    regexp = /<EVENT SIZE: (\d+), (\d+)>/i
    note   =~ regexp ? setup_custom_dimension($1.to_i, $2.to_i) : super
  end
  #--------------------------------------------------------------------------
  # * New method: setup_custom_dimension
  #--------------------------------------------------------------------------
  def setup_custom_dimension(x, y)
    x1 = (x / 8).to_i
    y1 = (y / 8).to_i
    @bw = x1 / 4.0
    @bh = y1 / 4.0
  end
end
 
#==============================================================================
# ** Game_Vehicle
#------------------------------------------------------------------------------
#  This class handles vehicles. It's used within the Game_Map class. If there
# are no vehicles on the current map, the coordinates is set to (-1,-1).
#==============================================================================
 
class Game_Vehicle < Game_Character
  #--------------------------------------------------------------------------
  # * Overwrite method: land_ok?
  #--------------------------------------------------------------------------
  def land_ok?(x, y, d)
    @type == :airship ? airship_landable?(x, y) : check_landable?(x, y, d)
  end
  #--------------------------------------------------------------------------
  # * New method: land_test
  #--------------------------------------------------------------------------
  def land_test
    @land_test
  end
  #--------------------------------------------------------------------------
  # * New method: step_over?
  #--------------------------------------------------------------------------
  def step_over?
    above? || super
  end
  #--------------------------------------------------------------------------
  # * New method: check_landable?
  #--------------------------------------------------------------------------
  def check_landable?(x, y, d)
    x2 = $game_map.check_x_with_direction(x, d)
    y2 = $game_map.check_y_with_direction(y, d)
    @land_test = true
    result = passable?(x2, y2, d)
    @land_test = false
    result
  end
  #--------------------------------------------------------------------------
  # * New method: airship_landable?
  #--------------------------------------------------------------------------
  def airship_landable?(x, y)
    [2, 4, 6, 8].any? {|d| passable?(x, y, d) }
  end
  #--------------------------------------------------------------------------
  # * New method: passable_normal?
  #--------------------------------------------------------------------------
  def passable_normal?(x, y, d ,d2, ceil = false)
    @land_test ? landable_normal?(x, y, d ,d2, ceil) : super(x, y, d ,d2, ceil)
  end
  #--------------------------------------------------------------------------
  # * New method: landable_normal?
  #--------------------------------------------------------------------------
  def landable_normal?(x, y, d ,d2, ceil)
    x1 = $game_map.round_x(x)
    y1 = $game_map.round_y(y)
    return false unless $game_map.valid?(x1, y1)
    return true if @through || debug_through?
    return false unless map_passable?(x1, y1, d)
    return false unless map_passable?(x1, y1, d2) || !ceil
    return false unless map_passable?(x1, y1, reverse_dir(d))
    return true
  end
  #--------------------------------------------------------------------------
  # * New method: enter_vechicle?
  #--------------------------------------------------------------------------
  def enter_vechicle?(x, y, d)
    return false if @map_id != $game_map.map_id
    x2 = $game_map.round_x_with_direction(x, d)
    y2 = $game_map.round_y_with_direction(y, d)
    x3 = $game_map.check_x_with_direction(@x, reverse_dir(d))
    y3 = $game_map.check_y_with_direction(@y, reverse_dir(d))
    ( above? && collision?(x, y - 0.125, bw * 0.75, bh * 0.75)) ||
    (!above? && collision?(x2, y2, bw, bh) && map_passable?(x3, y3, d))
  end
  #--------------------------------------------------------------------------
  # * New method: collision_condition?
  #--------------------------------------------------------------------------
  def collision_condition?(x, y, bw, bh, player)
    return false if step_over? 
    return false if player.player? && self == player.vehicle
    return false if !collision?(x, y, bw, bh) 
    return true
  end
end



Je ne peux pas mettre celui des diagonales il y a pas assez de place ^^


arttroy - posté le 14/04/2013 à 13:57:05 (2394 messages postés)

❤ 0

Just working

Met le en deux parties :clindoeil2 (ou plus si besoin...)

Anti-inconstructivité / Pétition pour que le mot making soit inscrit dans le dictionnaire ?


Cortez - posté le 14/04/2013 à 14:03:41 (523 messages postés)

❤ 0

C'est simple pourtant, le script ne fonctionne pas sans quelques réglages.

Dans chaque évènements de ton jeu qui doit interagir avec le héro, tu places ceci <event size: 32, 32> dans la zone "note".

Cela permet de donner une "taille" en pixel à la zone d'interaction avec les évènements. Pour l'exemple j'ai mis 32 pixels, comme dans un jeu normal, mais tu peux mettre moins ou plus.
Il faut juste que tu respectes la syntaxe suivante :
<event size: x, y>
x : Largeur de la zone
y : hauteur de la zone


yruama69 - posté le 14/04/2013 à 16:33:07 (7 messages postés)

❤ 0

Je pouvais pas c'est juste qu'il y avait trop de caractere donc ca coupe le code pour tenir dans le post et je pouvais pas faire de double post, enfin voila la suite :

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
#==============================================================================
# ** Victor Engine - Diagonal Movement
#------------------------------------------------------------------------------
# Author : Victor Sant
#
# Version History:
#  v 1.00 - 2011.12.23 > First release
#  v 1.01 - 2011.12.30 > Fixed sync with vehicle
#  v 1.02 - 2012.01.01 > New comment tags
#  v 1.03 - 2012.01.04 > Compatibility with Character Control
#  v 1.04 - 2012.01.04 > Compatibility with Follower Control
#  v 1.05 - 2012.05.29 > Compatibility with Pixel Movement
#  v 1.06 - 2012.07.25 > Fixed Compatibility with Visual Equip and
#                      > Character Control
#  v 1.07 - 2012.07.30 > Fixed diagonal movement speed
#  v 1.08 - 2012.08.04 > Added option for fixing blocked movement
#  v 1.09 - 2013.01.24 > Fixed issue with pixel movement and VE_DIAGONAL_FIX
#------------------------------------------------------------------------------
#  This script allows to set diagonal movement for the player and events.
# This feature is opitional for events. It's possible to have different
# graphic for the diagonal movement
#------------------------------------------------------------------------------
# Compatibility
#   Requires the script 'Victor Engine - Basic Module' v 1.16 or higher
#   If used with 'Victor Engine - Multi Frames' place this bellow it.
#   If used with 'Victor Engine - Pixel Movement' place this bellow it.
#   If used with 'Victor Engine - Visual Equip' place this bellow it.
# 
# * Alias methods (Default)
#   class Game_CharacterBase
#     def init_public_members
#     def move_straight(d, turn_ok = true)
#     def move_diagonal(horz, vert)
#
#   class Game_Character < Game_CharacterBase
#     def move_random
#     def move_toward_character(character)
#     def move_away_from_character(character)
#     def turn_toward_character(character)
#     def turn_away_from_character(character)
#     def move_forward
#
#   class Game_Event < Game_Character
#     def clear_page_settings
#     def setup_page_settings
#
#   class Game_Player < Game_Character
#     def initialize
#     def move_by_input
#
#   class Game_Vehicle < Game_Character
#     def sync_with_player
#
#   class Sprite_Character < Sprite_Base
#     def graphic_changed?
#     def update_src_rect
#
# * Alias methods (Basic Module)
#   class Game_Character < Game_CharacterBase
#     def move_toward_position(x, y)
#
#   class Game_Interpreter
#     def comment_call
#
#------------------------------------------------------------------------------
# Instructions:
#  To instal the script, open you script editor and paste this script on
#  a new section bellow the Materials section. This script must also
#  be bellow the scripts 'Victor Engine - Basic' and 
#  'Victor Engine - Multi Frames'.
#
#------------------------------------------------------------------------------
# Comment calls note tags:
#  Tags to be used in events comment box, works like a script call.
#
#  <actor diagonal on> 
#  <actor diagonal off>
#   These tags allows to turn the diagonal on or off for the player.
#
#  <event i diagonal on> 
#  <event i diagonal off>
#   These tags allows to turn the diagonal on or off for events.
#     i : event ID
#
#------------------------------------------------------------------------------
# Comment boxes note tags:
#   Tags to be used on events Comment boxes. They're different from the
#   comment call, they're called always the even refresh.
#
#  <diagonal move>
#    This tag allows the diagonal move for events if VE_DIAGONAL_EVENTS = false
#    It enables the diagonal move only for the page where the comment
#    is located
#
#  <block diagonal>
#    This tag disable the diagonal move for events if VE_DIAGONAL_EVENTS = true
#    It disable the diagonal move only for the page where the comment
#    is located
#
#------------------------------------------------------------------------------
# Additional instructions:
#
#  To add custom graphic for diagonal movement, you must have a graphic
#  with the sufix set on VE_DIAGONAL_SUFIX added to it's name, by default
#  this sufix is "[diag]", so you must have a file named "CharName[diag]"
#  for a chaset named "CharName". If the diagonal file doesn't exist, it 
#  will use the normal graphic.
#
#==============================================================================
 
#==============================================================================
# ** Victor Engine
#------------------------------------------------------------------------------
#   Setting module for the Victor Engine
#==============================================================================
 
module Victor_Engine
  #--------------------------------------------------------------------------
  # * Diagonal graphic sufix
  #    Sufix added to the names of diagonal movement graphics.
  #--------------------------------------------------------------------------
  VE_DIAGONAL_SUFIX = "[diag]"
  #--------------------------------------------------------------------------
  # * Set diagonal movement for events
  #    If true, automatically all events will have diagonal movement
  #    If false, you must add the diagonal movement manually by adding the
  #    comment tag for diagonal move on it.
  #--------------------------------------------------------------------------
  VE_DIAGONAL_EVENTS = false 
  #--------------------------------------------------------------------------
  # * Fix blocked diagonal movement
  #   If true, when the diagonal movement is blocked, then the character
  #   moves straight to the direction not blocked.
  #--------------------------------------------------------------------------
  VE_DIAGONAL_FIX = false
  #--------------------------------------------------------------------------
  # * required
  #   This method checks for the existance of the basic module and other
  #   VE scripts required for this script to work, don't edit this
  #--------------------------------------------------------------------------
  def self.required(name, req, version, type = nil)
    if !$imported[:ve_basic_module]
      msg = "The script '%s' requires the script\n"
      msg += "'VE - Basic Module' v%s or higher above it to work properly\n"
      msg += "Go to http://victorscripts.wordpress.com/ to download this script."
      msgbox(sprintf(msg, self.script_name(name), version))
      exit
    else
      self.required_script(name, req, version, type)
    end
  end
  #--------------------------------------------------------------------------
  # * script_name
  #   Get the script name base on the imported value, don't edit this
  #--------------------------------------------------------------------------
  def self.script_name(name, ext = "VE")
    name = name.to_s.gsub("_", " ").upcase.split
    name.collect! {|char| char == ext ? "#{char} -" : char.capitalize }
    name.join(" ")
  end
end
 
$imported ||= {}
$imported[:ve_diagonal_move] = 1.09
Victor_Engine.required(:ve_diagonal_move, :ve_basic_module, 1.16, :above)
Victor_Engine.required(:ve_diagonal_move, :ve_character_control, 1.10, :bellow)
 
#==============================================================================
# ** Game_CharacterBase
#------------------------------------------------------------------------------
#  This class deals with characters. Common to all characters, stores basic
# data, such as coordinates and graphics. It's used as a superclass of the
# Game_Character class.
#==============================================================================
 
class Game_CharacterBase
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :diagonal
  #--------------------------------------------------------------------------
  # * Alias method: init_public_members
  #--------------------------------------------------------------------------
  alias :init_public_members_ve_diagonal_move :init_public_members
  def init_public_members
    init_public_members_ve_diagonal_move
    @diagonal = 0
  end
  #--------------------------------------------------------------------------
  # * Alias method: move_straight
  #--------------------------------------------------------------------------
  alias :move_straight_ve_diagonal_move :move_straight
  def move_straight(d, turn_ok = true)
    @diagonal = 0
    move_straight_ve_diagonal_move(d, turn_ok)
  end
  #--------------------------------------------------------------------------
  # * Alias method: move_diagonal
  #--------------------------------------------------------------------------
  alias :move_diagonal_ve_diagonal_move :move_diagonal
  def move_diagonal(horz, vert)
    @diagonal = 1 if diagonal_enabled? && horz == 4 && vert == 2
    @diagonal = 3 if diagonal_enabled? && horz == 6 && vert == 2
    @diagonal = 7 if diagonal_enabled? && horz == 4 && vert == 8
    @diagonal = 9 if diagonal_enabled? && horz == 6 && vert == 8
    move_diagonal_ve_diagonal_move(horz, vert)
    diagonal_direction if diagonal_enabled?
  end
  #--------------------------------------------------------------------------
  # * Alias method: distance_per_frame
  #--------------------------------------------------------------------------
  alias :distance_per_frame_ve_diagonal_move :distance_per_frame
  def distance_per_frame
    distance = distance_per_frame_ve_diagonal_move
    diagonal? ? distance / Math.sqrt(2) : distance
  end
  #--------------------------------------------------------------------------
  # * New method: diagonal_enabled?
  #--------------------------------------------------------------------------
  def diagonal_enabled?
    @diagonal_enabled
  end
  #--------------------------------------------------------------------------
  # * New method: diagonal?
  #--------------------------------------------------------------------------
  def diagonal?
    @diagonal && @diagonal != 0 
  end
end
 
#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass of the
# Game_Player and Game_Event classes.
#==============================================================================
 
class Game_Character < Game_CharacterBase
  #--------------------------------------------------------------------------
  # * Alias method: move_random
  #--------------------------------------------------------------------------
  alias :move_random_ve_diagonal_move :move_random
  def move_random
    if diagonal_enabled? && rand(2) == 0
      horz = [4, 6].random
      vert = [2, 8].random
      move_diagonal(horz, vert)
    else
      move_random_ve_diagonal_move
    end
  end
  #--------------------------------------------------------------------------
  # * Alias method: move_toward_character
  #--------------------------------------------------------------------------
  alias :move_toward_character_ve_diagonal_move :move_toward_character
  def move_toward_character(character)
    sx = distance_x_from(character.x)
    sy = distance_y_from(character.y)
    horz = sx > 0 ? 4 : 6
    vert = sy > 0 ? 8 : 2
    if diagonal_enabled? && sx != 0 && sy != 0 && 
       diagonal_passable?(x, y, horz, vert)
      move_diagonal(horz, vert)
    else
      move_toward_character_ve_diagonal_move(character)
    end
  end
  #--------------------------------------------------------------------------
  # * New method: move_toward_position
  #--------------------------------------------------------------------------
  alias :move_toward_position_ve_diagonal_move :move_toward_position
  def move_toward_position(x, y)
    sx = distance_x_from(x)
    sy = distance_y_from(y)
    horz = sx > 0 ? 4 : 6
    vert = sy > 0 ? 8 : 2
    if diagonal_enabled? && sx != 0 && sy != 0 && 
       diagonal_passable?(x, y, horz, vert)
      move_diagonal(horz, vert)
    else
      move_toward_position_ve_diagonal_move(x, y)
    end
  end
  #--------------------------------------------------------------------------
  # * Alias method: move_away_from_character
  #--------------------------------------------------------------------------
  alias :move_away_from_character_ve_diagonal_move :move_away_from_character
  def move_away_from_character(character)
    sx = distance_x_from(character.x)
    sy = distance_y_from(character.y)
    horz = sx > 0 ? 6 : 4
    vert = sy > 0 ? 2 : 8
    if diagonal_enabled? && sx != 0 && sy != 0 && 
       diagonal_passable?(x, y, horz, vert)
      move_diagonal(horz, vert)
    else
      move_away_from_character_ve_diagonal_move(character)
    end
  end
  #--------------------------------------------------------------------------
  # * Alias method: turn_toward_character
  #--------------------------------------------------------------------------
  alias :turn_toward_character_ve_diagonal_move :turn_toward_character
  def turn_toward_character(character)
    sx = distance_x_from(character.x)
    sy = distance_y_from(character.y)
    if diagonal_enabled? && sx != 0 && sy != 0
      @diagonal = 1 if sx > 0 && sy < 0
      @diagonal = 3 if sx < 0 && sy < 0
      @diagonal = 7 if sx > 0 && sy > 0
      @diagonal = 9 if sx < 0 && sy > 0
      diagonal_direction
    else
      @diagonal = 0
      turn_toward_character_ve_diagonal_move(character)
    end
  end
  #--------------------------------------------------------------------------
  # * Alias method: turn_away_from_character
  #--------------------------------------------------------------------------
  alias :turn_away_from_character_ve_diagonal_move :turn_away_from_character
  def turn_away_from_character(character)
    sx = distance_x_from(character.x)
    sy = distance_y_from(character.y)
    if diagonal_enabled? && sx != 0 && sy != 0
      @diagonal = 1 if sx < 0 && sy > 0
      @diagonal = 3 if sx > 0 && sy > 0
      @diagonal = 7 if sx < 0 && sy < 0
      @diagonal = 9 if sx > 0 && sy < 0
      diagonal_direction
    else
      @diagonal = 0
      turn_away_from_character_ve_diagonal_move(character)
    end
  end
  #--------------------------------------------------------------------------
  # * Alias method: update_move_straight
  #--------------------------------------------------------------------------
  alias :update_move_straight_ve_diagonal_move :update_move_straight if $imported[:ve_pixel_movement]
  def update_move_straight
    update_move_straight_ve_diagonal_move
    diagonal_move_fix_pixel(@move_value[:d].first) if player? && @move_value
  end
  #--------------------------------------------------------------------------
  # * Alias method: update_move_diagonal
  #--------------------------------------------------------------------------
  alias :update_move_diagonal_ve_diagonal_move :update_move_diagonal if $imported[:ve_pixel_movement]
  def update_move_diagonal
    update_move_diagonal_ve_diagonal_move
    if player? && @move_value
      d = 1 if @move_value[:d] == [4, 2]
      d = 3 if @move_value[:d] == [6, 2]
      d = 7 if @move_value[:d] == [4, 8]
      d = 9 if @move_value[:d] == [6, 8]
      diagonal_move_fix_pixel(d)
    end
  end
  #--------------------------------------------------------------------------
  # * Alias method: move_forward
  #--------------------------------------------------------------------------
  alias :move_forward_ve_diagonal_move :move_forward
  def move_forward
    if diagonal?
      diagonal_movement(@diagonal)
      diagonal_move_fix(@diagonal) if need_fix?
    else
      move_forward_ve_diagonal_move
    end
  end
  #--------------------------------------------------------------------------
  # * New method: need_fix?
  #--------------------------------------------------------------------------
  def need_fix?
    (!moving? && !$imported[:ve_pixel_movement]) && VE_DIAGONAL_FIX
  end
  #--------------------------------------------------------------------------
  # * New method: diagonal_movement
  #--------------------------------------------------------------------------
  def diagonal_movement(d)
    case d
    when 1 then move_diagonal(4, 2)
    when 3 then move_diagonal(6, 2)
    when 7 then move_diagonal(4, 8)
    when 9 then move_diagonal(6, 8)
    end
  end
  #--------------------------------------------------------------------------
  # * New method: diagonal_move_fix
  #--------------------------------------------------------------------------
  def diagonal_move_fix(d)
    @diagonal = nil
    case d
    when 1 then move_straight(4);  move_straight(2) if !moving?
    when 3 then move_straight(6);  move_straight(2) if !moving?
    when 7 then move_straight(4);  move_straight(8) if !moving?
    when 9 then move_straight(6);  move_straight(8) if !moving?
    end
  end
  #--------------------------------------------------------------------------
  # * New method: set_diagonal_direction
  #--------------------------------------------------------------------------
  def diagonal_direction
    set_direction(2) if @diagonal == 1
    set_direction(4) if @diagonal == 7
    set_direction(6) if @diagonal == 3
    set_direction(8) if @diagonal == 9
  end
  #--------------------------------------------------------------------------
  # * New method: diagonal_move_fix
  #--------------------------------------------------------------------------
  def diagonal_move_fix_pixel(d)
    case d
    when 1 then perform_move_fix_pixel(4, 2)
    when 3 then perform_move_fix_pixel(6, 2)
    when 7 then perform_move_fix_pixel(4, 8)
    when 9 then perform_move_fix_pixel(6, 8)
    end
  end
  #--------------------------------------------------------------------------
  # * New method: diagonal_move_fix
  #--------------------------------------------------------------------------
  def perform_move_fix_pixel(horz, vert)
    return if @moved || moving?
    @move_value = nil
    @diagonal   = nil
    set_direction(horz)       if passable?(@x, @y, horz) && !@moved
    move_straight_pixel(horz) if passable?(@x, @y, horz) && !@moved
    set_direction(vert)       if passable?(@x, @y, vert) && !@moved
    move_straight_pixel(vert) if passable?(@x, @y, vert) && !@moved
  end
end
 
#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  This class deals with events. It handles functions including event page 
# switching via condition determinants, and running parallel process events.
# It's used within the Game_Map class.
#==============================================================================
 
class Game_Event < Game_Character
  #--------------------------------------------------------------------------
  # * Alias method: clear_page_settings
  #--------------------------------------------------------------------------
  alias :clear_page_settings_ve_diagonal_move :clear_page_settings
  def clear_page_settings
    clear_page_settings_ve_diagonal_move
    @diagonal_enabled = false
  end
  #--------------------------------------------------------------------------
  # * Alias method: setup_page_settings
  #--------------------------------------------------------------------------
  alias :setup_page_settings_ve_diagonal_move :setup_page_settings
  def setup_page_settings
    setup_page_settings_ve_diagonal_move
    @diagonal_enabled =  VE_DIAGONAL_EVENTS || note =~ /<DIAGONAL MOVE>/i
    @diagonal_enabled =  false if note =~ /<BLOCK DIAGONAL>/i
  end
end
 
#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
#  This class handles maps. It includes event starting determinants and map
# scrolling functions. The instance of this class is referenced by $game_map.
#==============================================================================
 
class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * Alias method: initialize
  #--------------------------------------------------------------------------
  alias :initialize_ve_diagonal_move :initialize
  def initialize
    initialize_ve_diagonal_move
    diagonal_on
  end
  #--------------------------------------------------------------------------
  # * Alias method: move_by_input
  #--------------------------------------------------------------------------
  alias :move_by_input_ve_diagonal_move :move_by_input
  def move_by_input
    return if !movable? || $game_map.interpreter.running?
    if diagonal_enabled? && Input.dir8 > 0 && Input.dir8 % 2 != 0
      diagonal_movement(Input.dir8) 
      diagonal_move_fix(Input.dir8) if need_fix?
    else
      move_by_input_ve_diagonal_move
    end
  end
  #--------------------------------------------------------------------------
  # * New method: diagonal_on
  #--------------------------------------------------------------------------
  def diagonal_on
    @diagonal_enabled = true
    @followers.diagonal_on
  end
  #--------------------------------------------------------------------------
  # * New method: diagonal_off
  #--------------------------------------------------------------------------
  def diagonal_off
    @diagonal_enabled = false
    @followers.diagonal_off
  end
end
 
#==============================================================================
# ** Game_Follower
#------------------------------------------------------------------------------
#  This class handles the followers. Followers are the actors of the party
# that follows the leader in a line. It's used within the Game_Followers class.
#==============================================================================
 
class Game_Follower < Game_Character
  #--------------------------------------------------------------------------
  # * Alias method: distance_per_frame
  #--------------------------------------------------------------------------
  alias :distance_per_frame_ve_diagonal_move :distance_per_frame
  def distance_per_frame
    distance = 2 ** real_move_speed / 256.0
    $game_player.diagonal? ? distance / Math.sqrt(2) : distance
  end
  #--------------------------------------------------------------------------
  # * New method: diagonal_on
  #--------------------------------------------------------------------------
  def diagonal_on
    @diagonal_enabled = true
  end
  #--------------------------------------------------------------------------
  # * New method: diagonal_off
  #--------------------------------------------------------------------------
  def diagonal_off
    @diagonal_enabled = false
  end
end
 
#==============================================================================
# ** Game_Followers
#------------------------------------------------------------------------------
#  This class handles the followers. It's a wrapper for the built-in class
# "Array." It's used within the Game_Player class.
#==============================================================================
 
class Game_Followers
  #--------------------------------------------------------------------------
  # * New method: diagonal_on
  #--------------------------------------------------------------------------
  def diagonal_on
    each {|follower| follower.diagonal_on }
  end
  #--------------------------------------------------------------------------
  # * New method: diagonal_off
  #--------------------------------------------------------------------------
  def diagonal_off
    each {|follower| follower.diagonal_off }
  end
end
 
#==============================================================================
# ** Game_Vehicle
#------------------------------------------------------------------------------
#  Esta classe gerencia veículos. Se não houver veículos no mapa atual, a
# coordenada é definida como (-1,-1).
# Esta classe é usada internamente pela classe Game_Map. 
#==============================================================================
 
class Game_Vehicle < Game_Character
  #--------------------------------------------------------------------------
  # * Alias method: sync_with_player
  #--------------------------------------------------------------------------
  alias :sync_with_player_ve_diagonal_move :sync_with_player
  def sync_with_player
    sync_with_player_ve_diagonal_move
    @diagonal = $game_player.diagonal
    diagonal_direction
  end
end
 
#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
#  This sprite is used to display characters. It observes a instance of the
# Game_Character class and automatically changes sprite conditions.
#==============================================================================
 
class Sprite_Character < Sprite_Base
  #--------------------------------------------------------------------------
  # * Alias method: graphic_changed?
  #--------------------------------------------------------------------------
  alias :graphic_changed_ve_diagonal_move :graphic_changed?
  def graphic_changed?
    graphic_changed_ve_diagonal_move ||
    @diagonal != @character.diagonal
  end
  #--------------------------------------------------------------------------
  # * New method: update_character_info
  #--------------------------------------------------------------------------
  alias :update_character_info_ve_diagonal_move :update_character_info
  def update_character_info
    update_character_info_ve_diagonal_move
    @diagonal = @character.diagonal
  end
  #--------------------------------------------------------------------------
  # * Alias method: update_src_rect
  #--------------------------------------------------------------------------
  alias :update_src_rect_ve_diagonal_move :update_src_rect
  def update_src_rect
    if @tile_id == 0 && @character.diagonal?
      update_diagonal_src_rect
    else
      update_src_rect_ve_diagonal_move
    end
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: set_character_diagonal_bitmap
  #--------------------------------------------------------------------------
  alias :set_bitmap_name_ve_diagonal_move :set_bitmap_name
  def set_bitmap_name
    name = @character_name + ($imported[:ve_visual_equip] ? "" : diagonal_sufix)
    character_exist?(name) ? name : set_bitmap_name_ve_diagonal_move
  end
  #--------------------------------------------------------------------------
  # * New method: diagonal_sufix
  #--------------------------------------------------------------------------
  def diagonal_sufix
    @character.diagonal? ? VE_DIAGONAL_SUFIX : ""
  end
  #--------------------------------------------------------------------------
  # * New method: update_diagonal_src_rect
  #--------------------------------------------------------------------------
  def update_diagonal_src_rect
    dir = 0 if @diagonal == 1
    dir = 1 if @diagonal == 7
    dir = 2 if @diagonal == 3
    dir = 3 if @diagonal == 9
    index = @character.character_index
    if $imported[:ve_multi_frames] && @character_name[/\[F(\d+)\]/i]
      pattern = @character.pattern
    else
      pattern = @character.pattern < 3 ? @character.pattern : 1
    end
    sx = (index % 4 * @character.frames + pattern) * @cw
    sy = (index / 4 * 4 + dir) * @ch
    self.src_rect.set(sx, sy, @cw, @ch)
  end
end
 
#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
#  An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================
 
class Game_Interpreter
  #--------------------------------------------------------------------------
  # * Alias method: comment_call
  #--------------------------------------------------------------------------
  alias :comment_call_ve_diagonal_move :comment_call
  def comment_call
    call_change_actor_diagonal
    call_change_event_diagonal
    comment_call_ve_diagonal_move
  end  
  #--------------------------------------------------------------------------
  # * New method: call_change_actor_diagonal
  #--------------------------------------------------------------------------
  def call_change_actor_diagonal
    if note =~ /<ACTOR DIAGONAL (ON|OFF)>/i
      $game_player.diagonal_off if $1.upcase == "OFF"
      $game_player.diagonal_on  if $1.upcase == "ON"
    end
  end 
  #--------------------------------------------------------------------------
  # * New method: call_change_event_diagonal
  #--------------------------------------------------------------------------
  def call_change_event_diagonal
    if note =~ /<EVENT (\d+) DIAGONAL (ON|OFF)>/i
      $game_map.events[$1.to_i].diagonal_off if $2.upcase == "OFF"
      $game_map.events[$1.to_i].diagonal_on  if $2.upcase == "ON"
    end
  end
end




arttroy - posté le 15/04/2013 à 11:56:03 (2394 messages postés)

❤ 0

Just working

Essaies avec ce qu'a mis cortez en théorie ça devrait fonctionner, ensuite prends garde à ne pas créer de map trop grandes, le script ne fonctionnerait plus (enfin sur la map trop grande seulement).

Anti-inconstructivité / Pétition pour que le mot making soit inscrit dans le dictionnaire ?


yruama69 - posté le 15/04/2013 à 12:48:38 (7 messages postés)

❤ 0

C'est bon j'ai eu une solution d'autre source un peu du style de cortez mais en commentaire il faut mettre : <over tile>


merci :)


arttroy - posté le 15/04/2013 à 14:38:04 (2394 messages postés)

❤ 0

Just working

Cool ! Tu vois je te l'avais bien dit, une fois que tu formules les choses correctement, les réponses arrivent assez facilement. Maintenant tu n'as plus qu'à changer le titre du topic en rajoutant "résolu" devant le titre et voilà !

Tu verras ils sont plutôt cool et aident régulièrement par ici pourvu que tu y mette les formes :clindoeil3.

Anti-inconstructivité / Pétition pour que le mot making soit inscrit dans le dictionnaire ?


yruama69 - posté le 15/04/2013 à 18:14:03 (7 messages postés)

❤ 0

Ouai enfin c'edst estheone qui m'a rep par MP :p


arttroy - posté le 15/04/2013 à 20:44:44 (2394 messages postés)

❤ 0

Just working

Ah ah !! Si le Sensei te répond écoutes bien ses enseignements petit scarabée et des progrès prodigieux tu feras :lei

Anti-inconstructivité / Pétition pour que le mot making soit inscrit dans le dictionnaire ?

Index du forum > Entraide > [RESOLU] [Vx ace] Deplacement pixel par pixel & evenement

repondre up

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