From 8a99e0716fc3c3a9134d29031c21d95bcb30a14c Mon Sep 17 00:00:00 2001 From: Michael Shirt Date: Tue, 20 Sep 2016 13:08:55 -0600 Subject: [PATCH] Anti-lag script This didn't get fully committed last time for some reason? --- scripts/Spriteset_Map.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/Spriteset_Map.rb b/scripts/Spriteset_Map.rb index c741b91..9380ad6 100644 --- a/scripts/Spriteset_Map.rb +++ b/scripts/Spriteset_Map.rb @@ -244,10 +244,16 @@ class Spriteset_Map @character_sprites.each do |sprite| if !sprite.character.is_a?(Game_Event) sprite.update + elsif + # this is just a check to make sure the sprite is onscreen for game events # based on its current width and height # no point in updating the sprite if offscreen # this greatly increases performance on larger maps + + ((sprite.character.real_x + (sprite.ox*4) > $game_map.display_x - 128) && + (sprite.character.real_x - (sprite.ox*4) < $game_map.display_x + (21 * 128)) && + (sprite.character.real_y + (sprite.oy*4) > ($game_map.display_y) - 128) && (sprite.character.real_y - (sprite.oy*4) < ($game_map.display_y) + (17 * 128))) sprite.update end