赞 | 0 |
VIP | 3 |
好人卡 | 0 |
积分 | 1 |
经验 | 14326 |
最后登录 | 2021-12-28 |
在线时间 | 65 小时 |
Lv1.梦旅人 清纯红
- 梦石
- 0
- 星屑
- 61
- 在线时间
- 65 小时
- 注册时间
- 2009-7-23
- 帖子
- 995
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 赤点 于 2009-8-22 00:48 编辑
看了那小游戏,于是就邪恶的搬到rmxp里了
素材还是用截图抠的说。。。
欢迎拍砖~
测试
图片:
以下是范例:
是男人就下一百层.rar
(244.14 KB, 下载次数: 394)
以下是脚本:- #==============================================================================
- # ■ 是男人就下一百层 v1.0
- # ■ BY 赤点
- #------------------------------------------------------------------------------
- # 使用方法:$scene = Nanren.new 必须把范例中Pictures里的图片复制到你的工程!
- # 不需要内置脚本支持,应该没什么冲突。
- #==============================================================================
- #==============================================================================
- # ■ Window_Status
- #------------------------------------------------------------------------------
- # 显示角色状态的窗口。
- #==============================================================================
- class Window_Status < Window
- #--------------------------------------------------------------------------
- # ● 初始化目标
- #--------------------------------------------------------------------------
- def initialize(jilu)
- super()
- self.windowskin = RPG::Cache.windowskin("001-Blue01")
- self.x = 379
- self.y = 0
- self.width = 261
- self.height = 480
- self.z = 100
- self.contents = Bitmap.new(width - 32, height - 32)
- update
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def update
- self.contents.clear
- #draw_actor_graphic(24, 80)
- end
- #描绘图形
- def draw_actor_life(hp)
- bitmap = RPG::Cache.character("001-Fighter01", 0)
- cw = bitmap.width / 4
- ch = bitmap.height / 4
- src_rect = Rect.new(0, 0, cw, ch)
- for i in 1..hp
- self.contents.blt(i*28, 35, bitmap, src_rect)
- end
- end
- #描绘层数
- def draw_ceng(ceng)
- self.contents.font.size = 45
- self.contents.font.color = Color.new(255, 200, 50, 255)
- self.contents.draw_text(12, 150, 200, 100,"现在层数: #{ceng}")
- end
- #释放
- def dispose
- self.contents.dispose
- end
-
- end
- #==============================================================================
- # ■ Scene_Nanren
- #------------------------------------------------------------------------------
- # 主场景。
- #==============================================================================
- class Scene_Nanren
- def main
- #准备初始化
- ready
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- @world.oy += 2
- # 刷新输入信息
- Input.update
- # 刷新画面
- @actor.update
- update
- #死亡检查
- if @hp <= 0 or @play.y >= 480
- print "你的层数是: #{@ceng}"
- if @jilu < @ceng
- file =File.open("nanren.sav","wb")
- @jilu = @ceng
- Marshal.dump(@jilu,file)
- file.close
- end
- #失败时切换用,就把下下面的dispose和break去掉
- #$scene =
- dispose
- break
- end
- # 如果画面被切换就中断循环
- if $scene != self
- break
- end
- end
- # 装备过渡
- Graphics.freeze
- # 释放
- @actor.dispose
- dispose
- end
- def ready
- #生成世界
- @world = Viewport.new(0,0,385,960)
- @world.oy = -400
- #生成顶部
- @top = Sprite.new
- @top.bitmap =Bitmap.new("Graphics/Pictures/top.png")#w379,h15
- @top.x = 0
- @top.y = 0
- #生成部件
- draw
- #生成人物andHp
- player
- @hp = 6
- #读取描绘记录
- if FileTest.exist?("nanren.sav")
- file =File.open("nanren.sav","rb")
- @jilu = Marshal.load(file)
- file.close
- else
- @jilu = 0
- end
- #生成角色窗口
- @actor = Window_Status.new(@jilu)
- @actor.x = 385
- @actor.y = 0
- draw_jilu(@jilu)
- end
- #描绘记录
- def draw_jilu(jilu)
- @bit2 = Bitmap.new(130,90)
- @bit2.font.size = 45
- @bit2.font.color = Color.new(200, 100, 255, 255)
- @bit2.draw_text(5,10, 130, 90,"记录:#{jilu}")
- @jilus = Sprite.new
- @jilus.bitmap = @bit2
- @jilus.x = 405
- @jilus.y = 255
- @jilus.z = 111
- end
- #描绘部件
- def draw
- #初始化部件bitmap
- @total = []
- y = rand(20)+30
- #开始描绘
- @checks = @top
- for @i in 0..300
- math = rand(5)
- draw_sprite(@i,y,math)
- y += rand(60)+50
- end
- end
-
- #部件sprite
- def draw_sprite(i,y,math)
- temp = rand(2)
- case math
- when 0
- @total = Sprite.new(@world)
- @total.bitmap = Bitmap.new("Graphics/Pictures/ci")
- if temp == 0
- @total.x = rand(142)+1
- else
- @total.x = rand(142)+142
- end
- @total.y = y+rand(20)+20
- @total.z = 1
- when 1
- @total = Sprite.new(@world)
- @total.bitmap = Bitmap.new("Graphics/Pictures/dong")
- if temp == 0
- @total.x = rand(142)+1
- else
- @total.x = rand(142)+142
- end
- @total.y = y+rand(20)+20
- @total.z = 2 or 10
- when 2
- @total = Sprite.new(@world)
- @total.bitmap = Bitmap.new("Graphics/Pictures/nor")
- if temp == 0
- @total.x = rand(142)+1
- else
- @total.x = rand(142)+142
- end
- @total.y = y+rand(20)+20
- @total.z = 3
- when 3
- @total = Sprite.new(@world)
- @total.bitmap = Bitmap.new("Graphics/Pictures/nnor")
- if temp == 0
- @total.x = rand(142)+1
- else
- @total.x = rand(142)+142
- end
- @total.y = y+rand(20)+20
- @total.z = 4
- when 4
- @total = Sprite.new(@world)
- @total.bitmap = Bitmap.new("Graphics/Pictures/tang")
- if temp == 0
- @total.x = rand(142)+1
- else
- @total.x = rand(142)+142
- end
- @total.y = y+rand(20)+20
- @total.z = 5
- end
- end
- #碰触检查
- def check(s,d)
- sx1 = s.x
- sy1 = s.y
- sx2 = s.x + s.bitmap.width
- sy2 = s.y + s.bitmap.height
- sx3 = s.x + s.bitmap.width/2
- dx1 = d.x
- dy1 = [email protected]
- dx2 = d.x + s.bitmap.width*2 + 28
- dy2 = d.y + s.bitmap.height - @world.oy
- if sy2-dy1>=-5 and sx3<=dx2 and sx3 >= dx1 and sy2-dy1<=5
- return true
- else
- return false
-
- end
-
- end
- #描绘角色
- def player
- @bitmap = Bitmap.new("Graphics/Characters/001-Fighter01")
- @play = Sprite.new(Viewport.new(0,0,385,480))
- @play.bitmap = Bitmap.new(@bitmap.width/4,@bitmap.height/4)
- @play.bitmap.blt(0,0,@bitmap,@bitmap.rect,255)
- @play.x = 200
- @play.y = 30
- @m = 1
- end
- def clear
- @play.bitmap.clear
- end
- #左
- def move_left
- if @m != 4
- clear
- end
- @play.bitmap.blt(0,-(@bitmap.height/4),@bitmap,@bitmap.rect,255)
- if @play.x>=5
- @play.x -= 8
- end
- @m = 4
-
- end
- #右
- def move_right
- if @m != 6
- clear
- end
- @play.bitmap.blt(0,-2*(@bitmap.height/4),@bitmap,@bitmap.rect,255)
- if @play.x<=355
- @play.x += 8
- end
- @m = 6
- end
- #跳
- def move_jump
- @play.y -= 200
- end
- #检测接触时
- def pcheck
- for i in @ceng..@ceng+90
- if check(@play,@total)
- break
- end
- end
- if check(@play,@total)
- check_sort(@total)
- @play.y -= 2
- case Input.dir4
- when 8
- move_jump
- end
- else
- @play.y += 6
- end
- end
- #检查种类
- def check_sort(sort)
- case sort.z
- when 1
- ci
- when 2
- dong(true)
- when 5
- tang
- when 10
- dong(false)
- end
- end
- def ci
- @hp -= 1
- @play.y -= 100
- end
- def dong(tem)
- if tem
- @play.x += 6
- else
- @play.x -= 6
- end
-
- end
- def nnor
- tem = rand(2)
- if tem == 0
- @play.y += 8
- end
- end
- def tang
- @play.y -= 100
- end
- #受伤
- def play_act
- if @play.y <= 16
- @hp -= 1
- @play.flash(Color.new(255, 50, 50, 255), 5)
- @play.y += 20
- else
- @play.update
- end
- end
-
-
- #刷新
- def update
- @ceng = @world.oy / 200
- @actor.draw_ceng(@ceng)
- @actor.draw_actor_life(@hp)
- pcheck
- play_act
- case Input.dir4
- when 4
- if @m != 0
- clear
- @m = 0
- end
- move_left
- when 6
- if @m != 0
- clear
- @m = 0
- end
- move_right
- when 2
- @play.y += 20
-
- end
-
- end
- #释放
- def dispose
- for i in [email protected]
- @total.dispose
- end
- @total.clear
- @actor.dispose
- @play.bitmap.dispose
- @bit2.dispose
- @jilus.bitmap.dispose
- @top.dispose
- end
-
- end
复制代码 |
|