Yilou

Veteran
Veteran
Joined
Apr 3, 2020
Messages
67
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
67
Reaction score
6
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
67
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
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
67
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 Profile Posts

Do you like to practice level design? I do hahahaha! It's not from a specific game, it's just some tests...Fase 1.png
I really need a better indicator of where you can jump up and down though I feel... otherwise I like how this turned out for the first part of the first dungeon of the game.
@Shaz needs to make a website for his plugins. (it can be done easily for free with google sites.) I can't find a database of them anywhere!
Dion2.jpg

testing #2

Forum statistics

Threads
109,127
Messages
1,042,377
Members
141,628
Latest member
KaithFoyer
Top