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

oh god I'm going to die
AAAAAAAAi.png
Kind of relieved that I had medibang installed when I need to edit Sprite I was about to download gimp but I remember I had medibang installed lol
Voting for the first round of the Map Madness Tournament is now live! Vote for your favorite in each matchup!

Finally started working on Grim Trigger episode 2 today :LZScat: it's half comic/half visual novel!

GfY3Rwj.png
Is it interesting to get more backstory on villains? A key moment in their past, their childhood, or maybe something that shows they've always been that way? To see or not to see?

Forum statistics

Threads
110,367
Messages
1,052,647
Members
143,402
Latest member
IBanana
Top