05-06-2020, 09:41 AM
Toggling a Bump for Fun!
In version 1.1.56 of your favorite local engine, you are now able to make custom toggle buttons or radio buttons or the like.
By creating a custom sprite class object you can assign it its active and inactive states and the selected button and it will automatically pick either the active or inactive state bitmap. Of course, you still need to setup the button state yoursefl.
You got to admit it is a highly convenient feature for it lets you forget about creating several sprites and then group them in a set only to get a single button sprite work as expected.
Don't worry, guys! You can change the graphics at any time!
Just make sure the button is slightly smaller than the button backdrop sprite.
Sadly, there are only *Ubuntu binary executables available right now.
Here you can take a look at the test script I have been using while playing with HiddenChest.
Code:
module ButtonData
TITLE = "Scene Settings"
BACKDROP = 'recycle texture'
ICONS = %w{toggle1 toggle2 toggle3}
LABELS = ['Find Treasures', 'Kick Asses', 'Play Minigames',
'Contract Covid-19', 'Hug Corona-chan']
end
class MenuScene
def main
@timer = 0
@bg = Sprite.new
@bg.bitmap = RPG::Cache.title(ButtonData::BACKDROP)
@title = Sprite.new
@title.set_xy(Graphics.width / 2 - 120, 8)
@title.bitmap = bit = Bitmap.new(240, 32)
bit.draw_text(0, 0, 240, 32, ButtonData::TITLE, 1)
@buttons = []
@labels = []
@states = [true, false, true, false, true]
total = ButtonData::LABELS.size
total.times do |n|
cy = 44 + n * 32
sprite = ToggleButtonSprite.new
sprite.set_xy(8, cy)
sprite.bitmap_on = RPG::Cache.icon(ButtonData::ICONS[0])
sprite.bitmap_off = RPG::Cache.icon(ButtonData::ICONS[1])
sprite.button = RPG::Cache.icon(ButtonData::ICONS[2])
sprite.state = @states[n]
@buttons << sprite
sprite = Sprite.new
sprite.set_xy(36, cy)
sprite.bitmap = bit = Bitmap.new(160, 28)
bit.draw_text(0, 0, bit.width, bit.height, ButtonData::LABELS[n])
@labels << sprite
end
Graphics.transition
main_loop while $scene == self
Graphics.freeze
(@buttons + @labels).each{|b| b.dispose }
@title.dispose
@bg.dispose
@states.clear
end
def main_loop
Graphics.update
Input.update
update
end
def update
return @timer -= 1 if @timer > 0
if Input.trigger?(Input::B)
Audio.play_cancel
$scene = Scene_Title.new
return
elsif Input.trigger?(Input::C)
Audio.play_ok
@buttons[0].state = !@buttons[0].state
elsif @buttons[0].mouse_above? and Input.left_click?
Audio.play_ok
@buttons[0].state = !@buttons[0].state
@timer = Graphics.frame_rate / 3
elsif Input.trigger?(Input::KeyP)
Audio.play_ok
Graphics.save_screenshot
end
end
end
Those Ubuntu or Kubuntu users or similar Linuxers break a leg!
Perhaps I should say break a finger instead!?
"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