设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2026|回复: 6
打印 上一主题 下一主题

[已经解决] 怎么单击图片后变成另外一张图片呢。

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
14 小时
注册时间
2013-8-17
帖子
11
跳转到指定楼层
1
发表于 2013-8-17 09:39:50 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 hys111111 于 2013-8-20 11:30 编辑

怎么单击图片后变成另外一张图片呢,本人刚入门,这个效果急需解决,大家发发爱心,帮帮我吧

Lv2.观梦者

梦石
0
星屑
687
在线时间
791 小时
注册时间
2011-10-20
帖子
2394

开拓者

2
发表于 2013-8-17 09:44:54 | 只看该作者
document.imgs[xx].style="none"貌似这样网页中
欢迎点此进入我的egames.wink.ws,有RMQQ堂等

[url=http://rpg.blue/thread-317273-1-1.html]短篇八-赶选

http://yun.baidu.com/share/link?shareid=2158225779&uk=169642147&third=0


历险ARPG赢回你的疆域新的战斗模式?…………点击这里:[宋乱贼狂 for QQ堂]
http://rpg.blue/group-368-1.html
programing ....?
[url=http://rpg.blue/thrd-234658-1-1.html]
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
76
在线时间
1379 小时
注册时间
2012-7-5
帖子
1698

开拓者

3
发表于 2013-8-17 10:37:24 | 只看该作者
这是RMXP的问题?
LZ去研究看看预置脚本中刷新显示图片的方法吧

  -fk: -azogi:
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
12575
在线时间
1445 小时
注册时间
2012-7-24
帖子
1302
4
发表于 2013-8-17 11:45:13 | 只看该作者
楼主可以用一下鼠标响应脚本
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================

  4. #=================以下两个用来调整战斗时的手感问题,可以自己试试。
  5. $敌人选框扩大 = 20
  6. $角色选框扩大 = 30
  7. $Mouse_Wait = 40   #等待畫格

  8. #==============================================================================
  9. # API调用
  10. #==============================================================================
  11. $ShowCursor = Win32API.new("user32", "ShowCursor", 'i', 'l')
  12. $GetCursorPos = Win32API.new("user32", "GetCursorPos", 'p', 'i')
  13. $ScreenToClient = Win32API.new("user32", "ScreenToClient", 'ip', 'i')
  14. $GetActiveWindow = Win32API.new("user32", "GetActiveWindow", nil, 'l')
  15. $Window_HWND = $GetActiveWindow.call
  16. $GetKeyState = Win32API.new("user32", "GetKeyState", 'i', 'i')
  17. #$FindWindow = Win32API.new("user32", "FindWindow", 'pp', 'i')
  18. #$HookStart  = Win32API.new("mouse_hook.dll", "HookStart", 'i', nil)
  19. #$HookEnd  = Win32API.new("mouse_hook.dll", "HookEnd", nil, nil)
  20. #$GetMouseStatus  = Win32API.new("mouse_hook.dll", "GetMouseStatus", 'i', 'i')
  21. #$Window_HWND = $FindWindow.call(nil, 'mousetry')

  22. module Mouse  
  23.   LEFT = 0x01
  24.   RIGHT = 0x02

  25.   def self.init(sprite = nil)
  26. #   $HookStart.call($Window_HWND)
  27.     $ShowCursor.call(0)
  28.    
  29.     @show_cursor = false
  30.    
  31.     @mouse_sprite = Sprite.new
  32.     @mouse_sprite.z = 99999
  33.     @mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/鼠标图像.png')
  34.     #@mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/lite.png')
  35.     #@mouse_sprite.bitmap.fill_rect(Rect.new(0, 0, 32, 32), Color.new(0, 0, 0))

  36.     @left_press = false
  37.     @right_press = false
  38.     @left_trigger = false
  39.     @right_trigger = false
  40.     @left_repeat = false
  41.     @right_repeat = false
  42.     @click_lock = false
  43.    
  44.     update
  45.   end
  46.   def self.exit
  47.     @mouse_sprite.bitmap.dispose
  48.     @mouse_sprite.dispose
  49.     @show_cursor = true
  50. #    $HookEnd.call
  51.     $ShowCursor.call(1)
  52.   end
  53.   def self.mouse_debug
  54.     return @mouse_debug.bitmap
  55.   end
  56.   def self.update
  57.    
  58.    
  59.     left_down = $GetKeyState.call(0x01)
  60.     right_down = $GetKeyState.call(0x02)
  61.    
  62.     @click_lock = false
  63.     mouse_x, mouse_y = self.get_mouse_pos
  64.     if mouse_x != $old_mx or mouse_y != $old_my
  65.       $old_mx = mouse_x
  66.       $old_my= mouse_y
  67.       $mouse_count = Graphics.frame_count
  68.     end
  69.     if @mouse_sprite != nil
  70.       if Graphics.frame_count - $mouse_count > $Mouse_Wait
  71.         @mouse_sprite.opacity = 0
  72.       else
  73.         @mouse_sprite.opacity = 255
  74.       end      
  75.       @mouse_sprite.x = mouse_x
  76.       @mouse_sprite.y = mouse_y
  77.     end
  78.     if left_down[7] == 1
  79.       @left_repeat = (not @left_repeat)
  80.       @left_trigger = (not @left_press)
  81.       @left_press = true
  82.     else
  83.       @left_press = false
  84.       @left_trigger = false
  85.       @left_repeat = false
  86.     end
  87.     if right_down[7] == 1
  88.       @right_repeat = (not @right_repeat)
  89.       @right_trigger = (not @right_press)
  90.       @right_press = true
  91.     else
  92.       @right_press = false
  93.       @right_trigger = false
  94.       @right_repeat = false
  95.     end
  96.   end
  97.   def self.get_mouse_pos
  98.     point_var = [0, 0].pack('ll')
  99.     if $GetCursorPos.call(point_var) != 0
  100.       if $ScreenToClient.call($Window_HWND, point_var) != 0
  101.         x, y = point_var.unpack('ll')
  102.         if (x < 0) or (x > 10000) then x = 0 end
  103.         if (y < 0) or (y > 10000) then y = 0 end
  104.         if x > 640 then x = 640 end
  105.         if y > 480 then y = 480 end
  106.         return x, y
  107.       else
  108.         return 0, 0
  109.       end
  110.     else
  111.       return 0, 0
  112.     end
  113.   end
  114.   def self.press?(mouse_code)
  115.     if mouse_code == LEFT
  116.       if @click_lock
  117.         return false
  118.       else
  119.         return @left_press
  120.       end
  121.     elsif mouse_code == RIGHT
  122.       return @right_press
  123.     else
  124.       return false
  125.     end
  126.   end
  127.   def self.trigger?(mouse_code)
  128.     if mouse_code == LEFT
  129.       if @click_lock
  130.         return false
  131.       else
  132.         return @left_trigger
  133.       end
  134.     elsif mouse_code == RIGHT
  135.       return @right_trigger
  136.     else
  137.       return false
  138.     end
  139.   end
  140.   def self.repeat?(mouse_code)
  141.     if mouse_code == LEFT
  142.       if @click_lock
  143.         return false
  144.       else
  145.         return @left_repeat
  146.       end
  147.     elsif mouse_code == RIGHT
  148.       return @right_repeat
  149.     else
  150.       return false
  151.     end
  152.   end
  153.   def self.click_lock?
  154.     return @click_lock
  155.   end
  156.   def self.click_lock
  157.     @click_lock = true
  158.   end
  159.   def self.click_unlock
  160.     @click_lock = false
  161.   end
  162. end
  163. module Input
  164.   if @self_update == nil
  165.     @self_update = method('update')
  166.     @self_press = method('press?')
  167.     @self_trigger = method('trigger?')
  168.     @self_repeat = method('repeat?')
  169.   end
  170.   def self.update
  171.     @self_update.call
  172.     Mouse.update
  173.   end
  174.   def self.press?(key_code)
  175.     if @self_press.call(key_code)
  176.       return true
  177.     end
  178.     if key_code == C
  179.       return Mouse.press?(Mouse::LEFT)
  180.     elsif key_code == B
  181.       return Mouse.press?(Mouse::RIGHT)
  182.     else
  183.       return @self_press.call(key_code)
  184.     end
  185.   end
  186.   def self.trigger?(key_code)
  187.     if @self_trigger.call(key_code)
  188.       return true
  189.     end
  190.     if key_code == C
  191.       return Mouse.trigger?(Mouse::LEFT)
  192.     elsif key_code == B
  193.       return Mouse.trigger?(Mouse::RIGHT)
  194.     else
  195.       return @self_trigger.call(key_code)
  196.     end
  197.   end
  198.   def self.repeat?(key_code)
  199.     if @self_repeat.call(key_code)
  200.       return true
  201.     end
  202.     if key_code == C
  203.       return Mouse.repeat?(Mouse::LEFT)
  204.     elsif key_code == B
  205.       return Mouse.repeat?(Mouse::RIGHT)
  206.     else
  207.       return @self_repeat.call(key_code)
  208.     end
  209.   end
  210. end
  211. class Window_Selectable
  212.   if @self_alias == nil
  213.     alias self_update update
  214.     @self_alias = true
  215.   end
  216.   def update
  217.     #self.cursor_rect.empty
  218.     self_update
  219.     if self.active and @item_max > 0
  220.       index_var = @index
  221.       tp_index = @index
  222.       mouse_x, mouse_y = Mouse.get_mouse_pos
  223.       mouse_not_in_rect = true
  224.       for i in 0...@item_max
  225.         [url=home.php?mod=space&uid=370741]@Index[/url] = i
  226.         update_cursor_rect
  227.         top_x = self.cursor_rect.x + self.x + 16
  228.         top_y = self.cursor_rect.y + self.y + 16
  229.         bottom_x = top_x + self.cursor_rect.width
  230.         bottom_y = top_y + self.cursor_rect.height
  231.         if (mouse_x > top_x) and (mouse_y > top_y) and
  232.            (mouse_x < bottom_x) and (mouse_y < bottom_y)
  233.           mouse_not_in_rect = false
  234.           if tp_index != @index
  235.             tp_index = @index
  236.             $game_system.se_play($data_system.cursor_se)
  237.           end
  238.           break
  239.         end
  240.       end
  241.       if mouse_not_in_rect
  242.         @index = index_var
  243.         update_cursor_rect
  244.         Mouse.click_lock
  245.       else
  246.         Mouse.click_unlock               
  247.       end
  248.     end
  249.   end
  250. end
  251. class Window_NameInput
  252.   if @self_alias == nil
  253.     alias self_update update
  254.     @self_alias = true
  255.   end
  256.   def update
  257.     #self.cursor_rect.empty
  258.     self_update
  259.     if self.active
  260.       index_var = @index
  261.       mouse_x, mouse_y = Mouse.get_mouse_pos
  262.       mouse_not_in_rect = true
  263.       for i in (0...CHARACTER_TABLE.size).to_a.push(180)
  264.         @index = i
  265.         update_cursor_rect
  266.         top_x = self.cursor_rect.x + self.x + 16
  267.         top_y = self.cursor_rect.y + self.y + 16
  268.         bottom_x = top_x + self.cursor_rect.width
  269.         bottom_y = top_y + self.cursor_rect.height
  270.         #
  271.         if (mouse_x > top_x) and (mouse_y > top_y) and
  272.            (mouse_x < bottom_x) and (mouse_y < bottom_y)
  273.           mouse_not_in_rect = false
  274.           break
  275.         end
  276.       end
  277.       if mouse_not_in_rect
  278.         @index = index_var
  279.         update_cursor_rect
  280.         Mouse.click_lock
  281.       else
  282.         Mouse.click_unlock
  283.       end
  284.     end
  285.   end
  286. end
  287. class Window_InputNumber
  288.   if @self_alias == nil
  289.     alias self_update update
  290.     @self_alias = true
  291.   end
  292.   def update
  293.     #self.cursor_rect.empty
  294.     self_update
  295.     mouse_x, mouse_y = Mouse.get_mouse_pos
  296.     if self.active and @digits_max > 0
  297.       index_var = @index
  298.       mouse_not_in_rect = true
  299.       for i in 0...@digits_max
  300.         @index = i
  301.         update_cursor_rect
  302.         top_x = self.cursor_rect.x + self.x + 16
  303.         bottom_x = top_x + self.cursor_rect.width
  304.         #
  305.         if (mouse_x > top_x) and (mouse_x < bottom_x)
  306.           mouse_not_in_rect = false
  307.           break
  308.         end
  309.       end
  310.       if mouse_not_in_rect
  311.         @index = index_var
  312.         update_cursor_rect
  313.         Mouse.click_lock
  314.       else
  315.         Mouse.click_unlock
  316.       end
  317.     end
  318.     if @last_mouse_y == nil
  319.       @last_mouse_y = mouse_y
  320.     end
  321.     check_pos = (@last_mouse_y - mouse_y).abs
  322.     if check_pos > 10
  323.       $game_system.se_play($data_system.cursor_se)
  324.       place = 10 ** (@digits_max - 1 - @index)
  325.       n = number / place % 10
  326.       [url=home.php?mod=space&uid=27178]@Number[/url] -= n * place
  327.       n = (n + 1) % 10 if mouse_y < @last_mouse_y
  328.       n = (n + 9) % 10 if mouse_y > @last_mouse_y
  329.       @number += n * place
  330.       refresh
  331.       @last_mouse_y = mouse_y
  332.     end
  333.   end
  334. end
  335. class Scene_File
  336.   if @self_alias == nil
  337.     alias self_update update
  338.     @self_alias = true
  339.   end
  340.   def update
  341.     mouse_x, mouse_y = Mouse.get_mouse_pos
  342.     Mouse.click_lock
  343.     idx = 0
  344.     for i in @savefile_windows
  345.       top_x = i.x + 16
  346.       top_y = i.y + 16
  347.       bottom_x = top_x + i.width
  348.       bottom_y = top_y + i.height
  349.       if (mouse_x > top_x) and (mouse_y > top_y) and
  350.          (mouse_x < bottom_x) and (mouse_y < bottom_y)
  351.         i.selected = true
  352.         if @file_index != idx
  353.           @file_index = idx
  354.           $game_system.se_play($data_system.cursor_se)
  355.         end            
  356.         Mouse.click_unlock
  357.       else
  358.         i.selected = false
  359.       end
  360.       idx += 1
  361.     end
  362.     self_update
  363.   end
  364. end
  365. class Arrow_Enemy
  366.   if @self_alias == nil
  367.     alias self_update update
  368.     @self_alias = true
  369.   end
  370.   def update
  371.     mouse_x, mouse_y = Mouse.get_mouse_pos
  372.     idx = 0
  373.     for i in $game_troop.enemies do
  374.       if i.exist?
  375.         top_x = i.screen_x - self.ox
  376.         top_y = i.screen_y - self.oy
  377.         bottom_x = top_x + self.src_rect.width
  378.         bottom_y = top_y + self.src_rect.height
  379.         if (mouse_x > top_x - $敌人选框扩大) and (mouse_y > top_y - $敌人选框扩大) and
  380.            (mouse_x < bottom_x + $敌人选框扩大) and (mouse_y < bottom_y + $敌人选框扩大)
  381.           if @index != idx
  382.             $game_system.se_play($data_system.cursor_se)
  383.             @index = idx
  384.           end
  385.         end
  386.       end
  387.       idx += 1
  388.     end
  389.     self_update
  390.   end
  391. end
  392. class Arrow_Actor
  393.   if @self_alias == nil
  394.     alias self_update update
  395.     @self_alias = true
  396.   end
  397.   def update
  398.     mouse_x, mouse_y = Mouse.get_mouse_pos
  399.     idx = 0
  400.     for i in $game_party.actors do
  401.       if i.exist?
  402.         top_x = i.screen_x - self.ox
  403.         top_y = i.screen_y - self.oy
  404.         bottom_x = top_x + self.src_rect.width
  405.         bottom_y = top_y + self.src_rect.height
  406.         if (mouse_x > top_x - $角色选框扩大) and (mouse_y > top_y - $角色选框扩大) and
  407.            (mouse_x < bottom_x + $角色选框扩大) and (mouse_y < bottom_y + $角色选框扩大)
  408.           if @index != idx
  409.             $game_system.se_play($data_system.cursor_se)
  410.             @index = idx
  411.           end
  412.         end
  413.       end
  414.       idx += 1
  415.     end
  416.     self_update
  417.   end
  418. end
  419. class Game_Player
  420.   if @self_alias == nil
  421.     alias self_update update
  422.     @self_alias = true
  423.   end
  424.   def update
  425.     mouse_x, mouse_y = Mouse.get_mouse_pos

  426.     if @last_move_x == nil
  427.       @last_move_x = false
  428.     end
  429.     if Mouse.press?(Mouse::LEFT)
  430.       last_moving = moving?
  431.       last_direction = @direction
  432.       unless moving? or $game_system.map_interpreter.running? or
  433.              @move_route_forcing or $game_temp.message_window_showing
  434.         last_x = @x
  435.         if @last_move_x
  436.           @last_move_x = false
  437.         elsif mouse_x > screen_x + 16
  438.           move_right
  439.         elsif mouse_x < screen_x - 16
  440.           move_left
  441.         end
  442.         last_y = @y
  443.         if last_x != @x
  444.           @last_move_x = true
  445.         elsif mouse_y > screen_y
  446.           move_down
  447.         elsif mouse_y < screen_y - 32
  448.           move_up
  449.         end
  450.         if last_y != @y
  451.           @last_move_x = false
  452.         elsif not @last_move_x
  453.           case last_direction
  454.           when 2
  455.             turn_down
  456.           when 4
  457.             turn_left
  458.           when 6
  459.             turn_right
  460.           when 8
  461.             turn_up
  462.           end
  463.         end
  464.       end
  465.     end
  466.     self_update
  467.   end
  468. end
  469. Mouse.init
  470. END { Mouse.exit }




  471. #==============================================================================
  472. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  473. #==============================================================================
复制代码
  1. class Game_Picture
  2. def name=(str)
  3.    @name = str
  4. end
  5. end

  6. class Sprite_Picture
  7. alias update_old update
  8. def update
  9.    update_old
  10.    return if @picture_name == "" or @picture_name[/cmd/].nil?
  11.    mx,my = Mouse.get_mouse_pos
  12.    lx = self.x - self.ox
  13.    rx = lx + self.bitmap.width
  14.    ty = self.y - self.oy
  15.    by = ty + self.bitmap.height
  16.    if mx < lx or mx > rx or my < ty or my > by or
  17.      self.bitmap.get_pixel(mx-lx,my-ty).alpha == 0
  18.      @picture.name = @picture.name.split(/_/)[0]+"_"[email protected](/_/)[1]
  19.      return
  20.    end
  21.    if @picture.name.split(/_/)[2].nil?
  22.      @picture.name = @picture.name + "_02"
  23.    end
  24.    if Input.trigger?(13)
  25.      @picture.name.split(/_/)[0].sub(/cmd([0-9]+)/,"")
  26.      $game_temp.common_event_id = $1.to_i
  27.    end
  28. end
  29. end
复制代码
这两段都插入到main之前,看你的问题是单击时显示另外一张图片,那就先把第一张图片命名为cmd+调用的公共事件编号+_图片名字,再把一张全透明的图片命名为cmd+调用的公共事件编号+_图片名字+_02,最后再在调用的公共事件那里设置显示你要的第二张图片,这样就OK了…………文字表达能力不行啊 ,勉强看得懂就行  

评分

参与人数 1星屑 +98 收起 理由
弗雷德 + 98 我很赞同

查看全部评分


欢迎大家加我
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
14 小时
注册时间
2013-8-17
帖子
11
5
 楼主| 发表于 2013-8-19 09:28:12 | 只看该作者
化螺耕 发表于 2013-8-17 11:45
楼主可以用一下鼠标响应脚本这两段都插入到main之前,看你的问题是单击时显示另外一张图片,那就先把第一张 ...

一运行结果出现 syntaxerror 冲突呢,怎么办
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
12575
在线时间
1445 小时
注册时间
2012-7-24
帖子
1302
6
发表于 2013-8-19 20:00:00 | 只看该作者
芥菜种的天空 发表于 2013-8-19 09:28
一运行结果出现 syntaxerror 冲突呢,怎么办

呃…………我自己用没什么问题啊,你是不是用了其它和这个响应脚本发生冲突的脚本了…………

欢迎大家加我
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
14 小时
注册时间
2013-8-17
帖子
11
7
 楼主| 发表于 2013-8-22 18:28:28 | 只看该作者
呵呵,现在没问题了~~
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-29 19:14

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表