Started by Jaiden, November 04, 2017, 05:48:35 pm
#Assuming @com is the sprite bitmap for the "selection" sprite...for i in 1...17 if @com.opacity > 0 @com.opacity = 255 - i * 15 elsif @com.opacity < 255 @com.opacity = 0 + i * 15 endend
# making sure the @com_opacity_direction variable exists and changes direction of opacity changeif @com.opacity == 255 @com_opacity_direction = -1elsif @com.opacity == 0 || @com_opacity_direction == nil @com_opacity_direction = 1end# actual change of firstname.lastname@example.org += @com_opacity_direction * 15
Quote from: winkioI do not speak to bricks, either as individuals or in wall form.
Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.
Quote from: Heretic86 on November 05, 2017, 05:21:18 pmI think you can actually do this without any scripts, and just by using a Windowskin.In the title screen of my "collection" demo, I used a "glow" windowskin so that a glow would appear behind the Menu Items of New Game, Continue, and Shut Down. Once you start your game, you can change the Windowskin to whatever you want to appear during gameplay.The Windowskin is still rectangular in shape, but due to the way the Opacity is set in the image file, it doesnt appear to have a solid border.
sprite1 = Sprite.newsprite2 = Sprite.newsprite1.bitmap = [file1]sprite2.bitmap = [file2]
# Draw the title pictures case @command_window.index when 0 #Draw "new game" @com.bitmap = RPG::Cache.title("Com_01") @com_glow.bitmap = RPG::Cache.title("Com_01_G") #Call glowing method glowing_selection when 1 #Draw "continue" # Check if continue is disabled unless @continue_enabled #Draw faded out @com.bitmap = RPG::Cache.title("Com_02_Disable") else # Draw regular @com.bitmap = RPG::Cache.title("Com_02") @com_glow.bitmap = RPG::Cache.title("Com_02_G") #Call glowing method glowing_selection end when 2 #Draw "end" @com.bitmap = RPG::Cache.title("Com_03") @com_glow.bitmap = RPG::Cache.title("Com_03_G") #Call glowing method glowing_selection when 3 #Draw "credits" @com.bitmap = RPG::Cache.title("Com_04") @com_glow.bitmap = RPG::Cache.title("Com_04_G") #Call glowing method glowing_selection end
#Method for glowing selection def glowing_selection #Fade it in and out #Check the direction variable exists if @com_glow.opacity == 255 com_opacity_direction = -1 elsif @com_glow.opacity == 0 || com_opacity_direction == nil com_opacity_direction = 1 end #Fade the sprite in and out @com_glow.opacity += (com_opacity_direction * 15) end
Frame 1: com_opacity_direction = -1 (since sprite is 255 opacity), sprite opacity = 240Frame 2: com_opacity_direction = 1 (since com_opacity_direction is nil), sprite opacity = 255Frame 3: com_opacity_direction = -1, sprite opacity = 240Frame 4: com_opacity_direction = 1, sprite opacity = 255