written by Bivurnum
also works for expansion
When an object is in long grass, their sprite gets split into two. The bottom part of the object gets completely hidden, which makes the top part look severed along a straight line rather than hidden behind the grass like with the tall grass. This tutorial will show you how to make this effect look more natural.
Code
In the src/event_object_movement.c file, make the following changes:
In the DoGroundEffects_OnSpawn function, remove this line:
UpdateObjectEventElevationAndPriority(objEvent, sprite);
GetAllGroundEffectFlags_OnSpawn(objEvent, &flags);
- SetObjectEventSpriteOamTableForLongGrass(objEvent, sprite);
DoFlaggedGroundEffects(objEvent, sprite, flags);
objEvent->triggerGroundEffectsOnMove = FALSE;
objEvent->disableCoveringGroundEffects = 0;
In the DoGroundEffects_OnBeginStep function, make this change:
UpdateObjectEventElevationAndPriority(objEvent, sprite);
GetAllGroundEffectFlags_OnBeginStep(objEvent, &flags);
+ if (objEvent->movementDirection == DIR_NORTH || objEvent->movementDirection == DIR_SOUTH)
+ SetObjectEventSpriteOamTableForLongGrass(objEvent, sprite);
filters_out_some_ground_effects(objEvent, &flags);
DoFlaggedGroundEffects(objEvent, sprite, flags);
objEvent->triggerGroundEffectsOnMove = FALSE;
objEvent->disableCoveringGroundEffects = 0;
In the DoGroundEffects_OnFinishStep function, remove this line:
UpdateObjectEventElevationAndPriority(objEvent, sprite);
GetAllGroundEffectFlags_OnFinishStep(objEvent, &flags);
- SetObjectEventSpriteOamTableForLongGrass(objEvent, sprite);
FilterOutStepOnPuddleGroundEffectIfJumping(objEvent, &flags);
DoFlaggedGroundEffects(objEvent, sprite, flags);
objEvent->triggerGroundEffectsOnStop = 0;
objEvent->landingJump = 0;
These changes will make it so the object sprite won't get chopped up unless the object is moving North or South between two long grass tiles. This makes sure the object doesn't completely pop out of the long grass when moving in those directions.
Graphics
Finally, the field effect sprite for the long grass will need to be edited. In the image at graphics/field_effects/pics/long_grass.png, any pixels that have the light green grass color should be replaced with the transparent color. This allows the objects to appear as though behind the grass blades instead of cut off by the whole sprite.
Before
After
Or you can replace the whole image file with this png:
That's all there is to it!