FadingSprite XP
by Kyonides
Introduction
Have you ever needed a script that could let you make your sprite appear and disappear at regular intervals without forcing you to learn how to code?
Today gotta be your lucky day then!
Just follow 2 instructions included in my comments and you will be fine!
The Script
Code:
# * FadingSprite * #
# Scripter : Kyonides Arkanthes
# 2023-01-05
# * Create a New Fading Sprite - 2 Options
# @sprite = FadingSprite.new(Frames)
# @sprite = FadingSprite.new(Frames, Viewport)
# * Update the Fading Sprite's Opacity
# @sprite.update
class FadingSprite < Sprite
def initialize(total_frames, vp=nil)
super(vp)
self.opacity = 0
@frames = total_frames
@timer = 0
@fade_type = :in
end
def update
if @timer > 0
@timer -= 1
return if @timer > 0
@fade_type = @next_fade == :in ? :in : :out
return
elsif @fade_type == :in
self.opacity += 16
if self.opacity == 255
@fade_type = nil
@next_fade = :out
end
return
elsif @fade_type == :out
self.opacity -= 16
if self.opacity == 0
@fade_type = nil
@next_fade = :in
end
return
end
@timer = @frames
end
end
Here is a Test Scene for RMXP (HiddenChest).
Code:
class AnyButtonScene
def main
$data_system = load_data("Data/System.rxdata")
$game_system = Game_System.new
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
@title = Sprite.new
@title.y = 40
@title.bitmap = b1 = Bitmap.new(640, 44)
b1.font.size = 40
b1.draw_text(0, 0, 640, 40, Game::DATA["Title"], 1)
@label = FadingSprite.new(Graphics.frame_rate / 2)
@label.y = 436
@label.opacity = 0
@label.bitmap = b2 = Bitmap.new(640, 32)
b2.font.size = 28
b2.draw_text(0, 0, 640, 28, "Press Any Button", 1)
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
Graphics.freeze
@label.bitmap.dispose
@label.dispose
@title.bitmap.dispose
@title.dispose
@sprite.bitmap.dispose
@sprite.dispose
end
def update
@label.update
if Input.trigger_any?
$game_system.se_play($data_system.decision_se)
$scene = Scene_Title.new
end
end
end
I got to admit here that you will need to make your own test scene for other RGSS based engines.
Terms & Conditions
Free for user ANYWHERE.
Just keep in mind that you should mention me in your game credits.
I really hope this script won't be the only one you include in your game project.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!
Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!
Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE