Moving with only Left and Right sprite?

Status
Not open for further replies.

konomaru

Warper
Member
Joined
Aug 16, 2014
Messages
3
Reaction score
0
First Language
Vietnamese
Primarily Uses
I was wondering if theres a simple script that let you only use 2 sprites direction thats works with 8 direction movement?, so even when moving up and down, the left or right sprite is still in use depending on the direction it is moving (left or right), meaning I can't just switch the back and front sprite with left/right cause it will be facing only 1 direction.....

An example would be like YU-GI-OH Tag force games example: 



.
I've been searching all over, so if anyone knows, can you please help?
 

EchoingClock

Veteran
Veteran
Joined
Mar 23, 2014
Messages
31
Reaction score
3
First Language
English
Primarily Uses
You might be able to do this without scripting if you create a common event running off of a parallel process that changes the Actor's Graphic when moving left or right, and dedicate a sprite set to all walking left or all walking right. 

It would look something like this. Capture.PNG You would just have to activate the switch before movement is allowed.
 
Last edited by a moderator:

konomaru

Warper
Member
Joined
Aug 16, 2014
Messages
3
Reaction score
0
First Language
Vietnamese
Primarily Uses
Thanks! it worked, but it seem to have cancel out Galv's character animation script, which changes the sprite animation when not moving, and changes the sprite from walking to running sprites too. http://galvs-scripts.com/galvs-character-animations/

So I'm guessing, I have to edit the script itself to make this happen?
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
Well, each script is going to play with something like this differently, and your best bet might be to modify an 8-directional script.  But here's a scriptlet I created for you that will work perfectly in the "standard" setup: your character can move in any of the 8 directions (as in the standard setup, only Move Routes will actually let you move diagonally) but will only turn left or right.

As long as none of your scripts overwrite the set_direction method, it should be compatible with all your scripts.  Place it at the end of your Materials section.  If you notice any funny behavior, try it at the beginning of your Materials sections instead.

Code:
class Game_CharacterBase    #--------------------------------------------------------------------------  # * Change Direction to Designated Direction  #     d : Direction (2,4,6,8)  #--------------------------------------------------------------------------  def set_direction(d)    if (d == 3 or d == 6 or d == 9)      @direction = 6 if !@direction_fix      @stop_count = 0    end    if (d == 1 or d == 4 or d == 7)      @direction = 4 if !@direction_fix      @stop_count = 0    end  end  end
 

konomaru

Warper
Member
Joined
Aug 16, 2014
Messages
3
Reaction score
0
First Language
Vietnamese
Primarily Uses
Thanks a bunch  :D  this will do, I guess 8-dir movement hove to wait until, I learn a bit of scripting.
 

GrandmaDeb

Modern Exteriors Posted!
Veteran
Joined
Apr 25, 2012
Messages
4,467
Reaction score
2,942
Primarily Uses
Just wondering, but if this is always the way the sprite looks, can't you just change the sprite's character set itself? (the graphic, I mean?)
 

EchoingClock

Veteran
Veteran
Joined
Mar 23, 2014
Messages
31
Reaction score
3
First Language
English
Primarily Uses
Just wondering, but if this is always the way the sprite looks, can't you just change the sprite's character set itself? (the graphic, I mean?)
Not exactly, as the intent is to not have upwards and downwards facing sprites but instead to maintain the last direction be it right or left while moving up and down.

Thanks! it worked, but it seem to have cancel out Galv's character animation script, which changes the sprite animation when not moving, and changes the sprite from walking to running sprites too. http://galvs-scripts.com/galvs-character-animations/

So I'm guessing, I have to edit the script itself to make this happen?
As Galv's script requires you to have an individual document per character, perhaps if you instead change file instead of simply alternating sprite sets in the file, it would work more like the way you want it to. Using the method i suggested.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
Thanks a bunch  :D  this will do, I guess 8-dir movement hove to wait until, I learn a bit of scripting.
No problem.  Find some diagonal/8-dir movement scripts and check for any overwrite methods on "set_direction".  If there aren't any, there's a good chance my scriptlet will still work.

By the way, there are probably some Parallax scripts out there that will help complete the aesthetic for you, with the foreground and background "framing" the level where the characters walk.
 

Spearnear

Villager
Member
Joined
Aug 8, 2014
Messages
15
Reaction score
0
First Language
English
Primarily Uses
Well, each script is going to play with something like this differently, and your best bet might be to modify an 8-directional script.  But here's a scriptlet I created for you that will work perfectly in the "standard" setup: your character can move in any of the 8 directions (as in the standard setup, only Move Routes will actually let you move diagonally) but will only turn left or right.

As long as none of your scripts overwrite the set_direction method, it should be compatible with all your scripts.  Place it at the end of your Materials section.  If you notice any funny behavior, try it at the beginning of your Materials sections instead.

class Game_CharacterBase #-------------------------------------------------------------------------- # * Change Direction to Designated Direction # d : Direction (2,4,6,8) #-------------------------------------------------------------------------- def set_direction(d) if (d == 3 or d == 6 or d == 9) @direction = 6 if !@direction_fix @stop_count = 0 end if (d == 1 or d == 4 or d == 7) @direction = 4 if !@direction_fix @stop_count = 0 end end end
Thanks this script is just what I needed!  But it is proving a problem when I need to turn it off during events.  Could you possibly add a way to disable it with an event scripted call?  Then it would be perfect!  I am using certain facing positions for poses, but since it is locked to left/right I cannot use them.  That is my problem.
 
Last edited by a moderator:

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
Thanks this script is just what I needed!  But it is proving a problem when I need to turn it off during events.  Could you possibly add a way to disable it with an event scripted call?  Then it would be perfect!  I am using certain facing positions for poses, but since it is locked to left/right I cannot use them.  That is my problem.
Easy to do with an Aliased method.  It can call the new behavior under a certain condition, and call the old behavior otherwise.

Use the following modification to turn it ON or OFF any time during the game by setting a switch (in this case 26 but you can change it to any other switch).  Just be careful about using this alongside other scripts that modify set_direction, since you will sometimes be calling their behavior (but sometimes not).

Code:
class Game_CharacterBase    #--------------------------------------------------------------------------  # * Change Direction to Designated Direction  #     d : Direction (2,4,6,8)  #--------------------------------------------------------------------------  alias :set_dir_sometimes :set_direction  def set_direction(d)    if $game_switches[26] == true      if (d == 3 or d == 6 or d == 9)        @direction = 6 if !@direction_fix        @stop_count = 0      end      if (d == 1 or d == 4 or d == 7)        @direction = 4 if !@direction_fix        @stop_count = 0      end    else      set_dir_sometimes(d)    end  end  end
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.


If you need it to be compatible with existing scripts, please post links to the scripts (this does not mean copy and paste the script into your post)
 

testbot12

Warper
Member
Joined
Sep 29, 2018
Messages
1
Reaction score
0
First Language
english
Primarily Uses
RMMV
You might be able to do this without scripting if you create a common event running off of a parallel process that changes the Actor's Graphic when moving left or right, and dedicate a sprite set to all walking left or all walking right.

It would look something like this. View attachment 15915 You would just have to activate the switch before movement is allowed.
Thank you from future! You literally saved ma time so much xD
 
Status
Not open for further replies.

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

Latest Threads

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,868
Messages
1,017,066
Members
137,576
Latest member
SadaSoda
Top