Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Titlescreen < Scene_Base
- def initialize
- super
- @index = 0
- create_nav_points
- update_background
- create_background
- end
- def start
- $data_system.title_bgm.play
- RPG::BGS.stop
- RPG::ME.stop
- end
- def transition_speed
- return 15
- end
- def update
- super
- Graphics.frame_reset
- create_nav_points
- process_cursor_move
- process_handling
- update_background
- end
- def create_nav_points
- points = {
- 0 => {
- "title" => "Neues Spiel",
- "icon" => "main_menu_new",
- },
- 1 => {
- "title" => "Spiel laden",
- "icon" => "main_menu_continue",
- },
- 2 => {
- "title" => "Beenden",
- "icon" => "main_menu_exit",
- }
- }
- @box_list = [];
- count = points.length
- points.each { |key,value|
- x = ((640/count) - 40) * key;
- y = 240
- @box_list[key] = create_point key,value,count,x,y
- }
- end
- def create_point(key,point,count,x,y)
- nav_point = {}
- nav_point['bg'] = Sprite.new
- nav_point['bg'].bitmap = Bitmap.new 640,480
- nav_point['bg'].bitmap.gradient_fill_rect(
- x + 20, y, 160, 160,
- Color.new(54,54,54),
- Color.new(0,0,0),0)
- nav_point['title'] = Sprite.new
- nav_point['title'].bitmap = Bitmap.new 640,480
- nav_point['title'].bitmap.draw_text(x + 20, y + 30, 160, 160,
- point['title'],1)
- nav_point['icon'] = Sprite.new
- nav_point['icon'].bitmap = Cache.picture point['icon']
- nav_point['icon'].x = x + 70
- nav_point['icon'].y = y + 30
- nav_point
- end
- def create_background
- @sprite = Sprite.new
- whitescreen = Bitmap.new(640,480);
- whitescreen.fill_rect(0,0,640,480,Color.new(255,255,255))
- @sprite.bitmap = whitescreen
- @sprite3 = Sprite.new
- @sprite3.bitmap = Cache.title1("logo")
- end
- def process_cursor_move
- cursor_right(Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT)
- cursor_left (Input.trigger?(:LEFT)) if Input.repeat?(:LEFT)
- end
- def update_background
- @box_list.each_with_index do |point,index|
- x = ((640/@box_list.length) - 40) * index;
- y = 240
- @box_list[index]['bg'].bitmap.clear
- @box_list[index]['bg'].bitmap.gradient_fill_rect(
- x + 20, y, 160, 160,
- Color.new(54,54,54),
- Color.new(0,0,0),0)
- end
- x = ((640/@box_list.length) - 40) * @index;
- y = 240
- @box_list[@index]['bg'].bitmap.clear
- @box_list[@index]['bg'].bitmap.fill_rect(
- x + 20, y, 160, 160,
- Color.new(177,0,0))
- end
- def cursor_right trigger
- @index += 1
- if @index >= @box_list.length
- @index = 0
- end
- Sound.play_cursor
- end
- def cursor_left trigger
- @index -= 1
- if @index < 0
- @index = (@box_list.length - 1)
- end
- Sound.play_cursor
- end
- def process_handling
- return process_ok if Input.trigger?(:C)
- end
- def process_ok
- if @index == 1
- end
- if @index == 2
- end
- if @index == 3
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement