How to convert this line of code from ace to MV?

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,042
First Language
French
Primarily Uses
RMMV
Hi guys I am struggling with a certain part I wanted to convert Rhyme Smooth Scrolling from Ace for my OWN use in my game (and obviously all the credit would be gave )


but at a point I am struggling with some part....I just don't know how to properly convert the line for work in MV...since MV is the same but in same time Nope not the same....


so I would be really happy if you guys can help me.

Code:
  alias initialize_rhyme initialize
  def initialize
    initialize_rhyme
    @t_display_x = @display_x
    @t_display_y = @display_y
  end
  #--------------------------------------------------------------------------
  # ● Set Display Position
  #--------------------------------------------------------------------------
  def set_display_pos(x, y)
    x = [0, [x, width - screen_tile_x].min].max unless loop_horizontal?
    y = [0, [y, height - screen_tile_y].min].max unless loop_vertical?
    @t_display_x = @display_x = (x + width) % width
    @t_display_y = @display_y = (y + height) % height
    @parallax_x = x
    @parallax_y = y
  end
  #----


the JS version :

Code:
// FROM THE ORIGINAL JS FILE
Game_Map.prototype.setDisplayPos = function(x, y) {
    if (this.isLoopHorizontal()) {
        this._displayX = x.mod(this.width());
        this._parallaxX = x;
    } else {
        var endX = this.width() - this.screenTileX();
        this._displayX = endX < 0 ? endX / 2 : x.clamp(0, endX);
        this._parallaxX = this._displayX;
    }
    if (this.isLoopVertical()) {
        this._displayY = y.mod(this.height());
        this._parallaxY = y;
    } else {
        var endY = this.height() - this.screenTileY();
        this._displayY = endY < 0 ? endY / 2 : y.clamp(0, endY);
        this._parallaxY = this._displayY;
    }
};
 
Last edited by a moderator:

Victor Sant

Veteran
Veteran
Joined
Mar 17, 2012
Messages
1,694
Reaction score
1,452
First Language
Portuguese
Primarily Uses
Code:
    x = [0, [x, width - screen_tile_x].min].max unless loop_horizontal?
    y = [0, [y, height - screen_tile_y].min].max unless loop_vertical?
    @t_display_x = @display_x = (x + width) % width
    @t_display_y = @display_y = (y + height) % height
    @parallax_x = x
    @parallax_y = y


if (!this.isLoopHorizontal()) x = x.clamp(0, this.width() - this.screenTileX());
if (!this.isLoopVertical()) y = y.clamp(0, this.height() - this.screenTileY());
this._displayX = (x + this.width()) % this.width();
this._displayY = (y + this.height()) % this.height();
this._tDisplayX = this._displayX;
this._tDisplayY = this._displayY;
this._parallaxX = x;
this._parallaxY = x;


"this._tDisplayX" is equivalent to "@t_display_x"
 
Last edited by a moderator:

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,042
First Language
French
Primarily Uses
RMMV
@Victor Sant thanks victor! 


I was unsure if actually the method was actually working in MV because how they changed the method '^'"


but I will see if this works thanks!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!

Forum statistics

Threads
106,036
Messages
1,018,461
Members
137,821
Latest member
Capterson
Top