indexing description: "[ Instructions Menu - Item Effects ]" date: "$Date$" revision: "$Revision$" class BB_INSTRUCTIONS_ITEMS inherit BB_MENU create make feature {NONE} -- Initialization make is -- create widgets local button: BB_MENU_BUTTON item_image: EM_IMAGEPANEL i: INTEGER label: EM_LABEL text_x, text_x_distance, line_spacing, start_y, current_y: INTEGER text_font: EM_TTF_FONT how_to_string: STRING do init_menu -- create menu items create button.make ("Back") button.set_position (Window_width // 2 - button.width // 2, 170 + 7 * 50) button.pressed_event.subscribe (agent back_button_pressed) add_button (button) set_selected_menu_item(1) video_subsystem.show_cursor from i := 1 until i > 33 loop create item_image.make_from_file ("./images/items/" + i.out + ".png") item_image.set_position (30 + ((i - 1) // 9) * 40, 150 + ((i - 1) \\ 9) * 40) item_image.mouse_clicked_event.subscribe (agent item_click (i, ?)) item_image.set_transparent add_widget (item_image) i := i + 1 end text_x := 225 text_x_distance := 125 line_spacing := 30 start_y := 350 current_y := start_y text_font := Standard_ttf_fonts.bitstream_vera_sans (17) how_to_string := "Click on an item to hear it's sound effect and see it's description. %N% % %N% %Whenever an item is active, every score change is multiplied %N% %with the corresponding multiplier. If several items are active %N% %at the same time, their multipliers are multiplied with each other." create label.make_from_text (how_to_string) label.enable_multilined label.set_font (text_font) label.set_foreground_color (create {EM_COLOR}.make_white) label.resize_to_optimal_dimension label.set_position (text_x, 150) add_widget (label) create label.make_from_text ("Name:") label.set_font (text_font) label.set_foreground_color (create {EM_COLOR}.make_white) label.resize_to_optimal_dimension label.set_position (text_x, current_y) add_widget (label) current_y := current_y + line_spacing create label.make_from_text ("Description:") label.set_font (text_font) label.set_foreground_color (create {EM_COLOR}.make_white) label.resize_to_optimal_dimension label.set_position (text_x, current_y) add_widget (label) current_y := current_y + line_spacing * 2 - 10 create label.make_from_text ("Duration:") label.set_font (text_font) label.set_foreground_color (create {EM_COLOR}.make_white) label.resize_to_optimal_dimension label.set_position (text_x, current_y) add_widget (label) current_y := current_y + line_spacing create label.make_from_text ("Multiplier:") label.set_font (text_font) label.set_foreground_color (create {EM_COLOR}.make_white) label.resize_to_optimal_dimension label.set_position (text_x, current_y) add_widget (label) current_y := start_y create name_text.make_from_text ("") name_text.set_font (text_font) name_text.set_foreground_color (create {EM_COLOR}.make_white) name_text.resize_to_optimal_dimension name_text.set_position (text_x + text_x_distance, current_y) add_widget (name_text) current_y := current_y + line_spacing create description_text.make_from_text ("") description_text.enable_multilined description_text.set_font (text_font) description_text.set_foreground_color (create {EM_COLOR}.make_white) description_text.resize_to_optimal_dimension description_text.set_position (text_x + text_x_distance, current_y) add_widget (description_text) current_y := current_y + line_spacing * 2 - 10 create duration_text.make_from_text ("") duration_text.set_font (text_font) duration_text.set_foreground_color (create {EM_COLOR}.make_white) duration_text.resize_to_optimal_dimension duration_text.set_position (text_x + text_x_distance, current_y) add_widget (duration_text) current_y := current_y + line_spacing create multiplier_text.make_from_text ("") multiplier_text.set_font (text_font) multiplier_text.set_foreground_color (create {EM_COLOR}.make_white) multiplier_text.resize_to_optimal_dimension multiplier_text.set_position (text_x + text_x_distance, current_y) add_widget (multiplier_text) end feature -- Events item_click (item: INTEGER; mousebutton_event: EM_MOUSEBUTTON_EVENT) is -- show item description and play item sound require mousebutton_event_not_void: mousebutton_event /= Void local name: STRING description: STRING duration: STRING multiplier: STRING do inspect item when 1 then play_sound (Sound_bar_large) name := "Large Bar" description := "The bar grows" duration := "10 seconds" multiplier := "0.5" when 2 then play_sound (Sound_bar_small) name := "Small Bar" description := "The bar shrinks" duration := "10 seconds" multiplier := "2" when 3 then play_sound (Sound_bar_fast) name := "Fast Bar" description := "The bar moves faster" duration := "10 seconds" multiplier := "1.5" when 4 then play_sound (Sound_bar_slow) name := "Slow Bar" description := "The bar moves slower" duration := "10 seconds" multiplier := "3" when 5 then play_sound (Sound_life_up) name := "Extra Life" description := "You gain an extra life" duration := "-" multiplier := "-" when 6 then play_sound (Sound_input_inverted) name := "Inversion" description := "The bar moves right if you press left %Nand vice versa" duration := "10 seconds" multiplier := "3" when 7 then play_sound (Sound_input_freezed) name := "Freeze" description := "You can't move the bar anymore" duration := "5 seconds" multiplier := "10" when 8 then play_sound (Sound_points) name := "Bonus points" description := "You gain 1000 bonus points, multiplied with the %Ncurrent score multiplier" duration := "-" multiplier := "-" when 9 then play_sound (Sound_loose_life) name := "Skull" description := "You loose a life, but you gain 3000 bonus points %Nmultiplied with the current score multiplier" duration := "-" multiplier := "-" when 10 then play_sound (Sound_invulnerable) name := "Invulnerability" description := "Balls bounce off from the bottom screen border" duration := "12 seconds" multiplier := "0.2" when 11 then play_sound (Sound_ball_fast) name := "Fast Ball" description := "Balls move faster" duration := "10 seconds" multiplier := "2" when 12 then play_sound (Sound_ball_slow) name := "Slow Ball" description := "Balls move slower" duration := "15 seconds" multiplier := "0.5" when 13 then play_sound (Sound_fly_away) name := "Balloon Ball" description := "Balls also leave the screen at the top, %Njust as they do at the bottom" duration := "7.5 seconds" multiplier := "7.5" when 14 then play_sound (Sound_angle_high) name := "Maximal Deflection" description := "Balls are deflected as much as possible" duration := "10 seconds" multiplier := "2" when 15 then play_sound (Sound_angle_low) name := "No Deflection" description := "Balls are deflected after the famous rule: %N%"angle of incidence equals angle of reflexion%"" duration := "10 seconds" multiplier := "2" when 16 then play_sound (Sound_loose_points) name := "Weight" description := "You loose 1000 points, %Nmultiplied with the current score multiplier" duration := "-" multiplier := "-" when 17 then play_sound (Sound_split_to_2) name := "Axe" description := "One ball is split into 2 balls, but be careful" duration := "-" multiplier := "-" when 18 then play_sound (Sound_split_to_4) name := "Smilies" description := "One ball is split into 4 balls" duration := "-" multiplier := "-" when 19 then play_sound (Sound_split_to_6) name := "Bomb" description := "One ball is split into 6 balls" duration := "-" multiplier := "-" when 20 then play_sound (Sound_artillery) name := "Artillery Fire" description := "8 balls are shot straight up from the bottom" duration := "-" multiplier := "-" when 21 then play_sound (Sound_transparent_ball) name := "Transparent Ball" description := "Balls are black circles. %NThis isn't a problem on bright backgrounds but..." duration := "10 seconds" multiplier := "3" when 22 then play_sound (Sound_next_level) name := "Next Level" description := "You immediately reach the next level" duration := "-" multiplier := "-" when 23 then play_sound (Sound_stick_on_bar) name := "Glue" description := "Balls stick on the bar. %NYou have to launch them all the time" duration := "15 seconds" multiplier := "7.5" when 24 then play_sound (Sound_destroy_all) name := "Full penetration" description := "Balls destroy all blocks they touch %Nwithout being reflected" duration := "5 seconds" multiplier := "0.25" when 25 then play_sound (Sound_destroy_random) name := "Air Attack" description := "Each block has a chance of one fifth %Nto get destroyed" duration := "-" multiplier := "0" when 26 then play_sound (Sound_disappear) name := "Vanish" description := "Grey blocks vanish" duration := "10 seconds" multiplier := "0.75" when 27 then play_sound (Sound_bad_item) name := "Bad Item" description := "Following bad effects are started: %NSmall Bar, Slow Bar, Fast Ball and Balloon Ball" duration := "10 seconds" multiplier := "0.2" when 28 then play_sound (Sound_good_item) name := "The Cow" description := "Following good effects are started: %NLarge Bar, Fast Bar, Slow Ball and Invulnerability" duration := "-" multiplier := "-" when 29 then name := "Russian Roulette" description := "One of 8 very good or very bad effects is started" duration := "-" multiplier := "-" when 30 then play_sound (Sound_transparent_bar) name := "Transparent Bar" description := "The bar is only a black contour. %NThis isn't problem on a bright background but..." duration := "10 seconds" multiplier := "3" when 31 then play_sound (Sound_divert) name := "Diversion" description := "Balls randomly change their direction %Nand you get 200 points" duration := "-" multiplier := "-" when 32 then play_sound (Sound_drive_left) name := "Left-Hand Twist" description := "The bar moves constantly to the left" duration := "10 seconds" multiplier := "3" when 33 then play_sound (Sound_drive_right) name := "Right-Hand Twist" description := "The bar moves constantly to the right" duration := "10 seconds" multiplier := "3" else name := "" description := "" duration := "" multiplier := "" end name_text.set_text (name) name_text.resize_to_optimal_dimension description_text.set_text (description) description_text.resize_to_optimal_dimension duration_text.set_text (duration) duration_text.resize_to_optimal_dimension multiplier_text.set_text (multiplier) multiplier_text.resize_to_optimal_dimension end back_button_pressed is -- back button pressed do set_next_scene (create {BB_INSTRUCTIONS}.make) start_next_scene end feature {NONE} -- Implementation name_text: EM_LABEL description_text: EM_LABEL duration_text: EM_LABEL multiplier_text: EM_LABEL end