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,262
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,262
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

Today *Fix the game UI
RMMZ maxRows make me tired.
The game supports real-time language switching (really interesting).
8laFKAa.png


jBYDFzZ.png


lYbvPth.png

mY99lgU.png

Swag collecting in the new randomly generated area. Now the mini map also shows the randomly generated features... And even illustrates the whole "bubble" system" that I made to manage memory... Though that part's inadvertent. We'll just call that "the fog of war"... Yes, that's what we'll do. Nobody will be the wiser! :kaopride:
not me being not lazy for 5 seconds and drawing another char portrait (her name is hazel)
its_hazel.png
Been a while since the last time I made a song remix. Had a blast making this
One thing those jp developer still get wrong about boob physic is that... men's muscly hard pecs can jiggle too.

Forum statistics

Threads
110,454
Messages
1,053,435
Members
143,542
Latest member
Back-AlleySnowman
Top