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.

[Fulfilled] VERY SIMPLE REQUEST. Strafing~

Status
Not open for further replies.
What I want is so that when you press a button, the character's facing direction.


But the thing that limits this to scripts, is that I want it to be locked only as long as the button is held.



This should be very simple, yet helpful to me, so thank you if you do it! ^^
 
Have you tried using conditional branches? they can be used exactly the way you want (lock as long as the buton is held). Don't use the event to store the button into a variable(forgot the name...), make it directly with the conditional...

I hope you understand this...
 
Uhm, no, it can only detect when a button is pressed.

Not when its being held.

You should try reading my post, and maybe my sig, and try to draw some conclusions from that.


That I probably know and have been around/used events more than you..

Anyways, I'm still looking for the script.


Anyone? ^^
 
I did something exactly like this for a survival/shooter game with common event. It's really simple, even with a script. I can do it for you.

You have 3 choices of input. Trigger, Press, Repeat.
In this case, i think that Input.press is the better choice. Unless you want to toggle it.

EDIT: Here's the tiny script"
Code:
#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass for the
#  Game_Player and Game_Event classes.
#==============================================================================

# This is the switch id for toggling
Strafe_Switch = 1

class Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :direction_fix
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias dargor_strafe_update update
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # If SHIFT is pressed
    if Input.press?(Input::SHIFT) and strafe_enable?
      $game_player.direction_fix = true
    else
      $game_player.direction_fix = false
    end
    # Original Update Methode
    dargor_strafe_update
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def strafe_enable?
    return $game_switches[Strafe_Switch]
  end
end
 
Oh! Thats perfect! See, told you it would be simple ;]


Not to be a whiny brat or anything, but is it possible to be able to switch the effect on/off by using a switch?

I'm really ashamed, I KNOW that something simple in RGSS. If only I learned it.. >__>"
 
Phoenix~Lament;171672 said:
Uhm, no, it can only detect when a button is pressed.

Not when its being held.

You should try reading my post, and maybe my sig, and try to draw some conclusions from that.


That I probably know and have been around/used events more than you..

Anyways, I'm still looking for the script.


Anyone? ^^


Don't mean to bring this post back up... but wow you were just a complete dick to someone trying to help you. What gave you the right to be that rude when all he was doing was trying to help? Maybe he DID read your signature and was trying to find a way to help you accomplish your goal of "events only." Maybe you should read his post and think before you type. I am completely surprised that anyone helped you at all.
 
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