Redesigned controls help screen, added example of changing encounter version

This commit is contained in:
Maruno17
2021-04-08 21:20:34 +01:00
parent 64d9b38605
commit 327d0de334
12 changed files with 148 additions and 40 deletions

View File

@@ -9,38 +9,67 @@ class ButtonEventScene < EventScene
def initialize(viewport = nil)
super
Graphics.freeze
addImage(0, 0, "Graphics/Pictures/helpbg")
@labels = [
addLabel(52 * 2, 13 * 2, Graphics.width * 3 / 4, _INTL("Moves the main character. Also used to scroll through list entries.")),
addLabel(52 * 2, 53 * 2, Graphics.width * 3 / 4, _INTL("Used to confirm a choice, check things, and talk to people.")),
addLabel(52 * 2, 93 * 2, Graphics.width * 3 / 4, _INTL("Used to exit, cancel a choice or mode, and open the pause menu.")),
addLabel(52 * 2, 133 * 2, Graphics.width * 3 / 4, _INTL("Hold down while walking to run.")),
addLabel(52 * 2, 157 * 2, Graphics.width * 3 / 4, _INTL("Press to use a registered Key Item."))
]
@keys = [
addImage(26 * 2, 18 * 2, "Graphics/Pictures/helpArrowKeys"),
addImage(26 * 2, 59 * 2, "Graphics/Pictures/helpCkey"),
addImage(26 * 2, 99 * 2, "Graphics/Pictures/helpXkey"),
addImage(26 * 2, 130 * 2, "Graphics/Pictures/helpZkey"),
addImage(26 * 2, 154 * 2, "Graphics/Pictures/helpFkey")
]
for key in @keys
key.origin = PictureOrigin::Top
end
for i in 0...5 # Make everything show (almost) immediately
@keys[i].setOrigin(0, PictureOrigin::Top)
@keys[i].setOpacity(0, 255)
end
pictureWait # Update event scene with the changes
@current_screen = 1
addImage(0, 0, "Graphics/Pictures/help_bg")
@labels = []
@label_screens = []
@keys = []
@key_screens = []
addImageForScreen(1, 16, 158, "Graphics/Pictures/help_arrows")
addLabelForScreen(1, 134, 100, 352, _INTL("Use the Arrow keys to move the main character.\r\n\r\nYou can also use the Arrow keys to select entries and navigate menus."))
addImageForScreen(2, 16, 106, "Graphics/Pictures/help_usekey")
addImageForScreen(2, 16, 236, "Graphics/Pictures/help_backkey")
addLabelForScreen(2, 134, 84, 352, _INTL("Used to confirm a choice, interact with people and things, and move through text. (Default: C)"))
addLabelForScreen(2, 134, 212, 352, _INTL("Used to exit, cancel a choice, and cancel a mode. Also used to open the Pause Menu. (Default: X)"))
addImageForScreen(3, 16, 90, "Graphics/Pictures/help_specialkey")
addImageForScreen(3, 16, 252, "Graphics/Pictures/help_zkey")
addLabelForScreen(3, 134, 52, 352, _INTL("Has various functions depending on context. While moving around, hold to move at a different speed. (Default: Z)"))
addLabelForScreen(3, 134, 212, 352, _INTL("Press to open the Ready Menu, where registered items and available field moves can be used. (Default: D)"))
set_up_screen(@current_screen)
Graphics.transition(20)
# Go to next screen when user presses C
onCTrigger.set(method(:pbOnScreen1))
# Go to next screen when user presses USE
onCTrigger.set(method(:pbOnScreenEnd))
end
def pbOnScreen1(scene,*args)
# End scene
Graphics.freeze
scene.dispose
Graphics.transition(20)
def addLabelForScreen(number, x, y, width, text)
@labels.push(addLabel(x, y, width, text))
@label_screens.push(number)
@picturesprites[@picturesprites.length - 1].opacity = 0
end
def addImageForScreen(number, x, y, filename)
@keys.push(addImage(x, y, filename))
@key_screens.push(number)
@picturesprites[@picturesprites.length - 1].opacity = 0
end
def set_up_screen(number)
@label_screens.each_with_index do |screen, i|
@labels[i].moveOpacity((screen == number) ? 10 : 0, 10, (screen == number) ? 255 : 0)
end
@key_screens.each_with_index do |screen, i|
@keys[i].moveOpacity((screen == number) ? 10 : 0, 10, (screen == number) ? 255 : 0)
end
pictureWait # Update event scene with the changes
end
def pbOnScreenEnd(scene, *args)
last_screen = [@label_screens.max, @key_screens.max].max
if @current_screen >= last_screen
# End scene
Graphics.freeze
Graphics.transition(20, "fadetoblack")
scene.dispose
else
# Next screen
@current_screen += 1
onCTrigger.clear
set_up_screen(@current_screen)
onCTrigger.set(method(:pbOnScreenEnd))
end
end
end