Yilou

Veteran
Veteran
Joined
Apr 3, 2020
Messages
68
Reaction score
6
First Language
Russian
Primarily Uses
RMMV
Good Day!
My game contains a mini-code that moves the standard camera to follow a little lower. Here he is:

Code:
//-----------------------------------------------------------------------------
// Game_Map
//-----------------------------------------------------------------------------
Game_Player.prototype.centerY = function() {
var y =(Graphics.height / $gameMap.tileHeight() - 1) / 2.0;
y += 5;
return y;

};


But the plug-in Gavl CameraControl replaces this code, and the camera returns to the standard display. (Player in the center)

Can someone tell me how to embed my code into this plugin?
 

Attachments

  • GALV_CamControl.js
    9.8 KB · Views: 4

Yilou

Veteran
Veteran
Joined
Apr 3, 2020
Messages
68
Reaction score
6
First Language
Russian
Primarily Uses
RMMV

ImaginaryVillain

High Cultist of the Sporkle
Veteran
Joined
Jun 22, 2019
Messages
879
Reaction score
5,245
First Language
Absurdism
Primarily Uses
RMMZ
In Galv's Plugin you could try replacing...
JavaScript:
Game_Player.prototype.centerY = function() {
    return ((Graphics.height / $gameMap.tileHeight() - 1.75*$gameMap.zoom.y) / 2.0)/$gameMap.zoom.y;
};

...with....

JavaScript:
Game_Player.prototype.centerY = function() {
    return (((Graphics.height / $gameMap.tileHeight() - 1*$gameMap.zoom.y) / 2.0)/$gameMap.zoom.y) + 5;
};

I don't currently have anything in MV to test the results, but you can just adjust the numbers in that until you find what you like.
 

Yilou

Veteran
Veteran
Joined
Apr 3, 2020
Messages
68
Reaction score
6
First Language
Russian
Primarily Uses
RMMV

ImaginaryVillain

It's strange, but no matter what values I enter in this line, the camera does not change its position in any way, and moves in the standard way (in the center of the screen). I tested this on a clean project but the result is the same. :kaodes:
 

ImaginaryVillain

High Cultist of the Sporkle
Veteran
Joined
Jun 22, 2019
Messages
879
Reaction score
5,245
First Language
Absurdism
Primarily Uses
RMMZ
Ah, to be honest I just thought you were trying to figure out how to easily replace something so I didn't investigate the plugin. After looking I see Galv passes the entire player object to
Game_Map.prototype.updateScroll...

So in that function replace...
JavaScript:
var screenY = this.camTarget.screenY()*this.zoom.y;

with...

JavaScript:
if (this.camTarget.screenY() == $gamePlayer.screenY()){
        var screenY = (this.camTarget.screenY()*this.zoom.y) + 5;
    } else {
        var screenY = this.camTarget.screenY()*this.zoom.y;
    }

...and revert the other changes which aren't necessary. You can of course change the 5 to whatever offset you want.
 

Yilou

Veteran
Veteran
Joined
Apr 3, 2020
Messages
68
Reaction score
6
First Language
Russian
Primarily Uses
RMMV

ImaginaryVillain

Awesome! At first, I couldn't get your code to work until I entered -270 instead of +5 (strange that there is such a huge difference). And now everything works fine! Thank you so much. And hats off to your programming skills!:LZSproud:
 

Latest Threads

Latest Posts

Latest Profile Posts

not me baking a pie because i was inspired by celeste
Doing RPG Maker News for 10th April, 2021. :LZScheeze: (Improving on the thumbnails, by using assets from the day's news.)
Just discovering the forum.
Since Final Fantasy VII has been trending today, decided to make a series of my favorite bars in the OG game! Check it out:

At 2021, we are now farther from the 1980's than they were from the 1950's. Consider that the next time you long for a 1980's song, when you thought your grandpa's taste for 1950's music was "outdated".

Forum statistics

Threads
110,296
Messages
1,052,058
Members
143,327
Latest member
venxarmy
Top