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.

Need help slowing event movement to a crawl

Alright, let's see if I can manage to explain this coherently enough without having to actually post the entire script...



I've been working on a new Battle Engine of sorts that takes place on the Game Map and is a merger of the regular, turn-based combat, game events, and a few new scripts.

One aspect of the Battle Engine is that you must perform a certain task in order to use a spell/skill in combat. Without having to explain the whole magic system of the game, you essentially have to line up a few sprites that appear on screen into the proper format for your spell. You also must do this before the enemy event manages to reach a specified location. Essentially, you have until the enemy event reaches the end of it's move route.

In order to facilitate this, I've been trying to slow down the enemy event to a crawl in order to allow the player time to actually build their spell and use it. As such, I tried only updating the enemy event (and corresponding sprite) only when Graphics.frame_count % x == 0; where x is a large selection of numbers I've tried.

However, this doesn't actually seem to be slowing the enemy's movement down whatsoever. Setting x = 500 has the same results as setting it to 50. I was wondering why this wasn't working, and perhaps searching for an alternative. I don't understand why if the event and sprite aren't getting updated, though, that it still manages to move itself. >_>;

Any ideas?

Thanks in advance.
 
Events updating twice? You could always add something like this to the bottom of your scripts:
Code:
class Game_Event

  alias testupdate update

  def update

    p caller

    testupdate

  end

end
That might give ya a little idea if it is being called in more than one place. Then again, you could also prevent the update by modifing the above code like so:
Code:
class Game_Event

  attr_write :disable_update_count

  def disable_update_count

    return @disable_update_count == nil ? 0 : @disable_update_count

  end

  alias preventupdate update

  def update

    if Graphics.frame_count % disable_update_count == 0

      preventupdate

    end

  end

end

Now to slow updating an event, just call with:
Code:
$game_map.events[event_id].disable_update_count = x

Have you tried making the movespeed a decimal? Can't remember if by default <1 move_speed values are acceptable.
 
Alright, I figured this out.

Once you mentioned setting @move_speed to a decimal, it got the series of events flowing, and I figured out exactly what move_speed controlled, and then figured out what I needed to modify.

Problem wasn't extra updates or anything. It's just that regardless of what I set move_speed to, @real_y or @real_x still updated like normal, and was only slowed down so much. And once I figured that out, modifying that was a cinch.

Still, thanks for pointing me in the right direction at least. I've got this figured out now.
 

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