Project1
标题:
256调色板
[打印本页]
作者:
yangff
时间:
2008-6-5 02:46
标题:
256调色板
完全无聊产物
使用后颜色返回到$color
class Colorball
def main
@red = Sprite.new
@red.bitmap = Bitmap.new(32,255)
@red.x = 32
@green = Sprite.new
@green.bitmap = Bitmap.new(32,255)
@green.x = 64
@blue = Sprite.new
@blue.bitmap = Bitmap.new(32,255)
@blue.x = 64+32
@use = 0
@r = 1
@g = 1
@b = 1
for i in 0...255
@red.bitmap.fill_rect(Rect.new(0,i,32,1), Color.new(i+1,0,0))
end
for i in 0...255
@green.bitmap.fill_rect(Rect.new(0,i,32,1), Color.new(0,i+1,0))
end
for i in 0...255
@blue.bitmap.fill_rect(Rect.new(0,i,32,1), Color.new(0,0,i+1))
end
@color = Sprite.new
@color.bitmap = Bitmap.new(32,32)
@color.x = 32
@color.y = 300
@point = Sprite.new
@point.bitmap = Bitmap.new(16,16)
@point.bitmap.fill_rect(Rect.new(0,0,32,32), Color.new(255,255,255,100))
@point.x = 32
@point.y = 0
up_color
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面被切换就中断循环
if $scene != self
break
end
end
# 装备过渡
Graphics.freeze
end
def update
if Input.trigger?(Input::C)
$color = Color.new(@r,@g,@b)
$scene = Scene_Map.new
end
if Input.trigger?(Input::LEFT)
@use -= 1
@use = 2 if @use < 0
@point.x = (@use+1)*32
@point.y = getactiony
end
if Input.trigger?(Input::RIGHT)
@use += 1
@use = 0 if @use > 2
@point.x = (@use+1)*32
@point.y = getactiony
end
if Input.trigger?(Input::UP)
case @use
when 0
@r -= 1
@r = 1 if @r < 1
when 1
@g -= 1
@g = 1 if @g < 1
when 2
@b -= 1
@b = 1 if @b < 1
end
@point.y -=1
@point.y = 1 if @point.y < 1
up_color
end
if Input.trigger?(Input::DOWN) or Input.press?(Input::DOWN)
case @use
when 0
@r += 1
@r = 255 if @r > 255
when 1
@g += 1
@g = 255 if @g > 255
when 2
@b += 1
@b = 1 if @b > 1
end
@point.y +=1
@point.y = 255 if @point.y > 255
up_color
end
end
def up_color
@color.bitmap.fill_rect(Rect.new(0,0,32,32), Color.new(@r,@g,@b))
end
def getactiony
case @use
when 0
return @r
when 1
return @g
when 2
return @b
end
end
end
复制代码
作者:
禾西
时间:
2008-6-6 21:35
......看到這個腳本,一陣寒意流過身軀
作者:
yangff
时间:
2008-6-7 03:46
http://rpg.blue/viewthread.php?tid=88854
好美
吗!
啊!
真的
不是
好美啊
作者:
雪流星
时间:
2008-6-7 06:00
我是两阵寒意流过
我本来想写一个更多颜色的{/ll}{/fd}
作者:
yangff
时间:
2008-6-7 06:09
以下引用
snstar2006于2008-6-6 22:00:16
的发言:
我是两阵寒意流过
我本来想写一个更多颜色的
256嗷嗷
还可以加透明色,嗷嗷
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1