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.

Slowing things down.

Status
Not open for further replies.

Dko

Member

I need a little help figuring out how to do something. Right now I have two simmilar problems that I can't think of how to solve.
1. I have multiple damage pops happening in my battle system but they show up too fast and you only get to see the last one.
2. I have the player entering multiple commands but these are being received with no pause in between so that I get the same command for all.

Could someone help me figure out how I would code the pause I need for these two problems? Here some bits of my code that might help understand what im doing.

Code:
# Damage
      if @battler.damage_pop
        for i in (0..@battler.damage.length)
          print @battler.damage
          if @battler.damage[i] != nil
            damage(@battler.damage[i], @battler.critical)
            @battler.damage[i] = nil
            @battler.critical = false
          end
        end        
        @battler.damage_pop = false
      end

Code:
# If C button was pressed
    if Input.trigger?(Input::C) or Input.trigger?(Input::Y) or Input.trigger?(Input::X) or Input.trigger?(Input::Z)
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Set action
      if @active_battler.is_a?(Game_Actor)
        @num_attacks = @active_battler.stam
        
      else
        @num_attacks = 0
      end
      # Set each attacks strength
      for i in (0..@num_attacks)
        
        if Input.trigger?(Input::C) or Input.trigger?(Input::Y)
          $atk_power[i] = "MED"
        end
        if Input.trigger?(Input::X)
          $atk_power[i] = "STR"
        end
        if Input.trigger?(Input::Z)
          $atk_power[i] = "WEAK"
        end
      end
 

knmt

Member

Your first problem : You see the last one because you use a "for" in just the time of one frame , you should make a new function drawing the damage and allow it to be updated each frame , and each damage number will pops out in each frame .
Second one : Again , don't use for . Let frame handle this , make another function ( optional ) in which you set a variable equal to the current ordinal attack number of the attack of your character ( or use a global variable ), then put everything you need after choosing a type of attack ( med , str ,weak ) here , this will make it wait for your input and then deal the damage right away if you want it to .Make sure you put the If Input. blah blah in an updated section.

e.g. :
Code:
def choose(type)
$atk_power[$current] = @type
Increase $current...
end
def update
if Input.trigger?(Input::C) or Input.trigger?(Input::Y)
          choose("MED")
        else
        if Input.trigger?(Input::X)
          choose("STR")
        else
        if Input.trigger?(Input::Z)
        choose("WEAK")
        end
end

After your character's multiple attacks , return everything to its initial form.

Hope this helps you out , you can read more about frame in some tutorials here I guess...

P.S : Arre you planing on making a Chrono Cross game-like ?
 

Dko

Member

Thanks for the help but someone was able to show me an already completed bit of code thats very similar to what I want done and much easier to implement then what I was going for. :3
 
This topic has been resolved. If Dko or any other users have any questions or further problems regarding this topic, please create a new thread about them.

Thank you!
 
Status
Not open for further replies.

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