Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Smash Button!! (Defeat the Bull or Whatever)

Smashing Button System

Version: 1.0

By: MephistoX


Introduction

This Script let you to call a Scene with a Bar with a X number of filled, you need to smash a button to fill the bar, if you fill the bar, a Local switch will be active, else, you return to the Map.

This System is similar to the MK1 Bonus Games, or other Similars like Defeat the Bull,
MK Shaoling Monks, o Resident Evil Open Doors Engine.

For Now, this script is a Kind of template to do something, it doesn't have a really use, but, if you have Imagination, you will make great things :).

Features

  • Very Customizable...very...very
  • Easy to Call
  • I don't Know what more...

Screenshots

It's Ridiculus, like the Harry Potter Spell... :cry:

dibujoswg.png


Demo

Yes, but it's a donkeyness... (If this word Exists...) so, just for fun.

4Shared Link


Script

It's Very Short, so:

Code:
#==============================================================================

# ** Smashing Button System

#------------------------------------------------------------------------------

# MephistoX

# Version 1.0

# 01/03/09

# SDK : Version 2.4+

#------------------------------------------------------------------------------

# * Version History :

#

#   Version 1 ---------------------------------------------------- (01/03/09)

#     - Log : First Version Released

#------------------------------------------------------------------------------

# * Requirements :

#

#   Method & Class Library (2.3 +)

#------------------------------------------------------------------------------

# * Description :

#

#   This Script let you to call a Scene with a Bar with a X number of filled,

#   you need to smash a button to fill the bar, if you fill the bar, a Local

#   switch will be active, else, you return to the Map.

#   

#   This System is similar to the MK1 Bonus Games, or other Similars like

#   Defeat the Bull, MK Shaoling Monks, o Resident Evil Open Doors Engine.

#------------------------------------------------------------------------------

# * Instructions :

#

#   Place The Script Below the SDK and Above Main.

#   Refer to Syntax to call the Smashing Scene

#------------------------------------------------------------------------------

# * Syntax :

#

#   Calling Scene :

#    - Script : Scene_SmashButton.new(map_id, event_id, switch_key, options = {})

#

#   Parameters(Must be Defined)

#   

#   - map_id = Event Map ID, this is to active the Local Switch

#   - event_id = Event ID, see above

#   - switch_key = Local Switch Key('A', 'B', 'C', 'D')

#

#

#               |Options(Optional Use)|                    |Defaults/Examples|

#

#    - 'Gradient' => Gradient Graphic for the Window     = 'MP_001-Oranges01'

#    - 'Button' => Button to smash to fill the Bar       = Input::C

#    - 'Resistance' => Resistance of the Bar             = 1

#    - 'Power' => Smash Button Power                     = 1

#    - 'Filled' => Bar Initial Filled                    = rand_between(20, 50)

#    - 'Max' => Bar Max Filled                           = 100

#

#==============================================================================

 

#------------------------------------------------------------------------------

# * SDK Log Script

#------------------------------------------------------------------------------

SDK.log('Smashing Button System', 'MephistoX', 1.0, '01/03/09')

SDK.check_requirements(2.4, [], {'Method & Class Library' => 2.2})

 

#------------------------------------------------------------------------------

# * Begin SDK Enable Test

#------------------------------------------------------------------------------

if SDK.enabled?('Smashing Button System')

 

#==============================================================================

# ** Scene_SmashButton

#------------------------------------------------------------------------------

#  This class performs Smashing Button Screen Processing.

#==============================================================================

  

class Scene_SmashButton < SDK::Scene_Base

  #--------------------------------------------------------------------------

  # * Object Initialization

  #--------------------------------------------------------------------------

  def initialize(map, event, key, options = {})

    # Sets Default Parameters (If Undefined)

    gradient = options.member?('Gradient') ? options['Gradient'] : 'MP_001-Oranges01'

    button = options.member?('Button') ? options['Button']  : Input::C

    resistance = options.member?('Resistance') ? options['Resistance'] : 1

    power = options.member?('Power') ? options['Power'] : 1

    filled = options.member?('Filled') ? options['Filled'] : rand_between(20, 50)

    max = options.member?('Max') ? options['Max'] : 300

    # Saves Parameters

    @map        = map              # Event Map ID

    @event      = event            # Event ID

    @key        = key              # Local Switch Key

    @gradient   = gradient         # Window's Bar Gradient

    @button     = button           # Button to Trigger

    @resistance = resistance       # Bar Resistance

    @power      = power            # Smash Power

    @filled     = filled           # Initial Filled

    @max        = max              # Maximum Fill

  end

  #--------------------------------------------------------------------------

  # * Main Sprite_Set

  #--------------------------------------------------------------------------

  def main_spriteset

    # Sets Up Spriteset

    @spriteset = Spriteset_Map.new

  end

  #--------------------------------------------------------------------------

  # * Main Processing : Window Initialization

  #--------------------------------------------------------------------------

  def main_window

    super

    @bar_window = Window_Bar.new(@gradient, @filled, @max)

    @bar_window.active = true

  end

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    super

    # Every Frame substrac Resistance to Bar Filling if Self > 0

    @bar_window.filling -= @resistance if @bar_window.filling > 0

    # Refresh Window

    @bar_window.refresh

    # If B button was pressed

    if Input.trigger?(Input::B)

      # Play cancel SE

      $game_system.se_play($data_system.cancel_se)

      # Switch to menu screen

      $scene = Scene_Map.new

      return

    end

    # If Defined Button was pressed

    if Input.trigger?(@button)

      # Play decision SE

      $game_system.se_play($data_system.decision_se)

      # Add XNumber to the Bar Filling if self is > Maximum Filling

      @bar_window.filling += (@power *10) if @bar_window.filling < @max

      return

    end

    # If Bar Filling < 1

    if @bar_window.filling < 1

      # Play wrong SE

      Audio.se_play('Audio/SE/058-Wrong02', 80)

      # Return to Map

      $scene = Scene_Map.new

      return

    end

    # If Bar Filling is Full

    if @bar_window.filling >= @max

      # Active Self Switch

      key = [@map, @event, @key]

      $game_self_switches[key] = true

      $game_map.need_refresh = true

      # Return to Map

      $scene = Scene_Map.new

      return

    end

  end

end

 

 

#==============================================================================

# ** Window_Bar

#------------------------------------------------------------------------------

#  This window displays a Gradient Bar

#==============================================================================

 

class Scene_SmashButton::Window_Bar < Window_Base

  #--------------------------------------------------------------------------

  # * Public Instance Variables

  #--------------------------------------------------------------------------

  attr_accessor :filling         # Bar Initial Filling

  #--------------------------------------------------------------------------

  # * Object Initialization

  #--------------------------------------------------------------------------

  def initialize(gradient, filling, max)

    super(0, 0, 160, 64)

    self.contents = Bitmap.new(width - 32, height - 32)

    self.back_opacity = 160

    @gradient = gradient

    @filling = filling

    @max = max

    refresh

  end

  #--------------------------------------------------------------------------

  # * Refresh

  #--------------------------------------------------------------------------

  def refresh

    self.contents.clear

    # Draw Gradient Bara

    self.contents.draw_trick_gradient_bar(0, 0, @filling, @max, 

    @gradient, self.width - 32, 8, 'MP_001-Back01','MP_001-Back02')

  end

end

 

#--------------------------------------------------------------------------

# * End SDK Enable Test

#--------------------------------------------------------------------------

end


Instructions

See the Script Header, it's very simple.

FAQ

None yet...

Compatibility

- Requires SDK 2.4+
- Requires MACL 2.3+

It's very simple, no more.


Credits and Thanks

Well, I think, Credits to Me xD.


Author's Notes

Any comment?, Question, Bug?.... Leave a Message.
Also, I have another script, but I'm lazy to post here, but If anyone want to post for me..
I need you ___________ (Fill the Blank with your name).

See ya!
 
Pretty neat code. Only one real suggestion on this:

Window_Bar might be a common window name. I suggest changing this to be a window within your scene.

Code:
class Scene_SmashButton::Window_Bar

That's all I have for you on this one. Good work buddy. :thumb:
 
Hey, Thanks for the Tip, I didn't care about that name, i forgot there are a lot of scripts that uses that name XD.

I am honored that SephirothSpawn leave me a tip :toot:
 
Don’t know if the “Fuck you” is appropriate at the end for our little youngsters here but, oh well. Nice script! I like it very much!

ozer: Fine line @bar_window.filling += (@power *10) if @bar_window.filling < @max

Once you find that, change the number after the astric(@power *50) to whatever you want. *1 being the hardest.
 
Don’t know if the “Fuck you” is appropriate at the end for our little youngsters here but, oh well. Nice script! I like it very much!

ozer: Fine line @bar_window.filling += (@power *10) if @bar_window.filling < @max

Once you find that, change the number after the astric(@power *50) to whatever you want. *1 being the hardest.
 
Nldarklord":3m48rfza said:
Can you make a non SDK version of it because the SDK messes with my Blizz-Abs :shadow:
Considering that both Scene_SmashButton and Window_Bar are new classes (as far as i know >_>), to make it non-sdk, just remove the sdk check and sdk log... then change the SDK::Scene_Base to just Scene_Base.
 
That wont work. Rmxp doesnt have a Scene_Base like rmvx does. So that would just crash the script. SDK has a scene base. THe scenes under the module SDK.
 
gameguy27":3hl813k4 said:
That wont work. Rmxp doesnt have a Scene_Base like rmvx does. So that would just crash the script. SDK has a scene base. THe scenes under the module SDK.
Ahh. Didn't know RMXP didn't have a scene_base. In that case... :eek::
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top