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 - episode 7 / Jeux: Ce qui vit Dessous / News: Quoi de neuf sur Oniromancie (...) / Sorties: Dread Mac Farlane - episode 6 / News: Quoi de neuf sur Oniromancie (...) / Chat

Bienvenue
visiteur !




publicité RPG Maker!

Statistiques

Liste des
membres


Contact

Mentions légales

326 connectés actuellement

29351766 visiteurs
depuis l'ouverture

6990 visiteurs
aujourd'hui



Barre de séparation

Partenaires

Indiexpo

Akademiya RPG Maker

Blog Alioune Fall

Fairy Tail Constellations

Lumen

RPG Fusion

RPG Maker VX

Leo-Games

Offgame

Tous nos partenaires

Devenir
partenaire



Morpion (ou tic tac toe) 1.3

Comment faire un morpion (ou tic tac toe) dans RMXP.

Script pour RPG Maker XP
Ecrit par Shado
Signaler un script cassé

❤ 0

Auteur : Shado
Logiciel : RPG Maker XP
Nombre de scripts : 1
Source : https://web.archive.org/web/20090210183647/http://rpgcreative.net/rpgmaker/scripts-99-faire-le-mini-jeu-morpion.html

Fonctionnalités
Ce code vous permettra de jouer au morpion (en québécois : Tictactoe).

Le but de ce jeu connu est d'aligner horizontalement, verticalement ou diagonalement 3 croix ou 3 rond pour gagné.
ce code a été testé et il marche.


Installation
A placer au-dessus de Main.

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
######################################
# Jeu Tic-tac-toe fait par Shado - 27 Juillet 2006
# Laissez un crédit pour moi si vous l'utilisez. Merci !
# Version : 1.3
######################################
 
class Tictactoe
 
  @@turn = "x"
  @@font_name = "Arial"
  @@font_size = 40
  
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
######################
  def main
   @turnWindow = Turn_Window.new(@@turn)
   @turnWindow.x = 450
   @turnWindow.y = 370
   setSquares
   setMenu
   
   Graphics.transition
   loop do
    Graphics.update
    Input.update
    update
    if $scene != self
     break
    end
   end 
 
  Graphics.freeze
  @command_window.dispose
  @turnWindow.dispose
  
   for x in 0..8
     @sqr[x].dispose
   end
  end
######################
  def update
    @command_window.update
    @turnWindow.update(@@turn)
  
    for x in 0..8
     @sqr[x].update
    end
   
   if @command_window.active
      update_command
      return
   end
  end
 
######################
  def update_command
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::C)
      case @command_window.index
      when 0..8
        $game_system.se_play($data_system.decision_se)
        doAction(@command_window.index)
      when 9
        $game_system.se_play($data_system.decision_se)
        $scene = Tictactoe.new
      when 10
        $game_system.se_play($data_system.cancel_se)
        $scene = Scene_Map.new
      end
      return
    end
  end
######################
def setMenu
  s1 = "Haut gauche"
  s2 = "Haut milieu"
  s3 = "Haut droit"
  s4 = "Centre gauche"
  s5 = "Centre milieu"
  s6 = "Centre droit"
  s7 = "Bas left"
  s8 = "Bas milieu"
  s9 = "Bas droit"
  s10 = "Redémarrer"
  s11 = "Quitter"
  @command_window = Window_Command.new(175, [s1, s2, s3, s4, s5, s6,s7,s8,s9,s10,s11])
  @command_window.index = @menu_index
  @command_window.x = 440
end
######################
def setSquares
  @sqr = []
  for x in 0..2
    @sqr[x] = Square.new(@@font_name,@@font_size)
    @sqr[x].x = (x+1)*100
    @sqr[x].y = 50
  end
  
  for x in 3..5
    @sqr[x] = Square.new(@@font_name,@@font_size)
    @sqr[x].x = (x-2)*100
    @sqr[x].y = 150
  end
  
  for x in 6..8
    @sqr[x] = Square.new(@@font_name,@@font_size)
    @sqr[x].x = (x-5)*100
    @sqr[x].y = 250
  end
  
end
######################
def doAction(squareId)
  if (@sqr[squareId].getOwner == "none")
    @sqr[squareId].setOwner(@@turn)
    verifyScore
  else
    $game_system.se_play($data_system.buzzer_se)
  end
end
######################
def verifyScore
  gameIsFinish = false
  #check all --
  for x in 0..2
    if (@sqr[x*3].getOwner == @@turn && @sqr[x*3+1].getOwner == @@turn && @sqr[x*3+2].getOwner == @@turn)
      print "Les "+@@turn+" a gagné !"
      gameIsFinish = true
    end
  end
  
  #check all |
  for x in 0..2
    if (@sqr[x].getOwner == @@turn && @sqr[x+3].getOwner == @@turn && @sqr[x+6].getOwner == @@turn)
      print "Les "+@@turn+" a gagné !"
      gameIsFinish = true
    end
  end
  
  #check \
  if (@sqr[0].getOwner == @@turn && @sqr[4].getOwner == @@turn && @sqr[8].getOwner == @@turn)      
    print "Les "+@@turn+" a gagné !"
    gameIsFinish = true
  end
  
  #check /
  if (@sqr[2].getOwner == @@turn && @sqr[4].getOwner == @@turn && @sqr[6].getOwner == @@turn) 
    print "Les "+@@turn+" a gagné !"
    gameIsFinish = true
  end
  
  if noMoreSpace && !gameIsFinish
    print "Match nul!"
    $scene = Scene_Restart.new
  end
  
  if gameIsFinish
    $scene = Scene_Restart.new
  elsif (@@turn == "x")
    @@turn = "o"
   else @@turn = "x"
  end
end
######################
def noMoreSpace
  for x in 0..8
    if (@sqr[x].getOwner == "none")
      return false
    end
  end
  return true
end
######################
end
 
#----------------------------------------------------------------------
#Squares
#----------------------------------------------------------------------
class Square < Window_Base
  
  def initialize(fontName,fontSize)
    @owner = "none"
    
    super(0, 0, 100,100)
    self.contents = Bitmap.new(width-32, height-32)
    self.contents.font.name = fontName  
    self.contents.font.size = fontSize
    refresh
  end
  
  def refresh
    self.contents.clear
    if (@owner == "x")
      self.contents.font.color = text_color(2)
      self.contents.draw_text(22, 15, 100, 32, "X")
    elsif (@owner == "o")
      self.contents.font.color = text_color(1)
      self.contents.draw_text(22, 15, 100, 32, "O")
    end
  end
  
  def update
    refresh
  end
#############
  def setOwner(newOwner)
    @owner = newOwner
  end
#############
  def getOwner
    return @owner
  end
#############
end
 
#----------------------------------------------------------------------
#Turn Window
#----------------------------------------------------------------------
class Turn_Window < Window_Base
  
  def initialize(turn)
    super(0, 0, 165,60)
    self.contents = Bitmap.new(width-32, height-32)
    self.contents.font.name = "Arial"  
    self.contents.font.size = 30
    refresh(turn)
  end
  
  def refresh(turn)
    self.contents.clear
    if (turn == "x")
      self.contents.font.color = text_color(2)
      self.contents.draw_text(0,0,100,32,"Tour de : X")
    elsif
      self.contents.font.color = text_color(1)
      self.contents.draw_text(0,0,100,32,"Tour de : O")
    end
  end
  
  def update(turn)
    refresh(turn)
  end
end
#----------------------------------------------------------------------
#scene restart
#----------------------------------------------------------------------
class Scene_Restart
  
  @@font_name = "Arial"
  @@font_size = 40
  
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
######################
  def main
    setMenu
    
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
         break
      end
    end 
 
    Graphics.freeze
    @command_window.dispose
  end
######################
  def update
    @command_window.update
   
     if @command_window.active
        update_command
        return
     end
  end
######################
  def update_command
    if Input.trigger?(Input::C)
      case @command_window.index
      when 0
        $game_system.se_play($data_system.decision_se)
        $scene = Tictactoe.new
      when 1
        $game_system.se_play($data_system.cancel_se)
        $scene = Scene_Map.new
      end
      return
    end
  end
######################  
  def setMenu
    s1 = "Redémarrer Tic-tac-toe"
    s2 = "Quitter"
    @command_window = Window_Command.new(180, [s1, s2])
    @command_window.index = @menu_index
    @command_window.x = 250
    @command_window.y = 200
  end
end



Utilisation
Appelez le mini-jeu grâce à la commande d'évènement "Insérer un script" et mettez ce code :

Portion de code : Tout sélectionner

1
$scene = Tictactoe.new




Mis à jour le 19 novembre 2020.






Blitz - posté le 29/01/2009 à 17:50:39 (4 messages postés)

❤ 0

Comment fais t-on pour jouer contre l'ordinateur ?:hihi


gloubyboulga - posté le 01/06/2009 à 14:40:44 (38 messages postés)

❤ 0

Ouais, on peut pas jouer contre son PC ?

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