Disable player turning up or down?

Jogabba

Villager
Member
Joined
Aug 4, 2016
Messages
27
Reaction score
14
First Language
Spanish
Primarily Uses
Hi! I was wondering if there's any way to prevent the player to turn into certain directions. For example, I want to disable the Up and Down arrows in a certain map, allowing the player only to face/move left and right.


Remember that I'm not asking only to restrict movement in certain directions, but specially to avoid the player face these directions when the movement key is pressed.


Any ideas?
 

YoraeRasante

Veteran
Veteran
Joined
Jun 6, 2014
Messages
1,643
Reaction score
420
First Language
Portuguese
Primarily Uses
RMMV
You could fix the direction and when the player presses up or down (checked through conditional branches) they either quickly unlock, turn around and lock again, or move a step forward if they were already looking in that direction?
 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,439
First Language
French
Primarily Uses
RMMV
Hi! I was wondering if there's any way to prevent the player to turn into certain directions. For example, I want to disable the Up and Down arrows in a certain map, allowing the player only to face/move left and right.


Remember that I'm not asking only to restrict movement in certain directions, but specially to avoid the player face these directions when the movement key is pressed.


Any ideas?


Game_Map.prototype.doScroll = function(direction, distance) {
    switch (direction) {
    case 2:
        this.scrollDown(distance);
        break;
    case 4:
        this.scrollLeft(distance);
        break;
    case 6:
        this.scrollRight(distance);
        break;
    case 8:
        this.scrollUp(distance);
        break;
    }
};


and for multi condition map or switch

Code:
if ($gameMap._mapId==7 && $gameSwitches.value(15) == false)
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I'm not sure what the above is for.  Those scripts have nothing to do with either the player's direction or movement.


You'd have to not only stop keyboard input in the up/down directions on that map, but also cater for mouse clicks that might cause the player to move up/down.  Would you just disable mouse movement on that map, or allow it, but only process left/right instructions?
 
Last edited by a moderator:

Dad3353

Veteran
Veteran
Joined
Mar 9, 2016
Messages
421
Reaction score
110
First Language
English
Primarily Uses
Would it be feasible to limit movement on the relevant Tiles, and create a Character set for the Hero with only Right and Left sprites (copy Right to Up, Left to Down, for instance...). Switch sprites when in this situation; the Hero will always face Right or Left, and be unable to move Up or Down. Switch back to the normal sprite, of course once this is over. Any mileage..?
 

Wookiee420

Veteran
Veteran
Joined
Apr 2, 2016
Messages
293
Reaction score
131
First Language
English
Primarily Uses
could you do this even easier? If i read this correctly what you want to do is still have up and down key work but not change the direction your are facing, silly example would be a side scrolling shooter or something like that.


what about just having a sprite sheet without the actor facing those directions (essentially have it be two rows of right and two rows of left), and have the start/stop of the section be a simple event that switches the actors sprite?
 

Jogabba

Villager
Member
Joined
Aug 4, 2016
Messages
27
Reaction score
14
First Language
Spanish
Primarily Uses
Hi, thank you all for your answers!


I fixed the problem with an event that checks if the player has pressed the up/down buttons and making the character turn towards the player if that's the case. The character IS the player, so the sprite doesn't move at all, which is the desired behaviour.


This does not work with mouse clicks, tho. Not really a big problem for me, as I was planning to disable mouse control for this game.
 
Last edited by a moderator:

YoraeRasante

Veteran
Veteran
Joined
Jun 6, 2014
Messages
1,643
Reaction score
420
First Language
Portuguese
Primarily Uses
RMMV
That 2d Fixed Direction would be a good one... if it wasn't forced to be there the entire game...
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,864
Messages
1,017,056
Members
137,573
Latest member
nikisknight
Top