forked from DizzyEggg/pokeemerald
-
Notifications
You must be signed in to change notification settings - Fork 3
Omnidirectional Jump
ghoulslash edited this page Apr 2, 2021
·
2 revisions
credits to ghoulslash
This tutorial teaches you how to create a tile behavior that lets you jump over it from any direction
Open include/constants/metatile_behaviors.h. Replace an unused behavior with: e.g.:
-#define MB_UNUSED_1D 0x1D
+#define MB_OMNIDIRECTIONAL_JUMP 0x1D
Open src/event_object_movement.c, and find GetLedgeJumpDirection
and replace the entire function with the following:
u8 GetLedgeJumpDirection(s16 x, s16 y, u8 z)
{
static bool8 (*const sLedgeJumpBehaviors[])(u8) = {
MetatileBehavior_IsJumpSouth,
MetatileBehavior_IsJumpNorth,
MetatileBehavior_IsJumpWest,
MetatileBehavior_IsJumpEast,
};
u8 behavior;
u8 direction = z;
if (direction == 0)
return 0;
else if (direction > 4)
direction -= 4;
direction--;
behavior = MapGridGetMetatileBehaviorAt(x, y);
if (sLedgeJumpBehaviors[direction](behavior) || MetatileBehavior_IsOmnidirectionalJump(behavior))
return direction + 1;
return DIR_NONE;
}
Open src/metatile_behavior.c. Add the following at the end of the file
bool8 MetatileBehavior_IsOmnidirectionalJump(u8 metatileBehavior)
{
if (metatileBehavior == MB_OMNIDIRECTIONAL_JUMP)
return TRUE;
else
return FALSE;
}
Then, open include/metatile_behavior.h and add the following somewhere:
+bool8 MetatileBehavior_IsOmnidirectionalJump(u8 metatileBehavior);
Give one of your tiles the behavior MB_OMNIDIRECTIONAL_JUMP
in porymap, and jump for joy!