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

Sorties: "Dread Mac Farlane", (...) / Tutos: Checklist de la composition (...) / Sorties: Dread Mac Farlane - episode 8 / Sorties: Dread Mac Farlane - episode 7 / Jeux: Ce qui vit Dessous / Chat

Bienvenue
visiteur !




publicité RPG Maker!

Statistiques

Liste des
membres


Contact

Mentions légales

575 connectés actuellement

29438714 visiteurs
depuis l'ouverture

4792 visiteurs
aujourd'hui



Barre de séparation

Partenaires

Indiexpo

Akademiya RPG Maker

Blog Alioune Fall

Fairy Tail Constellations

Le Temple de Valor

RPG Maker - La Communauté

RPG Fusion

Eclipso

Tous nos partenaires

Devenir
partenaire



forums

Index du forum > Entraide > [RPG Maker XP] Deux déplacements [Résolu]


Kreiss - posté le 04/02/2016 à 17:09:14 (46 messages postés)

❤ 0

Domaine concerné: Script
Logiciel utilisé: RPG Maker XP
Bonjour.
J'ai encore un problème avec un script que j'ai modifié. (Que je n'arrive plus à modifier...)
Je vous explique en image :
image

Comme vous pouvez le voir, le script gère très bien les déplacements en isométrie.
Mais hélas j'ai du sacrifié les déplacements en diagonal...

Je me demande si c'est possible qu'on m'ajoute les déplacements en diagonal avec une condition d'activation.
Par exemple... si l’interrupteur [0001] est activé, on active les déplacements diagonal. (ligne vert)
Si l’interrupteur [0001] est désactivé, on laisse les déplacements normaux/isométrique. (ligne rouge)

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
#---------------------------------------------------------------------------------
# SUPER WALK 1.2b + Déplacements isométriques
#---------------------------------------------------------------------------------
# Script créé par Zeus81
# Modifié par Kreiss
#---------------------------------------------------------------------------------
 
class Game_Player
 SUPER_WALK_SWITCH = 130 # id de l'interrupteur pour activer/désactiver le script
end
 
class Game_Character
 
 alias super_walk_game_character_initialize initialize
 def initialize
   @x2 = @y2 = 0
   super_walk_game_character_initialize
 end
 
 def super_walk_distance
   @move_speed > 4 ? @move_speed > 5 ? 0.5 : 0.25 : 0.125
 end
 
 def moving?
   @real_x != @x2*128 or @real_y != @y2*128
 end
 
 def passable?(x, y, d)
   new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
   new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
   return false unless $game_map.valid?(new_x, new_y)
   return true  if @through
   return false unless $game_map.passable?(x, y, d, self)
   return false unless $game_map.passable?(new_x, new_y, 10-d)
   $game_map.events.each_value do |event|
     return false if event.x == new_x and event.y == new_y and !event.through and
                     (self != $game_player or !event.character_name.empty?)
   end
   return false if $game_player.x == new_x and $game_player.y == new_y and
                   !$game_player.through and !@character_name.empty?
   return true
 end
 
 def moveto(x, y)
   @x = @x2 = x % $game_map.width
   @y = @y2 = y % $game_map.height
   @real_x = @x * 128
   @real_y = @y * 128
   @prelock_direction = 0
 end
 
 def update_jump
   @jump_count -= 1
   @real_x = (@real_x * @jump_count + @x2 * 128) / (@jump_count + 1)
   @real_y = (@real_y * @jump_count + @y2 * 128) / (@jump_count + 1)
 end
 
 def update_move
   x128, y128, distance = @x2*128, @y2*128, 2**@move_speed
   if    x128 < @real_x; @real_x = [@real_x-distance*2, x128].max
   elsif x128 > @real_x; @real_x = [@real_x+distance*2, x128].min
   end
   if    y128 < @real_y; @real_y = [@real_y-distance, y128].max
   elsif y128 > @real_y; @real_y = [@real_y+distance, y128].min
   end
   if    @walk_anime; @anime_count += 1.5
   elsif @step_anime; @anime_count += 1
   end
 end
 
 def move_down(turn_enabled=true, super_walk=false)
   turn_down if turn_enabled
   if passable?(@x, @y, 2)
     turn_down
     if super_walk
       @x2 -= 0.125 if @x2 > @x and !passable?(@x+1, @y, 2)
       @x2 += 0.125 if @x2 < @x and !passable?(@x-1, @y, 2)
       @y2 += super_walk_distance
       @y = @y2.round
     else @y2 = @y += 1
     end
     increase_steps
   elsif @y2 < @y
     @y2 += 0.125
   else
     check_event_trigger_touch(@x, @y+1)
     return false
   end
   return true
 end
 
 def move_left(turn_enabled=true, super_walk=false)
   turn_left if turn_enabled
   if passable?(@x, @y, 4)
     turn_left
     if super_walk
       @y2 -= 0.125 if @y2 > @y and !passable?(@x, @y+1, 4)
       @y2 += 0.125 if @y2 < @y and !passable?(@x, @y-1, 4)
       @x2 -= super_walk_distance
       @x = @x2.round
     else @x2 = @x -= 1
     end
     increase_steps
   elsif @x2 > @x
     @x2 -= 0.125
   else
     check_event_trigger_touch(@x-1, @y)
     return false
   end
   return true
 end
 
 def move_right(turn_enabled=true, super_walk=false)
   turn_right if turn_enabled
   if passable?(@x, @y, 6)
     turn_right
     if super_walk
       @y2 -= 0.125 if @y2 > @y and !passable?(@x, @y+1, 6)
       @y2 += 0.125 if @y2 < @y and !passable?(@x, @y-1, 6)
       @x2 += super_walk_distance
       @x = @x2.round
     else @x2 = @x += 1
     end
     increase_steps
   elsif @x2 < @x
     @x2 += 0.125
   else
     check_event_trigger_touch(@x+1, @y)
     return false
   end
   return true
 end
 
 def move_up(turn_enabled=true, super_walk=false)
   turn_up if turn_enabled
   if passable?(@x, @y, 
     turn_up
     if super_walk
       @x2 -= 0.125 if @x2 > @x and !passable?(@x+1, @y, 
       @x2 += 0.125 if @x2 < @x and !passable?(@x-1, @y, 
       @y2 -= super_walk_distance
       @y = @y2.round
     else @y2 = @y -= 1
     end
     increase_steps
   elsif @y2 > @y
     @y2 -= 0.125
   else
     check_event_trigger_touch(@x, @y-1)
     return false
   end
   return true
 end
#--------------------------------------------------------------------------
# Move Lower Left
#--------------------------------------------------------------------------
 def move_lower_left(turn_enabled=true, super_walk=false)
   last_dir = @direction
   move1 = move_down(false, super_walk)
   move2 = move_left(false, super_walk)
   move_left(false, super_walk)
   if !@direction_fix and turn_enabled ? move1 == move2 : move1 && move2
     @direction = last_dir == 6 ? 4 : last_dir == 8 ? 2 : last_dir
     @stop_count = 0
   end
   return move1 || move2
 end
#--------------------------------------------------------------------------
# Move Lower Right
#--------------------------------------------------------------------------
 def move_lower_right(turn_enabled=true, super_walk=false)
   last_dir = @direction
   move1 = move_down( false, super_walk)
   move2 = move_right(false, super_walk)
   move_right(false, super_walk)
   if !@direction_fix and turn_enabled ? move1 == move2 : move1 && move2
     @direction = last_dir == 4 ? 6 : last_dir == 8 ? 2 : last_dir
     @stop_count = 0
   end
   return move1 || move2
 end
#--------------------------------------------------------------------------
# Move Upper Left
#--------------------------------------------------------------------------
 def move_upper_left(turn_enabled=true, super_walk=false)
   last_dir = @direction
   move1 = move_up(  false, super_walk)
   move2 = move_left(false, super_walk)
   move_left(false, super_walk)
   if !@direction_fix and turn_enabled ? move1 == move2 : move1 && move2
     @direction = last_dir == 6 ? 4 : last_dir == 2 ? 8 : last_dir
     @stop_count = 0
   end
   return move1 || move2
 end
#--------------------------------------------------------------------------
# Move Upper Right
#--------------------------------------------------------------------------
 def move_upper_right(turn_enabled=true, super_walk=false)
   last_dir = @direction
   move1 = move_up(  false, super_walk)
   move2 = move_right(false, super_walk)
   move_right(false, super_walk)
   if !@direction_fix and turn_enabled ? move1 == move2 : move1 && move2
     @direction = last_dir == 4 ? 6 : last_dir == 2 ? 8 : last_dir
     @stop_count = 0
   end
   return move1 || move2
 end
#--------------------------------------------------------------------------
 def move_random
   case rand(8)
   when 0; move_lower_left
   when 1; move_down
   when 2; move_lower_right
   when 3; move_left
   when 4; move_upper_left
   when 5; move_right
   when 6; move_upper_right
   when 7; move_up
   end
 end
 
 def jump(x_plus, y_plus)
   loop do
     if (x_plus == 0 and y_plus == 0) or passable?(@x+x_plus, @y+y_plus, 0)
       if x_plus.abs > y_plus.abs
           x_plus < 0 ? turn_left : turn_right
       else y_plus < 0 ? turn_up  : turn_down
       end unless x_plus == 0 and y_plus == 0
       straighten
       @x  += x_plus
       @x2 += x_plus
       @y  += y_plus
       @y2 += y_plus
       @jump_peak = 10 - @move_speed + Math.hypot(x_plus, y_plus).round
       @jump_count = @jump_peak * 2
       @stop_count = 0
       return
     end
     x_plus -= 1 if x_plus > 0
     x_plus += 1 if x_plus < 0
     y_plus -= 1 if y_plus > 0
     y_plus += 1 if y_plus < 0
   end
 end
 
end
 
 
class Game_Player
 
 def update
   last_x, last_y, last_rx, last_ry = @x, @y, @real_x, @real_y
   super_walk = $game_switches[SUPER_WALK_SWITCH]
   unless last_moving = moving? or @move_route_forcing or
         $game_temp.message_window_showing or
         $game_system.map_interpreter.running?
     case Input.dir8
     when 1; move_lower_left( true, super_walk)
     when 2; move_down(      true, super_walk)
     when 3; move_lower_right(true, super_walk)
     when 4; move_left(      true, super_walk)
     when 6; move_right(      true, super_walk)
     when 7; move_upper_left( true, super_walk)
     when 8; move_up(        true, super_walk)
     when 9; move_upper_right(true, super_walk)
     end
   end
   last_moving = last_x != @x || last_y != @y if super_walk
   super
   $game_map.scroll_left(last_rx-@real_x)  if @real_x < last_rx and @real_x-$game_map.display_x < CENTER_X
   $game_map.scroll_right(@real_x-last_rx) if @real_x > last_rx and @real_x-$game_map.display_x > CENTER_X
   $game_map.scroll_up(last_ry-@real_y)    if @real_y < last_ry and @real_y-$game_map.display_y < CENTER_Y
   $game_map.scroll_down(@real_y-last_ry)  if @real_y > last_ry and @real_y-$game_map.display_y > CENTER_Y
   unless moving?
     if last_moving and !check_event_trigger_here([1,2])
       if @encounter_count > 0 and !($DEBUG and Input.press?(Input::CTRL))
         @encounter_count -= 1
       end
     end
     if Input.trigger?(Input::C)
       check_event_trigger_here([0])
       check_event_trigger_there([0,1,2])
     end
   end
 end
end



Ça aiderait énormément le projet à avoir des déplacements plus fluide.
Merci d'avance !


arttroy - posté le 04/02/2016 à 17:12:52 (2394 messages postés)

❤ 0

Just working

Ligne 9 tu as un interrupteur (130) qui permet d'activer/désactiver le script donc j'imagine que si il est désactivé tu récupère les déplacements de base.

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


Kreiss - posté le 04/02/2016 à 17:17:39 (46 messages postés)

❤ 0

L'interrupteur 130 me permet d’activer les déplacements pixel par pixel.
J'ai oublié de préciser.

Index du forum > Entraide > [RPG Maker XP] Deux déplacements [Résolu]

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