-40%
Le deal à ne pas rater :
-40% sur le Pack Gaming Mario PDP Manette filaire + Casque filaire ...
29.99 € 49.99 €
Voir le deal

Aller en bas
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

RPG Maker VX Ace Créer un HUD cliquable à la souris

Jeu 6 Juin 2013 - 1:07
Voici un petit tuto pour créer un Hud qui s'affiche sur votre carte et qui permet d'accéder aux différents menus comme l'inventaire, équipement, magie etc..à l'aide d'un clic souris.

Ce que vous avez besoin :

Un scipt qui permet la gestion de la souris :
A placer au dessus de "main" dans les scripts.
Auteur : Jet

Code:
#===============================================================================
# Mouse System
# By Jet10985(Jet)
#===============================================================================
# This script will allow full use of the mouse inside of Ace for various
# purposes.
# This script has: 9 customization options.
#===============================================================================
# Overwritten Methods:
# Game_Player: move_by_input
# Window_NameInput: item_max
#-------------------------------------------------------------------------------
# Aliased methods:
# Scene_Map: update, terminate, update_transfer_player
# Input: update, trigger?, press?, repeat?, dir4
# Window_Selectable: update, top_row=
# Scene_File: update, top_index=
# Game_Event: update, setup_page
# Game_Player: check_action_event, get_on_off_vehicle
# Game_System: initialize
#===============================================================================
=begin
Showing text above event when mouse hovers:

If you want a message to appear over an event's head if the mouse is hovering
over the event, put this comment in the event:

MOUSE TEXT MESSAGE HERE

everything after TEXT will be the hovering display.
--------------------------------------------------------------------------------
Change mouse picture above event when mouse hovers:

If you want the mouse's picture to temporarily change whne over an event, put
this comment in the event

MOUSE PIC NAME/NUMBER

if you put a name, the mouse will become that picture, but if you put a number
then the mouse will become the icon that is the id number
--------------------------------------------------------------------------------
Specific mouse click movement routes:

If you want the player to land specifically in a square around an event when
they click to move on the event, put one of these comments in the event:

MOUSE MOVE UP/LEFT/RIGHT/DOWN

only put the direction that you want the player to land on.
--------------------------------------------------------------------------------
Click to activate:

If you want an event to automatically start when it is clicked on, place
this in an event comment:

MOUSE CLICK
--------------------------------------------------------------------------------
Ignore Events:

To have an event be ignored when the mouse makes it's movement path(as if the
event isn't there), put this comment in the event:

MOUSE THROUGH
--------------------------------------------------------------------------------
Extra Notes:

You can activate action button events by standing next to the event and clicking
on it with the mouse.
=end

module Jet
  module MouseSystem
    
    # This is the image used to display the cursor in-game.
    CURSOR_IMAGE = "CURSEURIMAGE"
    
    # If the above image does not exist, the icon at this index will be used.
    CURSOR_ICON = 386
    
    # turning ths switch on will completely disable the mouse.
    TURN_MOUSE_OFF_SWITCH = 3
    
    # Do you want the player to be able to move using the mouse?
    # This can be changed in-game using toggle_mouse_movement(true/false)
    ALLOW_MOUSE_MOVEMENT = true
    
    # Would you like a black box to outline the exact tile the mouse is over?
    DEV_OUTLINE = false
    
  end
  
  module HoverText
    
    # This is the font for the hovering mouse text.
    FONT = "Verdana"
    
    # This is the font color for hovering mouse text.
    COLOR = Color.new(255, 255, 255, 255)
    
    # This is the font size for hovering mouse text.
    SIZE = 20
    
  end
  
  module Pathfinder
    
    # While mainly for coders, you may change this value to allow the
    # pathfinder more time to find a path. 1000 is default, as it is enough for
    # a 100x100 MAZE so, yeah.
    MAXIMUM_ITERATIONS = 1
    
  end
end

#===============================================================================
# DON'T EDIT FURTHER UNLESS YOU KNOW WHAT TO DO.
#===============================================================================
module Mouse
  
  Get_Message = Win32API.new('user32', 'GetMessage', 'plll', 'l')
  GetAsyncKeyState = Win32API.new("user32", "GetAsyncKeyState", 'i', 'i')
  GetKeyState = Win32API.new("user32", "GetKeyState", 'i', 'i')
  GetCursorPo = Win32API.new('user32', 'GetCursorPos', 'p', 'i')
  SetCursorPos = Win32API.new('user32', 'SetCursorPos', 'nn', 'n')
  ScreenToClient = Win32API.new('user32', 'ScreenToClient', 'lp', 'i')
  FindWindowA = Win32API.new('user32', 'FindWindowA', 'pp', 'l')
  GetClientRect = Win32API.new('user32', 'GetClientRect', 'lp', 'i')
  GetWindowRect = Win32API.new('user32', 'GetWindowRect', 'lp', 'i')
  contents = File.open('Game.ini', 'r') {|f| f.read }
  q = contents[/Title=(.+)/].nil? ? "cccc" : $1
  @handle = FindWindowA.call('RGSS Player', q)
  
  Win32API.new('user32', 'ShowCursor', 'i', 'i').call(0)
  
  module_function
  
  def click?(button)
    return true if @keys.include?(button)
    return false
  end
  
  def press?(button)
    return true if @press.include?(button)
    return false
  end
  
  def set_pos(x_pos = 0, y_pos = 0)
    width,height = client_size
    if (x_pos.between?(0, width) && y_pos.between?(0, height))
      SetCursorPos.call(client_pos[0] + x_pos,client_pos[1] + y_pos)
    end
  end
  
  def moved?
    @pos != @old_pos
  end
  
  def set_cursor(image)
    (@cursor ||= Sprite_Cursor.new).set_cursor(image)
  end
  
  def revert_cursor
    (@cursor ||= Sprite_Cursor.new).revert
  end
  
  def update
    if !$game_switches.nil?
     if $game_switches[Jet::MouseSystem::TURN_MOUSE_OFF_SWITCH]
        @keys, @press = [], []
        @pos = [-1, -1]
        @cursor.update
        return
      end
    end
    @old_pos = @pos.dup
    @pos = Mouse.pos
    @keys.clear
    @press.clear
    @keys.push(1) if GetAsyncKeyState.call(1)&0x01 == 1
    @keys.push(2) if GetAsyncKeyState.call(2)&0x01 == 1
    @keys.push(3) if GetAsyncKeyState.call(4)&0x01 == 1
    @press.push(1) if pressed?(1)
    @press.push(2) if pressed?(2)
    @press.push(3) if pressed?(4)
    @cursor.update rescue @cursor = Sprite_Cursor.new
  end
  
  def init
    @keys = []
    @press = []
    @pos = Mouse.pos
    @cursor = Sprite_Cursor.new
  end
  
  def pressed?(key)
    return true unless GetKeyState.call(key).between?(0, 1)
    return false
  end
  
  def global_pos
    pos = [0, 0].pack('ll')
    GetCursorPo.call(pos) != 0 ? (return pos.unpack('ll')) : (return [0, 0])
  end
  
  def pos
    x, y = screen_to_client(*global_pos)
    width, height = client_size
    begin
      x = 0 if x <= 0; y = 0 if y <= 0
      x = width if x >= width; y = height if y >= height
      return x, y
    end
  end
  
  def screen_to_client(x, y)
    return nil unless x && y
    pos = [x, y].pack('ll')
    if ScreenToClient.call(@handle, pos) != 0
      return pos.unpack('ll')
    else
      return [0, 0]
    end
  end
  
  def client_size
    rect = [0, 0, 0, 0].pack('l4')
    GetClientRect.call(@handle, rect)
    right,bottom = rect.unpack('l4')[2..3]
    return right, bottom
  end
  
  def client_pos
    rect = [0, 0, 0, 0].pack('l4')
    GetWindowRect.call(@handle, rect)
    left, upper = rect.unpack('l4')[0..1]
    return left + 4, upper + 30
  end
  
  def grid
    [(@pos[0]/32),(@pos[1]/32)]
  end
  
  def true_grid
    [grid[0] + $game_map.display_x, grid[1] + $game_map.display_y]
  end
  
  def area?(x, y, width, height)
    @pos[0].between?(x, width + x) && @pos[1].between?(y, height + y)
  end
  
  class Sprite_Cursor < Sprite
    
    def initialize
      super(nil)
      self.z = 50000
      @bitmap_cache = initial_bitmap
      if Jet::MouseSystem::DEV_OUTLINE
        @outline = Sprite.new(nil)
        @outline.bitmap = Bitmap.new(32, 32)
        @outline.bitmap.fill_rect(0, 0, 32, 32, Color.new(0, 0, 0, 190))
        @outline.bitmap.fill_rect(1, 1, 30, 30, Color.new(0, 0, 0, 0))
      end
    end
    
    def initial_bitmap
      begin
        self.bitmap = Cache.picture(Jet::MouseSystem::CURSOR_IMAGE)
      rescue
        self.bitmap = Bitmap.new(24, 24)
        icon_index = Jet::MouseSystem::CURSOR_ICON
        rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
        self.bitmap.blt(0, 0, Cache.system("Iconset"), rect, 255)
      end
      self.bitmap.dup
    end
    
    def set_cursor(image)
      if image.is_a?(Integer)
        self.bitmap = Bitmap.new(24, 24)
        icon_index = image
        rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
        self.bitmap.blt(0, 0, Cache.system("Iconset"), rect, 255)
      else
        self.bitmap = Cache.picture(image)
      end
    end
    
    def revert
      self.bitmap = @bitmap_cache.dup
    end
    
    def update
      super
      self.x, self.y = *Mouse.pos
      self.visible = !$game_switches[Jet::MouseSystem::TURN_MOUSE_OFF_SWITCH]
      if !@outline.nil?
        @outline.visible = SceneManager.scene_is?(Scene_Map)
        @outline.x = Mouse.grid[0] * 32
        @outline.y = [Mouse.grid[1] * 32, 1].max
      end
    end
  end
end

Mouse.init

class << Input

  alias jet5888_press? press?
  def press?(arg)
    if arg == Input::C
      return true if Mouse.press?(1)
    elsif arg == Input::B
      return true if Mouse.press?(2)
    end
    jet5888_press?(arg)
  end
  
  alias jet5888_repeat? repeat?
  def repeat?(arg)
    if arg == Input::C
      return true if Mouse.click?(1)
    elsif arg == Input::B
      return true if Mouse.click?(2)
    end
    jet5888_repeat?(arg)
  end
  
  alias jet5888_trigger? trigger?
  def trigger?(arg)
    if arg == Input::C
      return true if Mouse.click?(1)
    elsif arg == Input::B
      return true if Mouse.click?(2)
    end
    jet5888_trigger?(arg)
  end
  
  alias jet3845_dir4 dir4
  def dir4(*args, &block)
    if (orig = jet3845_dir4) == 0
      if !$game_temp.nil? && SceneManager.scene_is?(Scene_Map)
        if !(a = $game_temp.mouse_character).nil? && a.movable?
          if !$game_temp.mouse_path.nil? && !$game_temp.mouse_path.empty?
            return $game_temp.mouse_path.pop * 2
          end
        end
      end
    end
    $game_temp.mouse_path = nil if !$game_temp.nil?
    return orig
  end
  
  alias jet8432_update update
  def update(*args, &block)
    jet8432_update(*args, &block)
    Mouse.update
  end
end

class Window_Selectable
  
  alias jet1084_update update
  def update(*args, &block)
    jet1084_update(*args, &block)
    update_mouse if self.active && self.visible && Mouse.moved?
  end
  
  alias jet7222_top_row top_row=
  def top_row=(*args, &block)
    @last_cursor_move = 0 if @last_cursor_move.nil?
    @last_cursor_move -= 1
    return if @last_cursor_move > 0
    jet7222_top_row(*args, &block)
    @last_cursor_move = 10
  end

  
  def update_mouse
    return if $game_switches[Jet::MouseSystem::TURN_MOUSE_OFF_SWITCH]
    orig_index = @index
    rects = []
    add_x = self.x + 16 - self.ox
    add_y = self.y + 16 - self.oy
    if !self.viewport.nil?
      add_x += self.viewport.rect.x - self.viewport.ox
      add_y += self.viewport.rect.y - self.viewport.oy
    end
    self.item_max.times {|i|
      @index = i
      mouse_update_cursor
      rects.push(cursor_rect.dup)
    }
    @index = orig_index
    rects.each_with_index {|rect, i|
      if Mouse.area?(rect.x + add_x, rect.y + add_y, rect.width, rect.height)
        @index = i
      end
    }
    update_cursor
  end
  
  def mouse_update_cursor
    if @cursor_all
      cursor_rect.set(0, 0, contents.width, row_max * item_height)
    elsif @index < 0
      cursor_rect.empty
    else
      cursor_rect.set(item_rect(@index))
    end
  end
end

class Window_NameInput
  
  def item_max
    90
  end
end

class Scene_File
  
  alias jet3467_update update
  def update(*args, &block)
    update_mouse
    jet3467_update(*args, &block)
  end
  
  alias jet7222_top_index top_index=
  def top_index=(*args, &block)
    @last_cursor_move = 0 if @last_cursor_move.nil?
    @last_cursor_move -= 1
    return if @last_cursor_move > 0
    jet7222_top_index(*args, &block)
    @last_cursor_move = 10
  end
  
  def update_mouse
    self.item_max.times {|i|
      ix = @savefile_windows[i].x
      iy = @savefile_windows[i].y + 48 - @savefile_viewport.oy
      iw = @savefile_windows[i].width
      ih = @savefile_windows[i].height
      if Mouse.area?(ix, iy, iw, ih)
        @savefile_windows[@index].selected = false
        @savefile_windows[i].selected = true
        @index = i
      end
    }
    ensure_cursor_visible
  end
end  

class Game_Temp
  
  attr_accessor :mouse_character, :mouse_movement, :mouse_path
  
end

class Game_CharacterBase

  def mouse_path(target_x, target_y)
    f = $game_map.find_path(target_x.to_i, target_y.to_i, @x.to_i, @y.to_i, self)
    $game_temp.mouse_path = f.collect {|a| a.code }
  end
end

class Game_Player
  
  def move_by_input
    return if !movable? || $game_map.interpreter.running?
    dir = Input.dir4
    move_straight(dir) if dir > 0
  end
  
  alias jet3745_check_action_event check_action_event
  def check_action_event(*args, &block)
    return false unless Input.jet5888_trigger?(:C)
    jet3745_check_action_event(*args, &block)
  end
  
  alias jet3745_get_on_off_vehicle get_on_off_vehicle
  def get_on_off_vehicle(*args, &block)
    if !Input.jet5888_trigger?(:C)
      [:boat, :ship, :airship].each {|a|
        if $game_map.send(a).pos?(*Mouse.true_grid)
          jet3745_get_on_off_vehicle(*args, &block)
          return
        end
      }
    elsif Input.jet5888_trigger?(:C)
      jet3745_get_on_off_vehicle(*args, &block)
    end
  end
  
  def get_on_vehicle_mouse(veh)
    return if vehicle
    @vehicle_type = veh.type
    if vehicle
      turn_toward_character(veh)
      @vehicle_getting_on = true
      force_move_forward unless in_airship?
      @followers.gather
    end
    @vehicle_getting_on
  end
end

class Window_MousePopUp < Window_Base
  
  def initialize(event, text)
    rect = Bitmap.new(1, 1).text_size(text)
    width = rect.width
    height = rect.height
    super(event.screen_x - width / 2, event.screen_y - 48, width + 32, height + 32)
    self.opacity = 0
    self.contents.font.name = Jet::HoverText::FONT
    self.contents.font.color = Jet::HoverText::COLOR
    self.contents.font.size = Jet::HoverText::SIZE
    @text = text
    @event = event
    refresh
  end
  
  def refresh
    contents.clear
    draw_text(0, 0, contents.width, contents.height, @text)
  end
  
  def update
    super
    self.visible = !@event.erased? && Mouse.true_grid == [@event.x, @event.y]
    self.x = @event.screen_x - contents.width / 2 - 8
    self.y = @event.screen_y - 64
  end
end

class Game_Event
  
  attr_accessor :text_box
  
  def check_for_comment(regexp)
    return false if empty?
    for item in @list
      if item.code == 108 or item.code == 408
        if !item.parameters[0][regexp].nil?
          return $1.nil? ? true : $1
        end
      end
    end
    return false
  end
  
  def mouse_empty?
    return true if empty?
    return @list.reject {|a| [108, 408].include?(a.code) }.size <= 1
  end
  
  alias jet3745_setup_page setup_page
  def setup_page(*args, &block)
    jet3745_setup_page(*args, &block)
    @text_box = nil
    @mouse_activated = nil
  end
  
  def mouse_activated?
    @mouse_activated ||= check_for_comment(/MOUSE[ ]*CLICK/i)
  end
  
  def text_box
    @text_box ||= (
      if (a = check_for_comment(/MOUSE[ ]*TEXT[ ]*(.+)/i))
        Window_MousePopUp.new(self, a)
      else
        false
      end
    )
  end
  
  def through
    if $game_temp.mouse_movement && check_for_comment(/MOUSE[ ]*THROUGH/i)
      true
    else
      super
    end
  end
  
  def mouse_cursor
    @mouse_cursor ||= (
      if (a = check_for_comment(/MOUSE[ ]*PIC[ ]*(\d+)/i))
        a.to_i
      elsif (a = check_for_comment(/MOUSE[ ]*PIC[ ]*(.+)/i))
        a
      else
        false
      end
    )
  end
  
  def erased?
    @erased
  end
  
  def movable?
    return false if moving?
    return false if $game_message.busy? || $game_message.visible
    return true
  end
  
  def check_mouse_change
    if mouse_cursor
      Mouse.set_cursor(@mouse_cursor)
      return true
    end
    return false
  end
  
  alias jet3845_update update
  def update(*args, &block)
    jet3845_update(*args, &block)
    @text_box.update if text_box
  end
end

class Game_Vehicle
  
  attr_reader :type
  
end

class Game_System
  
  attr_accessor :mouse_movement
  
  alias jet2735_initialize initialize
  def initialize(*args, &block)
    jet2735_initialize(*args, &block)
    @mouse_movement = Jet::MouseSystem::ALLOW_MOUSE_MOVEMENT
  end
end

class Game_Interpreter
  
  def toggle_mouse_movement(bool)
    $game_system.mouse_movement = bool
  end
end

class Scene_Map
  
  alias jet3745_update update
  def update(*args, &block)
    jet3745_update
    check_mouse_movement if $game_system.mouse_movement
    check_mouse_icon_change
  end
  
  alias jet5687_terminate terminate
  def terminate(*args, &block)
    $game_map.events.values.each {|a|
     a.text_box.dispose if a.text_box
      a.text_box = nil
    }
    Mouse.update
    jet5687_terminate(*args, &block)
  end
  
  def mouse_char
    $game_temp.mouse_character
  end
  
  def check_mouse_icon_change
    changed_mouse = false
    $game_map.events_xy(*Mouse.true_grid).each {|event|
      changed_mouse = changed_mouse || event.check_mouse_change
    }
    Mouse.revert_cursor unless changed_mouse
  end

  def check_mouse_movement
    $game_temp.mouse_character ||= $game_player
    if Mouse.click?(1)
      dont_move = false
      x, y = *Mouse.true_grid
      ($game_map.events_xy(x, y) + $game_map.vehicles).each {|event|
        if event.is_a?(Game_Vehicle)
          if (event.x - mouse_char.x).abs + (event.y - mouse_char.y).abs == 1
            if [event.x, event.y] == Mouse.true_grid
              mouse_char.get_on_vehicle_mouse(event)
              dont_move = true
            end
          end
        elsif !!!mouse_char.vehicle
          if event.mouse_activated?
            event.start
            dont_move = true
          elsif (event.x - mouse_char.x).abs + (event.y - mouse_char.y).abs == 1
            if event.is_a?(Game_Vehicle)
              mouse_char.get_on_vehicle_mouse(event)
              dont_move = true
            else
              if !event.mouse_empty? && [0, 1, 2].include?(event.trigger)
                mouse_char.turn_toward_character(event)
                event.start
                dont_move = true
              end
            end
          else
            {UP: [0, -1], DOWN: [0, 1], LEFT: [-1, 0], RIGHT: [1, 0]}.each {|d, a|
              if event.check_for_comment(/MOUSE[ ]*MOVE[ ]*#{d.to_s}/i)
                x += a[0]; y += a[1]
              end
            }
          end
        end
      }
      mouse_char.mouse_path(x, y) unless dont_move
    end
  end
end

class Node
  
  include Comparable

  attr_accessor :point, :parent, :cost, :cost_estimated

  def initialize(point)
    @point = point
    @cost = 0
    @cost_estimated = 0
    @on_path = false
    @parent = nil
  end

  def mark_path
    @on_path = true
    @parent.mark_path if @parent
  end
  
 def total_cost
    cost + cost_estimated
  end

  def <=>(other)
    total_cost <=> other.total_cost
  end
  
 def ==(other)
    point == other.point
  end
end

class Point
  
  attr_accessor :x, :y
  
  def initialize(x, y)
    @x, @y = x, y
  end

  def ==(other)
    return false unless Point === other
    @x == other.x && @y == other.y
  end

  def distance(other)
    (@x - other.x).abs + (@y - other.y).abs
  end

  def relative(xr, yr)
    Point.new(x + xr, y + yr)
  end
end

class Game_Map
  
  def each_neighbor(node, char = $game_player)
    x = node.point.x
    y = node.point.y
    nodes = []
    4.times {|i|
      i += 1
      new_x = round_x_with_direction(x, i * 2)
      new_y = round_y_with_direction(y, i * 2)
      next unless char.passable?(x, y, i * 2)
      nodes.push(Node.new(Point.new(new_x, new_y)))
    }
    nodes
  end
  
  def find_path(tx, ty, sx, sy, char = $game_player)
    start = Node.new(Point.new(sx, sy))
    goal = Node.new(Point.new(tx, ty))
    return [] if start == goal
    return [] if ![2, 4, 6, 8].any? {|i| char.passable?(tx, ty, i) }
    open_set = [start]
    closed_set = []
    path = []
    iterations = 0
    loop do
      return [] if iterations == Jet::Pathfinder::MAXIMUM_ITERATIONS
      iterations += 1
      current = open_set.min
      return [] unless current
      each_neighbor(current, char).each {|node|
        if node == goal
          node.parent = current
          node.mark_path
          return recreate_path(node)
        end
        next if closed_set.include?(node)
        cost = current.cost + 1
        if open_set.include?(node)
          if cost < node.cost
            node.parent = current
            node.cost = cost
          end
        else
          open_set << node
          node.parent = current
          node.cost = cost
          node.cost_estimated = node.point.distance(goal.point)
        end
      }
      closed_set << open_set.delete(current)
    end
  end
  
  def recreate_path(node)
    path = []
    hash = {[1, 0] => 6, [-1, 0] => 4, [0, 1] => 2, [0, -1] => 8}
    until node.nil?
      pos = node.point
      node = node.parent
      next if node.nil?
      ar = [pos.x <=> node.point.x, pos.y <=> node.point.y]
      path.push(RPG::MoveCommand.new(hash[ar] / 2))
    end
    return path
  end
end
Vous aurez également besoin d'un interrupteur que vous appellerez :

Start sys HUD ?


Et une image qui représente votre Hud que vous placez dans le dossier "Pictures" de votre projet :

Créer un HUD cliquable à la souris  Hud10


Par ou commencer ?

La seconde étape consiste à créer un événement commun dans la base de donnée qui s'active lorsque l'interrupteur précédemment créé est sur "on" , il devra être en processus parrallèle.

Créer un HUD cliquable à la souris  Captur12

Inutile de commencer à recopier ce événement vous le trouverez dans la démo jointe au message plus bas.

Et après ? :

Une fois l'événement commun créé il vous suffit d'ajouter sur la première carte de votre jeu, un événement en processus parrallèle qui active l'interrupteur et affiche votre hud.

Créer un HUD cliquable à la souris  Captur13


Voila quand vous avez fait tout cella vous aurez votre hud cliquable et chaque boutons présent sur l'hud ouvrira un menu.

Info :

La première ligne présente dans l'événement commun
Code:
$game_message.visible == false
Permet de rendre impossible l'ouverture d'un menu et autre éléments cliquables depuis l'hud lorsqu'un message est affiché à l'écran.

Vous aurez remarqué qu'il y a un bouton qui ne fait rien, ça sera utile pour mon prochain tuto qui sera comment créer un système de hauts fait en event et également utilisable à la souris.

Pour l'hud vous pouvez prendre l'image que vous voulez.

Pour faire correspondre les éléments cliquable il faut se référer à l'événement commun présent dans la démo.

Pour modifier c est simple :

Mouse area? (W,X,Y,Z)
W correspond à la position x du pointeur souris à l écran
X correspond à la position y du pointeur à l écran
Y correspond à la taille x de la zone cliquable
Z correspond à la taille y de la zone cliquable

Mouse.press (1)? Permet de détecter si le joueur appuie sur le bouton 1 de la souris.


Lien de la démo à télécharger qui vous permettra de recopier l'événement commun et voir comment le système fonctionne :

www.forestia-productions.com/syshudcliquable.rar

Si vous avez des questions...


Dernière édition par spywaretof le Sam 16 Nov 2013 - 20:40, édité 3 fois
Korndor
Korndor
Staffeux retraité

Nombre de messages : 4959
Age : 110
Localisation : Erem Vehyx
Distinction : Champion de boxe et au lit ! :O [Wax]
Être Mythique [Mister]
Papi Korndor qui a l'ostéoporose [Skillo]
Soldat Ikéa [Coco']
Un bonhomme, un vrai ! [Neresis]
Vieillard acariâtre [Didier Gustin]
Date d'inscription : 16/12/2007
http://www.rpgmakervx-fr.com/

RPG Maker VX Ace Re: Créer un HUD cliquable à la souris

Jeu 6 Juin 2013 - 4:11
Merci pour ton partage détaillé !

+7 points de participation Smile

Bonne continuation
Ezekiel Koening
Ezekiel Koening
Membre

Nombre de messages : 413
Age : 25
Localisation : Nantes
Distinction : aucune
Date d'inscription : 17/12/2011

RPG Maker VX Ace Re: Créer un HUD cliquable à la souris

Jeu 6 Juin 2013 - 7:35
Euh... Si on prend un HUD autre que le tiens, ça marche aussi ? ou alors le script repère directement les boutons sur lm'image Oo ? Et puis comment ouvrir le bon menu en cliquant sur ce bouton, et celui-ci, etc ?
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

RPG Maker VX Ace Re: Créer un HUD cliquable à la souris

Jeu 6 Juin 2013 - 7:51
Merci korndor Smile

Pour l'hud vous pouvez prendre l'image que vous voulez.

Pour faire correspondre les éléments cliquable il faut se référer à l'événement commun présent dans la démo.

Pour modifier c est simple :

Mouse area? (W,X,Y,Z)
W correspond à la position x du pointeur souris à l écran
X correspond à la position y du pointeur à l écran
Y correspond à la taille x de la zone cliquable
Z correspond à la taille y de la zone cliquable

Mouse.press (1)? Permet de détecter si le joueur appuie sur le bouton 1 de la souris.

...
pingouinmutant
pingouinmutant
Membre

Nombre de messages : 204
Age : 24
Localisation : En Bordeciel
Distinction : aucune
Date d'inscription : 27/06/2012

RPG Maker VX Ace Re: Créer un HUD cliquable à la souris

Lun 10 Juin 2013 - 19:30
Cool grâce à sa je vais peut-être trouver comment me faire un menu secondaire. Merci beaucoup! Very Happy
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

RPG Maker VX Ace Re: Créer un HUD cliquable à la souris

Lun 10 Juin 2013 - 19:44
Si tu as besoin de conseil je suis la !
Ewaldar
Ewaldar
Membre

Nombre de messages : 1386
Age : 30
Localisation : Suisse
Distinction : aucune
Date d'inscription : 29/12/2011
http://ewaldar.wixsite.com/les-ames-perdues

RPG Maker VX Ace Re: Créer un HUD cliquable à la souris

Mer 12 Juin 2013 - 20:19
Très bon tuto, et ça rend joli qui plus est !
Cata ==> N'importe quelle image va aller, l'important est de définir les zones cliquables !
Heaven
Heaven
Staffeux retraité

Nombre de messages : 2441
Age : 23
Localisation : Alpes-Maritimes VIRILITÉ OLALA
Distinction : Aucune
Date d'inscription : 18/10/2012

RPG Maker VX Ace Re: Créer un HUD cliquable à la souris

Sam 15 Juin 2013 - 12:23
Impossible de télécharger la démo ><

Heav'n
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

RPG Maker VX Ace Re: Créer un HUD cliquable à la souris

Sam 15 Juin 2013 - 15:28
Le lien sera bientôt remis à jour merci pour l'info !
Crayt
Crayt
Membre

Nombre de messages : 216
Age : 25
Localisation : Devant mon ordinateur
Distinction : aucune
Date d'inscription : 28/10/2013

RPG Maker VX Ace Re: Créer un HUD cliquable à la souris

Sam 16 Nov 2013 - 0:00
Merci du partage,
Lien toujours pas remi ? Sad
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

RPG Maker VX Ace Re: Créer un HUD cliquable à la souris

Sam 16 Nov 2013 - 0:06
Le lien fonctionne correctement merci de cliquer à l'aide de ta souris sur le lien dans le premier post... Smile
Crayt
Crayt
Membre

Nombre de messages : 216
Age : 25
Localisation : Devant mon ordinateur
Distinction : aucune
Date d'inscription : 28/10/2013

RPG Maker VX Ace Re: Créer un HUD cliquable à la souris

Sam 16 Nov 2013 - 12:41
Exact, en fait je n'avais pas attzndu le chargement de la page, des que j'ai vue erreur j'ai quitter.
Il faut s'inscrire.
Merci Smile
Crayt
Crayt
Membre

Nombre de messages : 216
Age : 25
Localisation : Devant mon ordinateur
Distinction : aucune
Date d'inscription : 28/10/2013

RPG Maker VX Ace Re: Créer un HUD cliquable à la souris

Sam 16 Nov 2013 - 20:32
Tu peut mettre un lien MediaFire s\'il te plaît ?
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

RPG Maker VX Ace Re: Créer un HUD cliquable à la souris

Sam 16 Nov 2013 - 20:41
Crayt
Crayt
Membre

Nombre de messages : 216
Age : 25
Localisation : Devant mon ordinateur
Distinction : aucune
Date d'inscription : 28/10/2013

RPG Maker VX Ace Re: Créer un HUD cliquable à la souris

Sam 16 Nov 2013 - 20:46
Parfait !

Merci beaucoup

...
Néocia
Néocia
Membre

Nombre de messages : 42
Age : 25
Localisation : Au chaud :3
Distinction : aucune
Date d'inscription : 16/11/2013

RPG Maker VX Ace Re: Créer un HUD cliquable à la souris

Lun 18 Nov 2013 - 20:13
C'est un beau tutoriel c:, merci du partage même si je risque de ne pas m'en servir (XP >.<) !
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

RPG Maker VX Ace Re: Créer un HUD cliquable à la souris

Lun 18 Nov 2013 - 20:26
Tu peux faire ça sur Xp aussi suffit de trouver un script de gestion pour la souris.
Néocia
Néocia
Membre

Nombre de messages : 42
Age : 25
Localisation : Au chaud :3
Distinction : aucune
Date d'inscription : 16/11/2013

RPG Maker VX Ace Re: Créer un HUD cliquable à la souris

Lun 18 Nov 2013 - 22:00
Effectivement, mais bon même si je le trouve je utiliserais pas (enfin correspond pas à mes attentes ^^)
Contenu sponsorisé

RPG Maker VX Ace Re: Créer un HUD cliquable à la souris

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