Jump to content
Sign in to follow this  
IMUNME

Condition script for direction keys

Recommended Posts

Hello guys,

 

Can anyone tell me how to script a condition for this def? 

 

def switch
    if @id == 1
      $game_switches[13] = false
      $game_switches[19] = false
      $game_switches[20] = true
      $game_temp.reserve_common_event(3)
      switch_player(2)
    else
      $game_switches[19] = true
      $game_switches[20] = false
      $game_temp.reserve_common_event(3)
      switch_player(1)
    end
  end

 

I want to prevent the def switch from happening if any direction keys is pressed down. I'm looking for something like a condition branch that would keep going with the script if no arrow is being held down and would do nothing if any direction key is held down.

 

Thank you in advance!

 

FM
 

Share this post


Link to post
Share on other sites

Input.dir4 == 0

Input.dir8 == 0

8-dir is preferred since if they were pressing two keys down you would detect it as well. Edited by Tsukihime

Share this post


Link to post
Share on other sites

Very nice!

 

Thanks a lot! You really know your stuff. Who best to answer this post! ;)

 

Cheers!

 

FM

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted