Yilou

Veteran
Veteran
Joined
Apr 3, 2020
Messages
65
Reaction score
5
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
65
Reaction score
5
First Language
Russian
Primarily Uses
RMMV

ImaginaryVillain

High Cultist of the Sporkle
Veteran
Joined
Jun 22, 2019
Messages
847
Reaction score
4,950
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
65
Reaction score
5
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
847
Reaction score
4,950
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
65
Reaction score
5
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

KenKrath wrote on RPGMakerWeb's profile.
Nevermind.
I found a book about game localization. It costs R$708,00 on Amazon. ;_;
I really wish my game was far enough along for it to be actually playable beyond certain aspects. I think I've crafted a really fun battle system thanks to ATB, fighting game, and Boost point mechanics.
Play test of my current progress on Happy Camper
Cutscene Contest Winners have been announced!

Forum statistics

Threads
109,114
Messages
1,042,210
Members
141,612
Latest member
mhayes
Top