Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Some small scripting problem [Solved]
Vexus
post Apr 14 2012, 02:45 AM
Post #1


Level 19
Group Icon

Group: Revolutionary
Posts: 394
Type: Mapper
RM Skill: Intermediate




I'm editing Game_Player movement and with the help on google search I managed to make the character move using wasd instead of the arrow keys.

Now I was wondering if I could take it into a "higher level" but trying to make it if you press arrow key up OR w character moves up.

So anyone could help me with a little problem?

These are the lines of the script:

The default with arrow keys movement.
CODE
      
case Input.dir4
      when 2
        move_down
      when 4
        move_left
      when 6
        move_right
      when 8
        move_up
      #end


And this is the wasd part.
CODE
      if Input.press?(Input::Y)
         move_down
      elsif Input.press?(Input::X)
         move_left
      elsif Input.press?(Input::Z)
         move_right
      elsif Input.press?(Input::R)
         move_up
      end
    end


Thanks.

This post has been edited by Vexus: Apr 14 2012, 06:08 AM


__________________________
Current Project/s:
Go to the top of the page
 
+Quote Post
   
The Law G14
post Apr 14 2012, 05:34 AM
Post #2


Scripter FTW
Group Icon

Group: Local Mod
Posts: 1,346
Type: Scripter
RM Skill: Skilled
Rev Points: 5




Hey smile.gif

You could just add them together using the "or" keyword, like this:

CODE
if Input.press?(Input::Y) or Input.press?(Input::DOWN)
         move_down
      elsif Input.press?(Input::X) or Input.press?(Input::LEFT)
         move_left
      elsif Input.press?(Input::Z) or Input.press?(Input::RIGHT)
         move_right
      elsif Input.press?(Input::R) or Input.press?(Input::UP)
         move_up
      end
    end


__________________________

To put in sig, copy this link:
CODE
[url="http://www.rpgrevolution.com/forums/index.php?showtopic=51540"][img]http://img40.imageshack.us/img40/6504/conceptthelawbanner.png[/img][/url]


Sig Stuff


"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!

If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One

My Project Thread: Gai's Hunters


Go to the top of the page
 
+Quote Post
   
Vexus
post Apr 14 2012, 06:05 AM
Post #3


Level 19
Group Icon

Group: Revolutionary
Posts: 394
Type: Mapper
RM Skill: Intermediate




I tried with or but got some errors guess I had to switch the arrow key piece from a number into an input press.

Works splendidly thanks smile.gif



__________________________
Current Project/s:
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 18th May 2013 - 01:19 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker