-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
110 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,61 @@ | ||
module Effects | ||
def self.fade_in | ||
@opacity = 255 | ||
@color = Color.new(@opacity, 0, 0, 0) | ||
@fade = $window.draw_quad(0, 0, @color, 640, 0, @color, 0, 480, @color, 640, 480, @color, 500) | ||
for i in 1...255 | ||
@opacity -= 1 | ||
@color = Color.new(@opacity, 0, 0, 0) | ||
@fade = $window.draw_quad(0, 0, @color, 640, 0, @color, 0, 480, @color, 640, 480, @color, 500) | ||
|
||
include Gosu | ||
|
||
class Transition | ||
attr_reader :screen_x | ||
attr_reader :screen_y | ||
attr_reader :mapa | ||
def initialize(scene, type, map) | ||
@next_scene = scene | ||
@map = map | ||
@time = 0 | ||
@fading = type | ||
@fade_time = 255 if @fading == :in | ||
@fade_time = 0 if @fading == :out | ||
@color = Color.new(@fade_time, 0, 0 ,0) | ||
|
||
if @map == true | ||
@mapa = @next_scene.mapa | ||
@screen_x = [[@next_scene.hero.x - 320, 0].max, @next_scene.mapa.width * 32 - 640].min | ||
@screen_y = [[@next_scene.hero.y - 240, 0].max, @next_scene.mapa.height * 32 - 480].min | ||
end | ||
end | ||
def self.fade_out | ||
@opacity = 0 | ||
@color = Color.new(@opacity, 0, 0, 0) | ||
@fade = $window.draw_quad(0, 0, @color, 640, 0, @color, 0, 480, @color, 640, 480, @color, 500) | ||
for i in 1...255 | ||
@opacity += 1 | ||
@color = Color.new(@opacity, 0, 0, 0) | ||
@fade = $window.draw_quad(0, 0, @color, 640, 0, @color, 0, 480, @color, 640, 480, @color, 500) | ||
|
||
def button_down(id) | ||
end | ||
|
||
def solid_event_infront?(character) | ||
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 | ||
|
||
end | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
include Gosu | ||
|
||
class Scene_Intro | ||
def initialize(window) | ||
#@font = Font.new(window, "Verdana", 18) | ||
@background = Image.new(window, "graphics/gosu-splash.png", true) | ||
@window = window | ||
@time = 0 | ||
@fading = :in | ||
@fade_time = 255 | ||
@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 | ||
@fading = :wait | ||
else | ||
@fade_time -= 1 # 15 is cool | ||
end | ||
when :wait | ||
@time += 1 | ||
if @time >= 200 | ||
@fading = :out | ||
end | ||
when :out | ||
if @fade_time >= 255 | ||
$scene = Transition.new(Scene_Title.new($window), :in, false)#Scene_Title.new($window) | ||
else | ||
@fade_time += 1 # 15 is cool | ||
end | ||
end | ||
|
||
self.draw | ||
end | ||
def draw | ||
@background.draw(0,0,0) | ||
@window.draw_quad(0, 0, @color, 640, 0, @color, 0, 480, @color, 640, 480, @color, 500) | ||
#@font.draw("fade time: "+@fade_time.to_s, 0, 0, 600) | ||
#@font.draw("wait time: "+@time.to_s, 0, 30, 600) | ||
#@font.draw(@fading.to_s, 0, 60, 600) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.