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

Project1

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

请教个Bitmap的问题

 关闭 [复制链接]

Lv1.梦旅人

指引者

梦石
0
星屑
50
在线时间
2 小时
注册时间
2005-10-25
帖子
375
跳转到指定楼层
1
发表于 2007-12-29 04:50:51 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
以下引用缺牙de兔子于2007-12-28 18:00:45的发言:

没完了--刷新失败

[本贴由作者于 2007-12-28 19:41:53 最后编辑]


  1. #######################################################################################################
  2. #
  3. #######################################################################################################
  4. class Zandou_My_Battle
  5.    
  6.   def main
  7.     judge($game_variables[76],$game_variables[77],$game_variables[78] ,
  8.     $game_variables[79],$game_variables[80],$game_variables[81],
  9.     $game_variables[82],$game_variables[83],$game_variables[84] )
  10.      # 清除战斗调用标志
  11.     $game_temp.battle_calling = false
  12.     # 清除菜单调用标志
  13.     $game_temp.menu_calling = false
  14.     $game_temp.menu_beep = false
  15.     # 生成遇敌计数
  16.     $game_player.make_encounter_count
  17.     # 记忆地图 BGM 、停止 BGM
  18.     $game_temp.map_bgm = $game_system.playing_bgm
  19.     $game_system.bgm_stop
  20.     # 演奏战斗开始 SE
  21.     $game_system.se_play($data_system.battle_start_se)
  22.     # 演奏战斗 BGM
  23.     $game_system.bgm_play($game_system.battle_bgm)
  24.     loop do
  25.       
  26.     self.init_addr
  27.    
  28.     end
  29.    
  30.   end
  31.   
  32.   def judge(actor_Id,actor_Hp,actor_Mp ,actor_Atk,actor_Def,actor_X,actor_Y,actor_Z,actor_Action )
  33.     @actor_Id = actor_Id
  34.     @actor_Hp = actor_Hp
  35.     @actor_Mp = actor_Mp
  36.     @actor_Atk = actor_Atk
  37.     @actor_Def = actor_Def
  38.     @actor_X = actor_X
  39.     @actor_Y = actor_Y
  40.     @actor_Z = actor_Z
  41.     @actor_Action = actor_Action
  42.    
  43.     #p  "角色ID:#{@actor_Id}"
  44.     #p  "角色HP:#{@actor_Hp}"
  45.     #p  "角色SP:#{@actor_Mp}"
  46.     #p  "角色攻击力:#{@actor_Atk}"
  47.     #p  "角色防御力:#{@actor_Def}"
  48.     #p  "角色X坐标:#{@actor_X}"
  49.     #p  "角色Y坐标:#{@actor_Y}"
  50.     #p  "角色Z坐标:#{@actor_Z}"
  51.     #p  "角色动作:#{@actor_Action}"
  52.   end
  53.   
  54.   def init_addr
  55.    if( $game_variables[81] < 0)
  56.      $game_variables[81] = 0
  57.    end
  58.    if($game_variables[81] > 19)
  59.      $game_variables[81] = 19
  60.    end
  61.    
  62.     @init_X = $game_variables[81]
  63.     @init_Y = $game_variables[82]
  64.     @init_Z = $game_variables[83]
  65.    
  66.    devil = Sprite.new
  67.    devil.x = @init_X *32
  68.    devil.y = @init_Y *32 - 80
  69.    devil.bitmap = Bitmap.new("Graphics/Pictures/按下右")



  70.   end
  71.   
  72. end


复制代码




如果我不在main循环 使用并行事件调用的话就变成这样了....
而且不用我写代码删除 图片就自己消失了--






版务信息:本贴由楼主自主结贴~
↓这是啥-- [IMG][/IMG]

Lv1.梦旅人

指引者

梦石
0
星屑
50
在线时间
2 小时
注册时间
2005-10-25
帖子
375
2
 楼主| 发表于 2007-12-29 04:50:51 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
以下引用缺牙de兔子于2007-12-28 18:00:45的发言:

没完了--刷新失败

[本贴由作者于 2007-12-28 19:41:53 最后编辑]


  1. #######################################################################################################
  2. #
  3. #######################################################################################################
  4. class Zandou_My_Battle
  5.    
  6.   def main
  7.     judge($game_variables[76],$game_variables[77],$game_variables[78] ,
  8.     $game_variables[79],$game_variables[80],$game_variables[81],
  9.     $game_variables[82],$game_variables[83],$game_variables[84] )
  10.      # 清除战斗调用标志
  11.     $game_temp.battle_calling = false
  12.     # 清除菜单调用标志
  13.     $game_temp.menu_calling = false
  14.     $game_temp.menu_beep = false
  15.     # 生成遇敌计数
  16.     $game_player.make_encounter_count
  17.     # 记忆地图 BGM 、停止 BGM
  18.     $game_temp.map_bgm = $game_system.playing_bgm
  19.     $game_system.bgm_stop
  20.     # 演奏战斗开始 SE
  21.     $game_system.se_play($data_system.battle_start_se)
  22.     # 演奏战斗 BGM
  23.     $game_system.bgm_play($game_system.battle_bgm)
  24.     loop do
  25.       
  26.     self.init_addr
  27.    
  28.     end
  29.    
  30.   end
  31.   
  32.   def judge(actor_Id,actor_Hp,actor_Mp ,actor_Atk,actor_Def,actor_X,actor_Y,actor_Z,actor_Action )
  33.     @actor_Id = actor_Id
  34.     @actor_Hp = actor_Hp
  35.     @actor_Mp = actor_Mp
  36.     @actor_Atk = actor_Atk
  37.     @actor_Def = actor_Def
  38.     @actor_X = actor_X
  39.     @actor_Y = actor_Y
  40.     @actor_Z = actor_Z
  41.     @actor_Action = actor_Action
  42.    
  43.     #p  "角色ID:#{@actor_Id}"
  44.     #p  "角色HP:#{@actor_Hp}"
  45.     #p  "角色SP:#{@actor_Mp}"
  46.     #p  "角色攻击力:#{@actor_Atk}"
  47.     #p  "角色防御力:#{@actor_Def}"
  48.     #p  "角色X坐标:#{@actor_X}"
  49.     #p  "角色Y坐标:#{@actor_Y}"
  50.     #p  "角色Z坐标:#{@actor_Z}"
  51.     #p  "角色动作:#{@actor_Action}"
  52.   end
  53.   
  54.   def init_addr
  55.    if( $game_variables[81] < 0)
  56.      $game_variables[81] = 0
  57.    end
  58.    if($game_variables[81] > 19)
  59.      $game_variables[81] = 19
  60.    end
  61.    
  62.     @init_X = $game_variables[81]
  63.     @init_Y = $game_variables[82]
  64.     @init_Z = $game_variables[83]
  65.    
  66.    devil = Sprite.new
  67.    devil.x = @init_X *32
  68.    devil.y = @init_Y *32 - 80
  69.    devil.bitmap = Bitmap.new("Graphics/Pictures/按下右")



  70.   end
  71.   
  72. end


复制代码




如果我不在main循环 使用并行事件调用的话就变成这样了....
而且不用我写代码删除 图片就自己消失了--






版务信息:本贴由楼主自主结贴~
↓这是啥-- [IMG][/IMG]

Lv1.梦旅人

指引者

梦石
0
星屑
50
在线时间
2 小时
注册时间
2005-10-25
帖子
375
3
 楼主| 发表于 2007-12-29 05:24:49 | 只看该作者
图片自动消失 问题出在哪呢?
↓这是啥-- [IMG][/IMG]
回复 支持 反对

使用道具 举报

Lv1.梦旅人

月下可怜人

梦石
0
星屑
50
在线时间
10 小时
注册时间
2005-11-23
帖子
4085

第1届短篇游戏比赛亚军

4
发表于 2007-12-29 17:43:44 | 只看该作者
因为你存入的是局部变量,方法结束自然会被释放,把变量改实例或全局变量应该就可以了。
纵然千里外,我等雁归来。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

指引者

梦石
0
星屑
50
在线时间
2 小时
注册时间
2005-10-25
帖子
375
5
 楼主| 发表于 2007-12-29 19:05:40 | 只看该作者
那全局变量怎么标识?
↓这是啥-- [IMG][/IMG]
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-12-29
帖子
12
6
发表于 2007-12-29 20:21:16 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

指引者

梦石
0
星屑
50
在线时间
2 小时
注册时间
2005-10-25
帖子
375
7
 楼主| 发表于 2007-12-29 21:13:12 | 只看该作者
还是不行......用全局还是会消失 --
我是在事件并行处理 做的
↓这是啥-- [IMG][/IMG]
回复 支持 反对

使用道具 举报

Lv1.梦旅人

风之塞尔达

梦石
0
星屑
50
在线时间
57 小时
注册时间
2005-10-22
帖子
2492

贵宾

8
发表于 2007-12-29 23:24:46 | 只看该作者
devil 是局部的,  函数 init_addr 每次被调用完, 它都随着栈一起释放
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
在程序里延续塞尔达的传说, 在画板上勾勒塞尔达的轮廓!!
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-19 17:23

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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