OmegaDev
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Scene_Menu scripts

3 posters

Page 2 of 2 Previous  1, 2

Go down

Scene_Menu scripts - Page 2 Empty Re: Scene_Menu scripts

Post by Peva Sun Nov 28, 2010 3:37 pm

It looks great! Except for one error. The moving sprite has a sprite shadow. Here's a screen.

Scene_Menu scripts - Page 2 Yuck

Kinda see the shadow of the sprite? Can you get rid of that? Other than that it looks fantastic.
Peva
Peva
Development Moderator
Development Moderator

Posts : 1281
Gald : 4414

Stats
Cookies: 0

Back to top Go down

Scene_Menu scripts - Page 2 Empty Re: Scene_Menu scripts

Post by IMP1 Sun Nov 28, 2010 3:45 pm

replace the bit at the bottom, starting with class Window_Base < Window
right down to the bottom with this:
Code:
class Window_Base < Window
 
  def draw_actor_frame(actor, x, y, frame = 1)
    return if actor.character_name == nil
    bitmap = Cache.character(actor.character_name)
    sign = actor.character_name[/^[\!\$]./]
    if sign != nil and sign.include?('$')
      cw = bitmap.width / 3
      ch = bitmap.height / 4
    else
      cw = bitmap.width / 12
      ch = bitmap.height / 8
    end
    n = actor.character_index
    src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
    if frame == 0
      src_rect.x -= cw
    elsif frame == 2
      src_rect.x += cw
    end
    self.contents.clear_rect(0,48+WLH,self.contents.width,196)
    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  end
 
end
And tell me if that's better.
IMP1
IMP1
Coding Moderator
Coding Moderator

Posts : 503
Gald : 1399

Stats
Cookies: 5

Back to top Go down

Scene_Menu scripts - Page 2 Empty Re: Scene_Menu scripts

Post by Peva Sun Nov 28, 2010 3:50 pm

Looks good, but two more things. Right before the play time, can you have it say "Play Time" and I hope you can do this, make the player walk in several different directions? (Eg: walk in place down for 3 seconds, then walk in place left for 3 seconds, up then right, etc.) if possible? Thanks in advance!
Peva
Peva
Development Moderator
Development Moderator

Posts : 1281
Gald : 4414

Stats
Cookies: 0

Back to top Go down

Scene_Menu scripts - Page 2 Empty Re: Scene_Menu scripts

Post by IMP1 Sun Nov 28, 2010 5:15 pm

Code:
class Scene_MadeUpName < Scene_Base
 
  Animal_Variable  = 3
  Yest_Earn_Var    = 4
  Day_Variable      = 5
  Well_Variable    = 6
  Bank_Variable    = 7
 
  Animal_Icon_ID    = 1
  Yest_Earn_Icon_ID = 2
  Day_Icon_ID      = 3
  Well_Icon_ID      = 4
  Bank_Icon_ID      = 5
 
  Sprite_Frequency  = 12 # The higher the number, the slower the movement
  Turn_Frequency    = 168 # This must be a multiple of Sprite_Frequency
  Black_Background_Behind_Windows = true
 
  WLH = Window_Base::WLH
 
  def start
    create_menu_background if !Black_Background_Behind_Windows
    @window1 = Window_Base.new(0,0,Graphics.width,Graphics.height/4)
    @window2 = Window_Base.new(0, Graphics.height/4, Graphics.width/3, 3*Graphics.height/4)
    @window3 = Window_Base.new(Graphics.width/3,Graphics.height/4,2*Graphics.width/3,3*Graphics.height/4)
   
    @window1.contents.font.size = 32
    text = $game_actors[2].name + " Town"
    @window1.contents.draw_text(0,0,@window1.contents.width,32,text,1)
    @window1.contents.font.size = WLH
    draw_time
   
    @window2.contents.font.bold = true
    @window2.contents.draw_text(0,0,@window2.contents.width,WLH,"Player",1)
    @window2.contents.font.bold = false
    text = $game_actors[1].name
    @window2.contents.draw_text(0,48,@window2.contents.width,WLH,text,1)
    @frame = 0
    @direction = 0
    x = @window2.contents.width / 2
    @window2.draw_actor_frame($game_actors[1],x,160,@frame,@direction)
    draw_sprite
    @window3.contents.font.bold = true
    @window3.contents.draw_text(0,0,@window3.contents.width,WLH,"Statistics",1)
    @window3.contents.font.bold = false
    @window3.draw_icon(Animal_Icon_ID,0,48)
    text = "Animals: #{$game_variables[Animal_Variable]}"
    @window3.contents.draw_text(32,48,@window3.contents.width,WLH,text,0)
    @window3.draw_icon(Yest_Earn_Icon_ID,0,48+(1*WLH))
    text = "Yesterday's Earnings: #{$game_variables[Yest_Earn_Var]}"
    @window3.contents.draw_text(32,48+(1*WLH),@window3.contents.width,WLH,text,0)
    @window3.draw_icon(Day_Icon_ID,0,48+(2*WLH))
    text = "Day: #{$game_variables[Day_Variable]}"
    @window3.contents.draw_text(32,48+(2*WLH),@window3.contents.width,WLH,text,0)
    @window3.draw_icon(Well_Icon_ID,0,48+(3*WLH))
    text = "Well: #{$game_variables[Well_Variable]}"
    @window3.contents.draw_text(32,48+(3*WLH),@window3.contents.width,WLH,text,0)
    @window3.draw_icon(Bank_Icon_ID,0,48+(4*WLH))
    text = "Bank: #{$game_variables[Bank_Variable]}"
    @window3.contents.draw_text(32,48+(4*WLH),@window3.contents.width,WLH,text,0)
   
  end
 
  def update
    update_input
    draw_sprite
    draw_time
    @window1.update
    @window2.update
    @window3.update
  end
 
  def update_input
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::C)
      Sound.play_decision
      return_scene
    end
  end
 
  def return_scene
    $scene = Scene_Map.new
  end
 
  def draw_sprite
    if Graphics.frame_count % Turn_Frequency == 0
      @direction += 1
      @direction %= 4
    end
    if Graphics.frame_count % Sprite_Frequency == 0
      @frame += 1; @frame %= 4
      x = @window2.contents.width / 2
      @window2.draw_actor_frame($game_actors[1],x,160,@frame,@direction)
    end
  end
 
  def draw_time
    @window1.contents.clear_rect(0,32,@window1.contents.width,WLH)
    secs = sprintf("%02d", (Graphics.frame_count/Graphics.frame_rate)%60)
    mins = sprintf("%02d", ((Graphics.frame_count/Graphics.frame_rate)/60)%60)
    hours = ((Graphics.frame_count/Graphics.frame_rate)/60)/60
    text = "Playtime:  #{hours}:#{mins}:#{secs}"
    @window1.contents.draw_text(0,32,@window1.contents.width,WLH,text,1)
  end
 
  def terminate
    @window1.dispose
    @window2.dispose
    @window3.dispose
    dispose_menu_background if !Black_Background_Behind_Windows
  end
 
end

class Window_Base < Window
 
  def draw_actor_frame(actor, x, y, frame = 1, direction = 0)
    return if actor.character_name == nil
    bitmap = Cache.character(actor.character_name)
    sign = actor.character_name[/^[\!\$]./]
    if sign != nil and sign.include?('$')
      cw = bitmap.width / 3
      ch = bitmap.height / 4
    else
      cw = bitmap.width / 12
      ch = bitmap.height / 8
    end
    n = actor.character_index
    src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
    if frame == 0
      src_rect.x -= cw
    elsif frame == 2
      src_rect.x += cw
    end
    src_rect.y += (ch * direction)
    self.contents.clear_rect(0,48+WLH,self.contents.width,196)
    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  end
 
end
Replace it all.
IMP1
IMP1
Coding Moderator
Coding Moderator

Posts : 503
Gald : 1399

Stats
Cookies: 5

Back to top Go down

Scene_Menu scripts - Page 2 Empty Re: Scene_Menu scripts

Post by Peva Sun Nov 28, 2010 5:22 pm

woo looks great thanks Smile
Peva
Peva
Development Moderator
Development Moderator

Posts : 1281
Gald : 4414

Stats
Cookies: 0

Back to top Go down

Scene_Menu scripts - Page 2 Empty Re: Scene_Menu scripts

Post by IMP1 Mon Nov 29, 2010 1:40 am

No problem, sorry about the wait.

Back to ma non-RMVX game B)
IMP1
IMP1
Coding Moderator
Coding Moderator

Posts : 503
Gald : 1399

Stats
Cookies: 5

Back to top Go down

Scene_Menu scripts - Page 2 Empty Re: Scene_Menu scripts

Post by Sponsored content


Sponsored content


Back to top Go down

Page 2 of 2 Previous  1, 2

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum