Actor sprite - easy fix to move up 4 pixels?

sock

Veteran
Veteran
Joined
Aug 9, 2013
Messages
53
Reaction score
4
First Language
English
Primarily Uses
N/A
Hey guys.

Curious - I'd like to get my actor sprite, and all NPC sprites to move up 4 pixels. Similar to how they would move down 4 pixels if you put a '!' at the beginning of title for that character graphic. - Can you do the opposite thing (so they move up by 4) with, some other prefix perhaps?

I've thought about changing my entire tile set to make the fix... But that would take up an unnecessary amount of time, not to mention a doubling of size in all my tilesets.
 

Harosata

Dramatic Lightning's BFF
Veteran
Joined
Aug 20, 2015
Messages
246
Reaction score
70
First Language
English
Primarily Uses
RMVXA
This is what I found: Under Game_CharacterBase, object_character? is determined either if it's part-tile or if ! is detected in the name. Right under that, shift_y will shift the character if it is not considered an object character.

Anyway, here's something quick to try. Ideally, this means that if the file begins with &, the shift 4 pixels higher than standard:
Code:
class Game_CharacterBase
  def up_character?
    @character_name[0, 1] == '&'
  end

  def shift_y
    bob = 4
    bob = 0 if object_character?
    bob = 8 if up_character?
    return bob
  end
end
 
Last edited:

sock

Veteran
Veteran
Joined
Aug 9, 2013
Messages
53
Reaction score
4
First Language
English
Primarily Uses
N/A
Hmmm, interesting!! Still teaching myself Ruby atm, but thanks heaps!!!. This helps me in both scripting and in my problem. Haha, up until now I'd decided that the 'positioning' would come to be "the charm of the game". lol

Few questions though... - I guess I'd be adding/editing the definition of 'up_character?' to the Game_CharacterBase script. Does it matter where it goes?

- What's an object_character?, is that your actor and all graphics you'd use for events?

- Lastly are you paraphrasing 'object_character? ? 0 : 4' when you say "bob = 4" etc

Cheers! B)
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
So do you want ALL sprites that don't have a name starting with ! to move up an additional 4 pixels? Or just certain ones?

If you want them all to be aligned with the grid if they start with !, otherwise up 8 pixels (the default 4 plus an additional 4), just add this into a new slot:

Code:
class Game_CharacterBase
  def shift_y
    object_character? ? 0 : 8
  end
end
If you only want certain ones to move up (those you specify with a different character), but others that don't have that character or ! at the start will still use 4, go with Harosata's solution.

object_character? is a function/method within Game_CharacterBase that determines if you have a ! at the beginning of the name or not.
 

sock

Veteran
Veteran
Joined
Aug 9, 2013
Messages
53
Reaction score
4
First Language
English
Primarily Uses
N/A
Thanks Shaz. I guess ALL sprites was the intention. So I will mess around with that. But it's great to know I can customise whichever ones I want using Harosatas method. Thanks!! Thanks!!
 

Harosata

Dramatic Lightning's BFF
Veteran
Joined
Aug 20, 2015
Messages
246
Reaction score
70
First Language
English
Primarily Uses
RMVXA
As to where to put these little scripts, you place them where you put any new big scripts. That should be under Materials, near the bottom of the script database. If you have multiple methods of the same name like the default shift_y and either mine or Shaz's version of shift_y, the later ones (closer to the bottom of the database) would be executed.

Generally, we want to avoid changing the default scripts directly, instead overwriting/aliasing them with a new method, since you might not write a reminder if you decide to edit.

---

Also, object_character? ? 0 : 4 is shorthand for:

if object_character?
0
else
4
end

I can't really use the shorthand with three conditions.
 

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,862
Messages
1,017,050
Members
137,571
Latest member
grr
Top