Hi :3
I'll explain how to make "fades" in an easy way, ill use a 640x480 resolution.
first you need a scene system like this:
viewtopic.php?f=191&t=67246
then we will make a scene called Transition with this content:
If you see the code you will know that the fade is really a black image which is increasing (or decreasing) its opacity.
Fades are normally short, because while the fade is processing, the update is running and can origin problems =)
The correct use is: $scene = Transition.new(next_scene, type_of_fade)
$scene = Transition.new(Porn_Room.new, :in/ut)
I'll explain how to make "fades" in an easy way, ill use a 640x480 resolution.
first you need a scene system like this:
viewtopic.php?f=191&t=67246
then we will make a scene called Transition with this content:
Ruby:
include Gosu
class Transition
attr_reader :screen_x
attr_reader :screen_y
def initialize(scene, type)
@next_scene = scene
@time = 0
@fading = type
@fade_time = 255 if @fading == :in
@fade_time = 0 if @fading == :out
@color = Color.new(@fade_time, 0, 0 ,0)
end
def button_down(id)
end
def update
@color = Color.new(@fade_time, 0, 0 ,0)
case @fading
when :in
if @fade_time <= 0
$scene = @next_scene
else
@fade_time -= 15 # 15 is cool
end
when :out
if @fade_time >= 255
$scene = @next_scene
else
@fade_time += 15 # 15 is cool
end
end
self.draw
end
def draw
@next_scene.update
$window.draw_quad(0, 0, @color, 640, 0, @color, 0, 480, @color, 640, 480, @color, 500)
end
end
If you see the code you will know that the fade is really a black image which is increasing (or decreasing) its opacity.
Fades are normally short, because while the fade is processing, the update is running and can origin problems =)
The correct use is: $scene = Transition.new(next_scene, type_of_fade)
$scene = Transition.new(Porn_Room.new, :in/ut)