Le deal à ne pas rater :
Nike : Jusqu’à 50% sur les articles de fin de saison
Voir le deal

Aller en bas
vincent26
vincent26
Membre

Nombre de messages : 766
Age : 28
Localisation : baume de transit le village paumé
Distinction : aucune
Date d'inscription : 17/08/2010

Script mini jeu cube Empty Script mini jeu cube

Lun 9 Déc 2013 - 21:01
Salut je vous présente un script de ma création qui permet la création de mini jeu de ce type :

https://www.youtube.com/watch?v=KygnLKxbtmI

mon but a été de faire en sorte qu'il soit facilement intégrable a n'importe quelle type de jeu

petite démo (sans rtp):

https://www.mediafire.com/?fgte9nl2n1d7zsv

TUTORIEL de CRÉATION DE CARTE :

Tous le script repose sur l'utilisation des ID de région entourant votre personnage
ex de carte pour le jeu vue en mode zone

Spoiler:

Les ID de région sont repartit ainsi :

0 : zone de base aucune action spécifique
1 : fin de parcourt
2 : vous fait glisser vers le haut
3 : vous fait glisser vers la droite
4 : vous fait glisser vers le bas
5 : vous fait glisser vers la gauche
6 : vous empêche de vous mettre a la vertical sur la plaque portant cette Id de région
8-15 : Interrupteur d'ouverture de porte
16-23 : porte associé au interrupteur (8 -> 16 , 9 -> 17 ... )
48-55 : téléporteur
63 : Impassable délimite le niveaux

vous pouvez crées des map a partir de cela de la forme que vous voulez avec les texture que vous voulez
Pour les inter et les porte mettre des événement de la forme que vous voulez la ou vous le souhaiter


Toute les region spécial (inter, plaque glissante, téléporteur, fin de niveaux, "region 6")
sont activable uniquement si votre personnage ce retrouve debout ou sur la tête sur cette plaque

l'utilisation des interrupteur, des porte et des téléporteur doit ce faire dans l'ordre
il faut utiliser la région 8 (16 ou 48) en premier puis les suivante

Pour les téléporteur le départ est l'arrivée doit porté le même numéro

une fois une map crées il faut assigner les inter , les porte et les téléporteur
pour cela ce reporter au commentaire dans le script

Les image du cube ce trouve dans la démo mais ce sont des image de base que je vous conseille fortement de modifier ^^
il est conseiller de changer l’apparence de votre personnage avant de le téléporté sur la map de votre niveaux
l'image de l’apparence basique s’appelle    !$base  il faut que votre perso regarde vers le bas

pour toute demande ou pour toute amélioration prévenez moi (de même si incompréhension de mon tuto ^^ désolé par avance)

Code:

#  /\     ajouter cela dans datamanager sous la ligne 94
# /! \    $game_cube          = Game_Cube.new
#/____\
# Remplacer dans game_player a la ligne 280 toute la def par celle-la :
#
#def move_by_input
#    if $continue == 0
#      return if !movable? || $game_map.interpreter.running?
#      move_straight(Input.dir4) if Input.dir4 > 0
#    end
#  end

#pour lancé le script faite un event en processus parralléle sur la carte comme ceci:
#@>Accès au menu: Désactiver
#appel script : $game_cube.start(numéro de votre niveaux)
#@>Effacer l'évènement

=begin
REGION ID CORRESPONDANCE :
0 : passable
1 : fin de parcourt
2 : vous fait glisser vers le haut
3 : vous fait glisser vers la droite
4 : vous fait glisser vers le bas
5 : vous fait glisser vers la gauche
6 : vous empêche de vous mettre a la vertical sur la plaque
8-15 : Interrupteur
16-23 : plaque associé au interrupteur (8 -> 16 , 9 -> 17 ... )
48-55 : teleporteur
63 : non passable
=end

#Liste image animation :  
#Mouvement[    |      ,    <->    ,      |'   ,    <->'   ,    ^     ,    ->    ,    \/    ,    <-    ,     ^'    ,     ->'   ,    \/'    ,     <-'   ,   Arrêt V  ,  Arrêt H   ]
#              0            1            2          3          4           5          6          7           8          9          10           11          12          13
PICTURE = ["!$cubeGBH","!$cubeHDG","!$cubeDBH","!$cubeBDG","!$cubeMH","!$cubeMD","!$cubeMB","!$cubeMG","!$cubeMH2","!$cubeMD2","!$cubeMB2","!$cubeMG2","!$cube(HB)","!$cube(GB)"]

class Game_Cube < Game_Interpreter
  
#==============================================================================#
#=============================  CONFIGURATION  ================================#
#==============================================================================#
  
#Il est conseiller de crée la map avant de la configurer.

#~~~~~~~~   Action en fin de niveaux
#
# Ajouter un ligne dans le " def gagné(lvl) "
# du type :
#
#  if lvl == Iddevotrelvl
#    Action a effectuer
#  end
#
# ex d' "action a effectuer":  $game_player.reserve_transfer(2, 5, 4, 0)
# cela permet de teleporter le personnage a la map 2 au coordonné (5,4) sans
# changer la direction (le 0)  pour cette exemple
  def gagné(lvl)  
    
  end
 
#~~~~~~~~   Crées les objet sur la map (teleporteur et interrupteur)
#
# Ajouter un ligne dans le " def create_list(lvl) "
# du type :
#
#  if lvl == Iddevotrelvl
#    $teleporteur = []
#    $inter = []
#    $plaque = []
#  end
#
# Definition des teleporteur :
#  dans les [] ajouter des element comme suit :
#  Pour les téléporteur cela marche ainsi :
#  le téleporteur de départ a les coordonnée [x,y]
#  le téleporteur d'arrivée a les coordonné [x',y']
#  les deux étant lié on donne alors  [[x,y],[x',y']]
#  ajouter les couple de teleporteur dans les [] en les séparant par des virgules
#
# Definition des interrupteur :
#  mettre dans les crochet les ID des evenement des interrupteur dan l'ordre
#
# Definition des Porte :
# mettre dans les crochet les ID des evenement des porte en correspondance avec ceux des inter
# c'est a dire au même emplacement dans la liste que l'Id de l'inter correspondant
  
  def create_list(lvl)
  
 end
#==============================================================================#
#=============================  FIN CONFIGURATION  ============================#
#==============================================================================#


#~~~~~~~~~~~~~~ ne rien toucher sous cette ligne
  
  def initialize
    $continue = 0
  end
  
  def start(lvl = 1)
    $lvl = lvl
    create_list($lvl)
    @impassable = [16,17,18,19,20,21,22,23,63]
    $game_player.set_direction(4)
    $game_player.set_graphic(PICTURE[12], 0)
    @orientation = 0
    @continue = 1
    $continue = 1
    take_region_id
    boucle
  end
  
  
#=================================REGION ID ===================================#  
  def take_region_id
########################|########################|#########################|
#####CAS  0  ET  1######|#####CAS  8  ET  2######|#####CAS  4  ET  6#######|
########################|########################|#########################|
##########idnn##########|##########idn ##########|#########################|
##########idn ##########|#####ido1| PL |ide1#####|########idn1|idn2########|
#idoo|ido| Pl |ide|idee#|#####ido2| PL |ide2#####|###ido | PL | PL |ide ###|
##########ids ##########|##########ids ##########|########ids1|ids2########|
##########idss##########|########################|#########################|
########################|########################|#########################|
    if @orientation == 0 || @orientation == 1
      @idn = $game_map.region_id($game_player.x,$game_player.y-1)
      @idnn = $game_map.region_id($game_player.x,$game_player.y-2)
      @ids = $game_map.region_id($game_player.x,$game_player.y+1)
      @idss = $game_map.region_id($game_player.x,$game_player.y+2)
      @ido = $game_map.region_id($game_player.x-1,$game_player.y)
      @idoo = $game_map.region_id($game_player.x-2,$game_player.y)
      @ide = $game_map.region_id($game_player.x+1,$game_player.y)
      @idee = $game_map.region_id($game_player.x+2,$game_player.y)
    elsif @orientation == 8 || @orientation == 2
      $game_variables[5] = $game_map.region_id($game_player.x,$game_player.y-1)
      @idn = $game_map.region_id($game_player.x,$game_player.y-2)
      @ids = $game_map.region_id($game_player.x,$game_player.y+1)
      @ido1 = $game_map.region_id($game_player.x-1,$game_player.y)
      @ido2 = $game_map.region_id($game_player.x-1,$game_player.y-1)
      @ide1 = $game_map.region_id($game_player.x+1,$game_player.y)
      @ide2 = $game_map.region_id($game_player.x+1,$game_player.y-1)
    elsif @orientation == 4 || @orientation == 6
      @idn1 = $game_map.region_id($game_player.x-0.5,$game_player.y-1)
      @idn2 = $game_map.region_id($game_player.x+0.5,$game_player.y-1)
      @ids1 = $game_map.region_id($game_player.x-0.5,$game_player.y+1)
      @ids2 = $game_map.region_id($game_player.x+0.5,$game_player.y+1)
      @ido = $game_map.region_id($game_player.x-1.5,$game_player.y)
      @ide = $game_map.region_id($game_player.x+1.5,$game_player.y)
    end
  end
  
#==================================CASE TEST===================================#
  def test_case
    @id = $game_map.region_id($game_player.x,$game_player.y)
    if @orientation == 0 || @orientation == 1
      if @id == 1;
        @continue = 0
        gagné($lvl)
      elsif @id == 2;
        $game_player.moveto($game_player.x, $game_player.y-1)
        wait 10
        test_case
      elsif @id == 3;
        $game_player.moveto($game_player.x+1, $game_player.y)
        wait 10
        test_case
      elsif @id == 4;
        $game_player.moveto($game_player.x, $game_player.y+1)
        wait 10
        test_case
      elsif @id == 5;
        $game_player.moveto($game_player.x-1, $game_player.y)
        wait 10
        test_case
      elsif @id >= 8 && @id <= 15;
        if @impassable.include?(@id+8) == true
          $game_map.events[$inter[@id-8]].set_direction(4)
          $game_map.events[$plaque[@id-8]].set_direction(4)
          wait 5
          $game_map.events[$inter[@id-8]].set_direction(6)
          $game_map.events[$plaque[@id-8]].set_direction(6)
          wait 5
          $game_map.events[$inter[@id-8]].set_direction(8)
          $game_map.events[$plaque[@id-8]].set_direction(8)
          @impassable.delete(@id+8)
        end
      elsif @id >=48 && @id <= 55;
        a = $teleporteur[@id-48]
        if $game_player.x == a[0][0] && $game_player.y == a[0][1]
          $game_player.reserve_transfer($game_map.map_id, a[1][0], a[1][1], 0)
        else
          $game_player.reserve_transfer($game_map.map_id, a[0][0], a[0][1], 0)
        end
      end
    end
  end
  
#============================================ORIENTATION=======================#
  
  def define_orientation(id)
    #                 |---|
    #                 | ^ |
    #                 | 8 |
    #                 |---|
    #
    #|---|  |------|  |---|  |------|
    #| 1 |  |<    4|  |up0|  |6    >|
    #|---|  |------|  |---|  |------|
    #
    #                 |---|
    #                 | 2 |
    #                 | \/|
    #                 |---|
    
    case id
    when 8;
      case @orientation
      when 0;  @orientation = 8
      when 1;  @orientation = 2
      when 2;  @orientation = 0
      when 4;  @orientation = 4
      when 6;  @orientation = 6
      when 8;  @orientation = 1
      end
    when 4;
      case @orientation
      when 0;  @orientation = 4
      when 1;  @orientation = 6
      when 2;  @orientation = 2
      when 4;  @orientation = 1
      when 6;  @orientation = 0
      when 8;  @orientation = 8
      end
    when 6;
      case @orientation
      when 0;  @orientation = 6
      when 1;  @orientation = 4
      when 2;  @orientation = 2
      when 4;  @orientation = 0
      when 6;  @orientation = 1
      when 8;  @orientation = 8
      end
    when 2;
      case @orientation
      when 0;  @orientation = 2
      when 1;  @orientation = 8
      when 2;  @orientation = 1
      when 4;  @orientation = 4
      when 6;  @orientation = 6
      when 8;  @orientation = 0
      end
    end
  end
 
#============================================PASSABILITE=======================#
  
  def passability(id)
    if @orientation == 0 || @orientation == 1
      case id
      when 8;
        if @impassable.include?(@idn) == false &&  @impassable.include?(@idnn) == false
            return true
        else
            return false
        end
      when 4;
        if @impassable.include?(@ido) == false &&  @impassable.include?(@idoo) == false
          return true
        else
          return false
        end
      when 2;
        if @impassable.include?(@ids) == false &&  @impassable.include?(@idss) == false
          return true
        else
          return false
        end
      when 6;
        if @impassable.include?(@ide) == false &&  @impassable.include?(@idee) == false
          return true
        else
          return false
        end
      end
    elsif @orientation == 2 || @orientation == 8
      case id
      when 8;
        if @impassable.include?(@idn) == false && @idn != 6
            return true
        else
            return false
        end
      when 4;
        if @impassable.include?(@ido1) == false && @impassable.include?(@ido2) == false
          return true
        else
          return false
        end
      when 2;
        if @impassable.include?(@ids) == false && @ids != 6
          return true
        else
          return false
        end
      when 6;
        if @impassable.include?(@ide1) == false && @impassable.include?(@ide2) == false
          return true
        else
          return false
        end
      end
    elsif @orientation == 4 || @orientation == 6
      case id
      when 8;
        if @impassable.include?(@idn1) == false && @impassable.include?(@idn2) == false
            return true
        else
            return false
        end
      when 4;
        if @impassable.include?(@ido) == false &&  @ido != 6
          return true
        else
          return false
        end
      when 2;
        if @impassable.include?(@ids1) == false && @impassable.include?(@ids2) == false
          return true
        else
          return false
        end
      when 6;
        if @impassable.include?(@ide) == false && @ide != 6
          return true
        else
          return false
        end
      end
    end
  end
  
#=========================================MOUVEMENT============================#
  
  def move_to(id)
    if id == 8
      case @orientation
      when 0;#ok
        $game_player.set_direction(2)
        $game_player.set_graphic(PICTURE[4], 0)
        wait 5
        $game_player.set_direction(4)
        wait 5
        $game_player.set_direction(6)
        wait 5
        $game_player.set_direction(8)
        wait 5
        $game_player.set_graphic(PICTURE[12], 0)
        $game_player.set_direction(2)
        $game_player.moveto($game_player.x, $game_player.y-1)
      when 1; #ok
        $game_player.set_direction(2)
        $game_player.set_graphic(PICTURE[8], 0)
        wait 5
        $game_player.set_direction(4)
        wait 5
        $game_player.set_direction(6)
        wait 5
        $game_player.set_direction(8)
        wait 5
        $game_player.set_graphic(PICTURE[12], 0)
        $game_player.set_direction(6)
        $game_player.moveto($game_player.x, $game_player.y-1)
      when 2;  #ok
        $game_player.set_direction(8)
        $game_player.set_graphic(PICTURE[6], 0)
        wait 5
        $game_player.set_direction(6)
        wait 5
        $game_player.set_direction(4)
        wait 5
        $game_player.set_direction(2)
        $game_player.set_graphic(PICTURE[12], 0)
        $game_player.set_direction(4)
        $game_player.moveto($game_player.x, $game_player.y-2)
      when 4; #ok
        $game_player.set_direction(2)
        $game_player.set_graphic(PICTURE[0], 0)
        wait 5
        $game_player.set_direction(8)
        $game_player.moveto($game_player.x, $game_player.y-0.25)
        wait 5
        $game_player.set_direction(6)
        $game_player.moveto($game_player.x, $game_player.y-0.25)
        wait 5
        $game_player.set_direction(4)
        $game_player.moveto($game_player.x, $game_player.y-0.25)
        wait 5
        $game_player.set_graphic(PICTURE[13], 0)
        $game_player.set_direction(4)
        $game_player.moveto($game_player.x, $game_player.y-0.25)
      when 6; #ok
        $game_player.set_direction(2)
        $game_player.set_graphic(PICTURE[2], 0)
        wait 5
        $game_player.set_direction(8)
        $game_player.moveto($game_player.x, $game_player.y-0.25)
        wait 5
        $game_player.set_direction(6)
        $game_player.moveto($game_player.x, $game_player.y-0.25)
        wait 5
        $game_player.set_direction(4)
        $game_player.moveto($game_player.x, $game_player.y-0.25)
        wait 5
        $game_player.set_graphic(PICTURE[13], 0)
        $game_player.set_direction(2)
        $game_player.moveto($game_player.x, $game_player.y-0.25)
      when 8; #ok
        $game_player.set_direction(8)
        $game_player.set_graphic(PICTURE[10], 0)
        wait 5
        $game_player.set_direction(6)
        wait 5
        $game_player.set_direction(4)
        wait 5
        $game_player.set_direction(2)
        $game_player.set_graphic(PICTURE[12], 0)
       $game_player.set_direction(8)
        $game_player.moveto($game_player.x, $game_player.y-2)
      end
    elsif id == 2
      case @orientation
      when 8;
        $game_player.set_direction(8)
        $game_player.set_graphic(PICTURE[4], 0)
        $game_player.moveto($game_player.x, $game_player.y+1)
        wait 5
        $game_player.set_direction(6)
        wait 5
        $game_player.set_direction(4)
        wait 5
        $game_player.set_direction(2)
        $game_player.set_graphic(PICTURE[12], 0)
        $game_player.set_direction(4)
      when 2; #ok
        $game_player.set_direction(8)
        $game_player.set_graphic(PICTURE[8], 0)
        $game_player.moveto($game_player.x, $game_player.y+1)
        wait 5
        $game_player.set_direction(6)
        wait 5
        $game_player.set_direction(4)
        wait 5
        $game_player.set_direction(2)
        $game_player.set_graphic(PICTURE[12], 0)
        $game_player.set_direction(8)
      when 0; #ok
        $game_player.set_direction(2)
        $game_player.set_graphic(PICTURE[6], 0)
        $game_player.moveto($game_player.x, $game_player.y+2)
        wait 5
        $game_player.set_direction(4)
        wait 5
        $game_player.set_direction(6)
        wait 5
        $game_player.set_direction(8)
        wait 5
        $game_player.set_graphic(PICTURE[12], 0)
        $game_player.set_direction(6)
      when 4; #ok
        $game_player.set_direction(2)
        $game_player.set_graphic(PICTURE[0], 0)
        wait 5
        $game_player.set_direction(4)
        $game_player.moveto($game_player.x, $game_player.y+0.25)
        wait 5
        $game_player.set_direction(6)
        $game_player.moveto($game_player.x, $game_player.y+0.25)
        wait 5
        $game_player.set_direction(8)
        $game_player.moveto($game_player.x, $game_player.y+0.25)
        wait 5
        $game_player.set_graphic(PICTURE[13], 0)
        $game_player.set_direction(4)
        $game_player.moveto($game_player.x, $game_player.y+0.25)
      when 6; #ok
        $game_player.set_direction(2)
        $game_player.set_graphic(PICTURE[2], 0)
        wait 5
        $game_player.set_direction(4)
        $game_player.moveto($game_player.x, $game_player.y+0.25)
        wait 5
        $game_player.set_direction(6)
        $game_player.moveto($game_player.x, $game_player.y+0.25)
        wait 5
        $game_player.set_direction(8)
        $game_player.moveto($game_player.x, $game_player.y+0.25)
        wait 5
        $game_player.set_graphic(PICTURE[13], 0)
        $game_player.set_direction(2)
        $game_player.moveto($game_player.x, $game_player.y+0.25)
      when 1; #ok
        $game_player.set_direction(2)
        $game_player.set_graphic(PICTURE[10], 0)
        $game_player.moveto($game_player.x, $game_player.y+2)
        wait 5
        $game_player.set_direction(4)
        wait 5
        $game_player.set_direction(6)
        wait 5
        $game_player.set_direction(8)
        wait 5
        $game_player.set_graphic(PICTURE[12], 0)
       $game_player.set_direction(2)
      end
    elsif id == 4
      case @orientation
      when 4; #ok
        $game_player.set_direction(2)
        $game_player.set_graphic(PICTURE[9], 0)
        $game_player.moveto($game_player.x-1.5, $game_player.y)
        wait 5
        $game_player.set_direction(4)
        wait 5
        $game_player.set_direction(6)
        wait 5
        $game_player.set_direction(8)
        $game_player.set_graphic(PICTURE[12], 0)
        $game_player.set_direction(8)
      when 6; #ok
        $game_player.set_direction(2)
        $game_player.set_graphic(PICTURE[5], 0)
        $game_player.moveto($game_player.x-1.5, $game_player.y)
        wait 5
        $game_player.set_direction(4)
        wait 5
        $game_player.set_direction(6)
        wait 5
        $game_player.set_direction(8)
        $game_player.set_graphic(PICTURE[12], 0)
        $game_player.set_direction(4)
      when 0; #ok
        $game_player.set_direction(8)
        $game_player.set_graphic(PICTURE[7], 0)
        wait 5
        $game_player.set_direction(6)
        wait 5
        $game_player.set_direction(4)
        wait 5
        $game_player.set_direction(2)
        wait 5
        $game_player.set_graphic(PICTURE[13], 0)
        $game_player.set_direction(4)
        $game_player.moveto($game_player.x-1.5, $game_player.y)
      when 8; #ok
        $game_player.set_direction(8)
        $game_player.set_graphic(PICTURE[1], 0)
        $game_player.moveto($game_player.x-0.25, $game_player.y)
        wait 5
        $game_player.set_direction(6)
        $game_player.moveto($game_player.x-0.25, $game_player.y)
        wait 5
        $game_player.set_direction(4)
        $game_player.moveto($game_player.x-0.25, $game_player.y)
        wait 5
        $game_player.set_direction(2)
        $game_player.set_graphic(PICTURE[12], 0)
        $game_player.set_direction(2)
        $game_player.moveto($game_player.x-0.25, $game_player.y)
      when 2; #ok
        $game_player.set_direction(8)
        $game_player.set_graphic(PICTURE[3], 0)
        $game_player.moveto($game_player.x-0.25, $game_player.y)
        wait 5
        $game_player.set_direction(6)
        $game_player.moveto($game_player.x-0.25, $game_player.y)
        wait 5
        $game_player.set_direction(4)
        $game_player.moveto($game_player.x-0.25, $game_player.y)
        wait 5
        $game_player.set_direction(2)
        $game_player.set_graphic(PICTURE[12], 0)
        $game_player.set_direction(6)
        $game_player.moveto($game_player.x-0.25, $game_player.y)
      when 1; #ok
        $game_player.set_direction(8)
        $game_player.set_graphic(PICTURE[11], 0)
        wait 5
        $game_player.set_direction(6)
        wait 5
        $game_player.set_direction(4)
        wait 5
        $game_player.set_direction(2)
        $game_player.set_graphic(PICTURE[13], 0)
       $game_player.set_direction(2)
        $game_player.moveto($game_player.x-1.5, $game_player.y)
      end
    elsif id == 6
      case @orientation
      when 1; #ok
        $game_player.set_direction(8)
        $game_player.set_graphic(PICTURE[9], 0)
        wait 5
        $game_player.set_direction(6)
        wait 5
        $game_player.set_direction(4)
        wait 5
        $game_player.set_direction(2)
        $game_player.set_graphic(PICTURE[13], 0)
        $game_player.moveto($game_player.x+1.5, $game_player.y)
        $game_player.set_direction(4)
      when 0;  #ok
        $game_player.set_direction(8)
        $game_player.set_graphic(PICTURE[5], 0)
        wait 5
        $game_player.set_direction(6)
        wait 5
        $game_player.set_direction(4)
        wait 5
        $game_player.set_direction(2)
        $game_player.set_graphic(PICTURE[13], 0)
        $game_player.moveto($game_player.x+1.5, $game_player.y)
        $game_player.set_direction(2)
      when 4;  #ok
        $game_player.set_direction(2)
        $game_player.set_graphic(PICTURE[7], 0)
        $game_player.moveto($game_player.x+1.5, $game_player.y)
        wait 5
        $game_player.set_direction(4)
        wait 5
        $game_player.set_direction(6)
        wait 5
        $game_player.set_direction(8)
        wait 5
        $game_player.set_graphic(PICTURE[12], 0)
        $game_player.set_direction(4)
      when 8;  #ok
        $game_player.set_direction(2)
        $game_player.set_graphic(PICTURE[1], 0)
        $game_player.moveto($game_player.x+0.25, $game_player.y)
        wait 5
        $game_player.set_direction(4)
        $game_player.moveto($game_player.x+0.25, $game_player.y)
        wait 5
        $game_player.set_direction(6)
        $game_player.moveto($game_player.x+0.25, $game_player.y)
        wait 5
        $game_player.set_direction(8)
        $game_player.set_graphic(PICTURE[12], 0)
        $game_player.set_direction(2)
        $game_player.moveto($game_player.x+0.25, $game_player.y)
      when 2;  #ok
        $game_player.set_direction(2)
        $game_player.set_graphic(PICTURE[3], 0)
        $game_player.moveto($game_player.x+0.25, $game_player.y)
        wait 5
        $game_player.set_direction(4)
        $game_player.moveto($game_player.x+0.25, $game_player.y)
        wait 5
        $game_player.set_direction(6)
        $game_player.moveto($game_player.x+0.25, $game_player.y)
        wait 5
        $game_player.set_direction(8)
        $game_player.set_graphic(PICTURE[12], 0)
        $game_player.set_direction(6)
        $game_player.moveto($game_player.x+0.25, $game_player.y)
      when 6;  #ok
        $game_player.set_direction(2)
        $game_player.set_graphic(PICTURE[11], 0)
        $game_player.moveto($game_player.x+1.5, $game_player.y)
        wait 5
        $game_player.set_direction(4)
        wait 5
        $game_player.set_direction(6)
        wait 5
        $game_player.set_direction(8)
        $game_player.set_graphic(PICTURE[12], 0)
       $game_player.set_direction(8)
      end
    end
  end
  
      
#========================BOUCLE PRINCIPALE=====================================#
  
  def boucle
    while @continue == 1
      if Input.press?(:UP) == true
        take_region_id
        if passability(8) == true
          move_to(8)
          define_orientation(8)
          test_case
          wait 1
        end
      end
      if Input.press?(:DOWN) == true
        take_region_id
        if passability(2) == true
          move_to(2)
          define_orientation(2)
          test_case
          wait 1
        end
      end
      if Input.press?(:LEFT) == true
        take_region_id
        if passability(4) == true
          move_to(4)
          define_orientation(4)
          test_case
          wait 1
        end
      end
      if Input.press?(:RIGHT) == true
        take_region_id
        if passability(6) == true
          move_to(6)
          define_orientation(6)
          test_case
          wait 1
        end
      end
      wait 1
    end
  end
end




Dernière édition par vincent26 le Mer 11 Déc 2013 - 13:19, édité 3 fois
Spytje
Spytje
Administrateur

Nombre de messages : 5935
Localisation : La terre
Distinction : Spiraliste [Korn']
Forestia : Projet du mois juillet 2014
Papy Pulkigrat [Yama']
Date d'inscription : 16/03/2008

Script mini jeu cube Empty Re: Script mini jeu cube

Lun 9 Déc 2013 - 21:04
Merci pour le partage, j'avais déjà testé ton oeuvre, c'est très bien fait !
vincent26
vincent26
Membre

Nombre de messages : 766
Age : 28
Localisation : baume de transit le village paumé
Distinction : aucune
Date d'inscription : 17/08/2010

Script mini jeu cube Empty Re: Script mini jeu cube

Lun 9 Déc 2013 - 22:40
Merci bcp ^^
Kira'h
Kira'h
Membre

Nombre de messages : 588
Age : 29
Localisation : Devant mon écran... Si pas, dans mon jeu^^
Distinction : aucune
Date d'inscription : 25/02/2012

Script mini jeu cube Empty Re: Script mini jeu cube

Lun 9 Déc 2013 - 23:09
En effet, c'est bien sympas! Merci du partage. =)
vincent26
vincent26
Membre

Nombre de messages : 766
Age : 28
Localisation : baume de transit le village paumé
Distinction : aucune
Date d'inscription : 17/08/2010

Script mini jeu cube Empty Re: Script mini jeu cube

Mar 10 Déc 2013 - 1:48
Mici Smile

EDIT : Je suis en train de l'améliorer je vais sortir la version 1.1 ^^
ajout :
- son
- interrupteur reactivable ou a activation unique
- plusieurs porte activable en même temps
- animation pour les plaque ou l'on ne peut pas ce relever
Contenu sponsorisé

Script mini jeu cube Empty Re: Script mini jeu cube

Revenir en haut
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum