Method to overriding movement controls?

boldpaste2

The Dragon Heretics
Veteran
Joined
Dec 7, 2013
Messages
797
Reaction score
439
First Language
English
Primarily Uses
Lets see how I can best explain this. xD I am trying to make a mini game where the map is scrolling and if the player falls off the map its game over. I got the whole scroll map and falling off the map part working.

The problems lies in player movement however. I was wondering if there was a way (or script, preferably CC by 3.0) that allows me to override movement controls to a different action. For example.

Default Movement

Up : Up

Left : Left

Right : Right

Down : Down

Modified Controls

Up : Up

Left : Upper Left

Right : Upper Right

Down : UP

Basically, with this control scheme the player will always be moving in a single direction but has control of going left or right to dodge incoming objects.

A million thanks to someone who has an answer to this. ^^ 
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,795
Reaction score
5,351
First Language
English
Primarily Uses
RMVXA
The method you'll want to change is "move_by_input" in the Game_Player class.  Here's a scriptlet that gives you exactly what you asked for:

class Game_Player < Game_Character #-------------------------------------------------------------------------- # * Processing of Movement via Input from Directional Buttons #-------------------------------------------------------------------------- def move_by_input return if !movable? || $game_map.interpreter.running? case (Input.dir4) when 2,8 move_straight(8) when 4 move_diagonal(4,8) when 6 move_diagonal(6,8) end end endWith that being said, your current setup probably isn't too exciting because you're most likely not forcing the player to dodge incoming objects with any speed.  I was trying to figure out a way to really simulate speed in my IGMC contest entry timeblazer and I think I got it down pretty well by having obstacles and scenery loop from the top to bottom of the screen while restricting the player's movement to left and right.  It looks like you're running the whole way and it's very action-packed.  You can see it in practice in the first action sequence of the game, as well as two or three other action sequences in later stages.  Let me know if you like that approach and I can give you some more hints toward setting it up.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
40,739
Reaction score
14,001
First Language
English
Primarily Uses
RMMV
I've moved this thread to RGSS3 Script Requests. Please be sure to post your threads in the correct forum next time. Thank you.


That would modify ALL movement in your game. If you only wanted to do that SOMETIMES you would have to use a switch or something to turn on the "special" movement, and then modify your move_by_input method to check the switch and either do the normal movement or the special movement based on its value.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

When the Map Generator throws in the assets in the most dumbest way possible - your path is blocked :D

I went to sleep at 3 am because of my anxiety. Set up my alarm for 7 am so that I could have sasagues for breakfast and do morning routine before lessons starts at 8 am. I knew I wouldn't be able to sleep even after my lessons finished because I have to visit my grandparents today I was sad bc I was really tired. Thats when I realised. My lesson starts at 9 am. I could get one extra hour of sleep if I didnt forget it

Forum statistics

Threads
107,556
Messages
1,030,528
Members
139,672
Latest member
WDRS
Top