Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================#
- # Better Fast-forward Mode #
- # v1.0 #
- # #
- # by Marin #
- #==============================================================================#
- # Usage #
- # #
- # MAX_GAME_SPEED is the fastest the user can make the game. It represents the #
- # amount of frames that will be skipped. #
- # $GameSpeed is the current level of speed up. #
- # Should you want to change that manually, you can do like $GameSpeed = 1 #
- # Protip: Don't ever set it to 0. Ever. #
- # #
- # If you don't want the user to be able to speed up at certain points, you can #
- # use "pbDisallowSpeedup" and "pbAllowSpeedup". #
- #==============================================================================#
- # The fastest the user can make the game.
- MAX_GAME_SPEED = 3
- def pbAllowSpeedup
- $CanToggle = true
- end
- def pbDisallowSpeedup
- $CanToggle = false
- end
- # Default game speed.
- $GameSpeed = 1
- $frame = 0
- $CanToggle = true
- module Graphics
- class << Graphics
- alias fast_forward_update update
- end
- def self.update
- if $CanToggle && Input.trigger?(Input::F)
- $GameSpeed += 1
- $GameSpeed = 1 if $GameSpeed > MAX_GAME_SPEED
- end
- $frame += 1
- return unless $frame % $GameSpeed == 0
- fast_forward_update
- $frame = 0
- end
- end
- module Input
- class << Input
- alias fast_forward_button_to_key buttonToKey
- end
- F = 50
- def self.buttonToKey(btn)
- return [0x46] if btn == Input::F
- fast_forward_button_to_key(btn)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement