Altimit Pixel Movement [0.50β]

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
324
Reaction score
207
First Language
English
Primarily Uses
RMMV
That's not the default collider, right? Check to see where the player's .x and .y point is relative to your collider. IIRC it isn't in the exact center by default, which can be confusing.
 

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,123
Reaction score
230
First Language
English
Primarily Uses
N/A
I kind of like "followers struggling to follow party leader" in the video, it gives me those nostalgic feels of old games where the A.I would get stuck behind walls and things.
 

Sir levée

Hill man of V'scello
Member
Joined
Jan 24, 2014
Messages
19
Reaction score
6
First Language
english
Primarily Uses
RMMV
Is this plugin still being updated? I've found a few issues. So anyway, The game when using the plugin doesn't read player X, Y position on a map properly and I'll have to pass the center of a tile rather than be occupying the majority grid space of it. The second issue is that when using mouse mode and being transferred to another map the position you pressed last will be passed onto the next area forcing you into moving to the X Y of the last click unless you click somewhere else again.Thirdly, I thought disabling mouse mode after transferring would reset/Remove the last click and be a workaround but was surprised to see it doesn't, and that could become a problem during scenes triggered by touch or coordinates where you keep moving instead of pausing
(EDIT) So first issue still stands but something weirder, The detection grid is off for player X, Y once the plugin is in

An example is that the starting point in the image below is X 21 Y 14 but you are not in those coordinates unless you are actually in the red box
 
Last edited:

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
324
Reaction score
207
First Language
English
Primarily Uses
RMMV
Is this plugin still being updated? I've found a few issues. So anyway, The game when using the plugin doesn't read player X, Y position on a map properly and I'll have to pass the center of a tile rather than be occupying the majority grid space of it. The second issue is that when using mouse mode and being transferred to another map the position you pressed last will be passed onto the next area forcing you into moving to the X Y of the last click unless you click somewhere else again.Thirdly, I thought disabling mouse mode after transferring would reset/Remove the last click and be a workaround but was surprised to see it doesn't, and that could become a problem during scenes triggered by touch or coordinates where you keep moving instead of pausing
(EDIT) So first issue still stands but something weirder, The detection grid is off for player X, Y once the plugin is in

An example is that the starting point in the image below is X 21 Y 14 but you are not in those coordinates unless you are actually in the red box
For #1, with Altimit, events triggers work a bit differently.

Player Touch: the player must be fully inside the event before it to be triggered (or the event fully inside the player, if the event collider is smaller than the player's). Think of it as 'overlaps'

Event touch: the event will fire the moment the colliders even slightly touch. Think of it as 'touches'.


I have a fix for #2, or rather, MechPen does
Changing
Code:
      var Game_Player_clearTransferInfo = Game_Player.prototype.clearTransferInfo;
      Game_Player.prototype.clearTransferInfo = function() {
        Game_Player_clearTransferInfo.call( this );
        this._moveTarget = false;
        this._moveTargetSkippable = false;
      };
to
Code:
      var Game_Player_clearTransferInfo = Game_Player.prototype.clearTransferInfo;
      Game_Player.prototype.clearTransferInfo = function() {
        Game_Player_clearTransferInfo.call( this );
        this._moveTarget = false;
        this._moveTargetSkippable = false;
       this._touchTarget = null;
      };
fixes this for any sort of map transition.

You'll probably also want this fix

One problem using mouse movement is that if you define colliders using events, players clicking on that collider will have their destination set to the x,y coordinate of the event's base position, which isn't great.

This tweak to Game_Player.prototype.moveByInput will ignore any characters with no image when deciding on whether to track an event or not, so invisible colliders (and other invisible accessory events) will remain unnoticed by the mouseclick.
Code:
               if ( touchedCharacters.length ) {
                   if(!(touchedCharacters[0]._characterName=="")) //ignore characters with no image
                   {
                     // Move toward character
                     characterTarget = touchedCharacters[0];
                   }
                }
 

Sir levée

Hill man of V'scello
Member
Joined
Jan 24, 2014
Messages
19
Reaction score
6
First Language
english
Primarily Uses
RMMV
Whoah, Thanks for these gifts, Oh and for issue #1 I'm not using triggers, I'm using a common event that stores X Y in variables then transfers you using a conditional branch by those variables when you've reached the determined edges of the map, so using that I found the grid was off as I would get transfered after having to go too far into a tile when going down and left, and then too soon when going up or right

So all maps are 34x34 with black borders. When Variable "PlayerX" reaches X: 33 it transports the player to the adjacent map but as you can see in the images X doesn't update from X: 32 even though I'm definitely in X: 33, and then it does the same with down, And then I don't have to touch borders on the top or left sides to transfer
1.png2.png

The whole Player X,Y detection grid is like its set to 1.5-1.5

Here's another example on a fresh project, Because its shifted Down-right I can enter negative coordinatesUntitl.pngiii.png
 
Last edited:

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
324
Reaction score
207
First Language
English
Primarily Uses
RMMV
Oh yeah RPGM by default doesn't put a character's .x and .y property at the center of a tile even without altimit - IIRC it's based on the top-left. In the base game, if you have Harold standing in the top-left tile he's gonna be recorded at (0,0) and not (0.5,0.5). Altimit doesn't fiddle with that.

You can change the PC's collider and sprite locations so that the (x,y) coordinate for the player is embedded somewhere inside him if you want, but if you're using the same common event it's probably easiest to just experiment with the exact border until the map change looks good.
 

Sir levée

Hill man of V'scello
Member
Joined
Jan 24, 2014
Messages
19
Reaction score
6
First Language
english
Primarily Uses
RMMV
Interesting, Never knew it was like that by default. Thanks for reply and bit of info, I Never would have realized it was like that with only being confined to grid movement. But I'll work with it as is now and see what I can do
 

MangoFlavour

Villager
Member
Joined
Apr 14, 2017
Messages
5
Reaction score
2
First Language
English
Primarily Uses
RMMV
Possibly a dumb question, but what determines whether an Event on the "Same as Player" layer will appear above or below the player? I was thinking redefining the collision box using comments would influence this but I can't get anything to change.

If that's not super clear, I mean when you walk above (north of) an event, the player appears behind/underneath it. And when you're below (south of) an event, you appear in front/above of the event. Do custom collision boxes in this plugin not affect that at all?
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
324
Reaction score
207
First Language
English
Primarily Uses
RMMV
Possibly a dumb question, but what determines whether an Event on the "Same as Player" layer will appear above or below the player? I was thinking redefining the collision box using comments would influence this but I can't get anything to change.

If that's not super clear, I mean when you walk above (north of) an event, the player appears behind/underneath it. And when you're below (south of) an event, you appear in front/above of the event. Do custom collision boxes in this plugin not affect that at all?
I believe the collision doesn't effect it, but it should be easy to test
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
324
Reaction score
207
First Language
English
Primarily Uses
RMMV
Is there a way to change it to middle of a collider somehow?
Easiest way is to just move the default collider, which you can do in the plugin settings.
 

CrasheR

Project: Dunsa's Prophecy
Member
Joined
May 11, 2012
Messages
28
Reaction score
13
First Language
Polish
Primarily Uses
RMMV
Easiest way is to just move the default collider, which you can do in the plugin settings.
Tried it. It doesnt work very well if you have ABS in your game. Enemies do some wierd stuff when i recrate colider to the middle of the character sprite and some clisions look very awkward, cuz sprite gets in half in to the objects. :/
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
324
Reaction score
207
First Language
English
Primarily Uses
RMMV
yeah you have to move your sprites as well,

Easy way is to use yanfly's event sprite offset, or mog's char poses, or one of the many other plugins for doing it


If you want to roll your own, here's the base code from rpg_objects
Code:
Game_CharacterBase.prototype.screenX = function() {
    var tw = $gameMap.tileWidth();
    return Math.round(this.scrolledX() * tw + tw / 2);
};

Game_CharacterBase.prototype.screenY = function() {
    var th = $gameMap.tileHeight();
    return Math.round(this.scrolledY() * th + th -
                      this.shiftY() - this.jumpHeight());
};
here's the code from altimit that modifies it (and I think this might be the source of the yanfly jitter but heck if I'm diving into that nightmare again once I have a fix that works for me)
Code:
var Game_CharacterBase_screenX = Game_CharacterBase.prototype.screenX;
      Game_CharacterBase.prototype.screenX = function() {
        var round = Math.round;
        Math.round = Math.floor;
        var val = Game_CharacterBase_screenX.call( this );
        Math.round = round;
        return val;
      };

      var Game_CharacterBase_screenY = Game_CharacterBase.prototype.screenY;
      Game_CharacterBase.prototype.screenY = function() {
        var round = Math.round;
        Math.round = Math.floor;
        var val = Game_CharacterBase_screenY.call( this );
        Math.round = round;
        return val;
      };
I think if you replaced the altimit code with something like this

Code:
var Game_CharacterBase_screenX = Game_CharacterBase.prototype.screenX;
      Game_CharacterBase.prototype.screenX = function() {
        var round = Math.round;
        Math.round = Math.floor;
        var val = Game_CharacterBase_screenX.call( this ) - Math.round($gameMap.tileWidth()/2);
        Math.round = round;
        return val;
      };

      var Game_CharacterBase_screenY = Game_CharacterBase.prototype.screenY;
      Game_CharacterBase.prototype.screenY = function() {
        var round = Math.round;
        Math.round = Math.floor;
        var val = Game_CharacterBase_screenY.call( this ) - $gameMap.tileHeight();
        Math.round = round;
        return val;
      };
you'd end up changing the base of the sprite (that is, the middle of the bottom edge) to the exact .x and .y coordinate. Haven't tested it, though.

Honestly I haven't had any issues dealing with the default tile offset, since all the relative math between events is identical.
 

CrasheR

Project: Dunsa's Prophecy
Member
Joined
May 11, 2012
Messages
28
Reaction score
13
First Language
Polish
Primarily Uses
RMMV
When I touch tile (that has other region) with left side of players collider (doesn't matter where i place it) its automatically thinks i'm at that region number. Even if that tile is not accessible. Thats why i was asking if you can move it from left corner of collider to middle of collider. Im complete noob if we talking about javascript. :(



 

Ace of Spades

Veteran
Veteran
Joined
Jan 19, 2017
Messages
96
Reaction score
123
First Language
English
Primarily Uses
When I touch tile (that has other region) with left side of players collider (doesn't matter where i place it) its automatically thinks i'm at that region number. Even if that tile is not accessible. Thats why i was asking if you can move it from left corner of collider to middle of collider. Im complete noob if we talking about javascript. :(



I think you're over-complicating things. Instead of moving the colliders, sprites, etc.... just change the value of the X Y coordinates you're getting from the player. Are you currently using Game Variables to determine the X Y coordinate, or are you using scripting? I'm assuming you're using Game Variables if you aren't familiar with js.

Under Control Variable command, you can set two variables: one for PlayerX one for PlayerY.

Control Variable, then select set to Script. Under the scripts fields, use ($gamePlayer.x + 0.5) and ($gamePlayer.y + 0.5) for each variable respectively.

Now those variables will be checking the center of the Collider box, instead of the upper left corner.
So if you want to use another Variable for Player Region, you can set it to Obtain the region ID of the X,Y values we set above.

Hope that made sense, let me know if you have questions.
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
324
Reaction score
207
First Language
English
Primarily Uses
RMMV
Why are you using regions with altimit instead of just defining a collider?
 

Ace of Spades

Veteran
Veteran
Joined
Jan 19, 2017
Messages
96
Reaction score
123
First Language
English
Primarily Uses
Why are you using regions with altimit instead of just defining a collider?
It looks like he's just using the region ID to determine which tile the player is standing on, not for collision. Almost like a pseudo-elevation system, the player region ID would tell which elevation level the player is standing on. At least that's what it appears as me, I don't want to assume anything. I'm doing something similar with my game, albeit it's a bit more complicated.
 

CrasheR

Project: Dunsa's Prophecy
Member
Joined
May 11, 2012
Messages
28
Reaction score
13
First Language
Polish
Primarily Uses
RMMV
Are you currently using Game Variables to determine the X Y coordinate, or are you using scripting? I'm assuming you're using Game Variables if you aren't familiar with js.
Full script calls, 0 variables.

pseudo-elevation system
Correct.
Code:
$gameMap.regionId($gameMap._events[this._eventId].x, $gameMap._events[this._eventId].y) === $gameMap.regionId($gamePlayer.x, $gamePlayer.y)
For region check.

ABS is based on Script Calls as well. I dont know javascript, but Calls are similar to those from previous makers.
Code:
Math.abs($gamePlayer._y - $gameMap._events[this._eventId]._y) >= 0 && Math.abs($gamePlayer._y - $gameMap._events[this._eventId]._y) <= 1
Math.abs($gamePlayer._x - $gameMap._events[this._eventId]._x) <= 1 && Math.abs($gamePlayer._x - $gameMap._events[this._eventId]._x) >= 0
Fragment of code.

All i want works perfect. Elevation level are determined correctly. The only problem is with that left side of collider. :/
I tried
Code:
$gameMap.regionId($gameMap._events[this._eventId].x, $gameMap._events[this._eventId].y) === $gameMap.regionId($gamePlayer.x - 0.5, $gamePlayer.y)
As well, but game does some wierd stuff.

stuff.gif
 
Last edited:

Ace of Spades

Veteran
Veteran
Joined
Jan 19, 2017
Messages
96
Reaction score
123
First Language
English
Primarily Uses
All i want works perfect. Elevation level are determined correctly. The only problem is with that left side of collider. :/
I tried
Code:
$gameMap.regionId($gameMap._events[this._eventId].x, $gameMap._events[this._eventId].y) === $gameMap.regionId($gamePlayer.x - 0.5, $gamePlayer.y)
As well, but game does some wierd stuff.
View attachment 135405
For your last line of code you posted, you should be adding 0.5 to the player X, instead of subtracting. You'd be doing to same for the event as well (because currently it's checking the upper left most edge of the event instead of the center) You may also need to add 0.5 to the y value, as I suggested.

Code:
$gameMap.regionId($gameMap._events[this._eventId].x + 0.5, $gameMap._events[this._eventId].y + 0.5) === $gameMap.regionId($gamePlayer.x + 0.5, $gamePlayer.y+0.5)
This will check the region ID of the center of the default collier box. Same would apply for events as well. Hope this helps.
 

CrasheR

Project: Dunsa's Prophecy
Member
Joined
May 11, 2012
Messages
28
Reaction score
13
First Language
Polish
Primarily Uses
RMMV
This will check the region ID of the center of the default collier box. Same would apply for events as well. Hope this helps.
Works perfect. Thank you very much!

ezgif-2-dbca292f4f99.gif

unknown.png
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Making it a rule that I don't do any world building for my new game before the actual gameplay is concrete and working. I have 16 years of lore to work with anyway.
Cheesy power metal makes everything better. No matter what you do, you'll feel heroic doing it.
Starting to really like the first of my madness areas. I think the eyes looking at them really helps to sell the place. :LZSexcite:
Made idle animation for character. It first had only three frames but looked too different from walking animation and I had to draw five more.
MV and VX Ace both have good qualities.

Forum statistics

Threads
95,694
Messages
931,075
Members
126,032
Latest member
MadAtticGames
Top