level 1
pokmber
楼主
能让图片移动,但是如果做到发出子弹?
判断图片当前所在位置`判断图片的“正方向”判断按下某键时从图片当前位置产生图片“子弹”“子弹”向前移动几个位置后,消失or爆炸图片.
我是如此理解的,,,请大家不吝指教··
begin
devil = Sprite.new
devil.bitmap = Bitmap.new("Graphics/Battlers/075-Devil01")
#1代表向上
Dir = 1
loop do
Graphics.update
Input.update
if Input.press?(Input::UP)
devil.y = devil.y - 1
Dir = 1
end
if Input.press?(Input::DOWN)
devil.y = devil.y + 1
Dir = 2
end
if Input.press?(Input::LEFT)
devil.x = devil.x - 1
Dir = 3
end
if Input.press?(Input::RIGHT)
devil.x = devil.x + 1
Dir = 4
end
if Input.trigger?(Input::C)
p Dir
end
end
end
2010年09月02日 02点09分
1
判断图片当前所在位置`判断图片的“正方向”判断按下某键时从图片当前位置产生图片“子弹”“子弹”向前移动几个位置后,消失or爆炸图片.
我是如此理解的,,,请大家不吝指教··
begin
devil = Sprite.new
devil.bitmap = Bitmap.new("Graphics/Battlers/075-Devil01")
#1代表向上
Dir = 1
loop do
Graphics.update
Input.update
if Input.press?(Input::UP)
devil.y = devil.y - 1
Dir = 1
end
if Input.press?(Input::DOWN)
devil.y = devil.y + 1
Dir = 2
end
if Input.press?(Input::LEFT)
devil.x = devil.x - 1
Dir = 3
end
if Input.press?(Input::RIGHT)
devil.x = devil.x + 1
Dir = 4
end
if Input.trigger?(Input::C)
p Dir
end
end
end