GameMaker Studio 2 Grass

Grass ‘Squish’ Effect


Here is a quick rundown of how I achieved the ‘squish’ effect for the grass in the gif above. It’s really pretty simple and adds quite a bit of ‘feel’ to the game.

The basic concept is that you are just skewing the top of the grass sprite away from anything that touches it and flattening it a little bit. You can see it better in this gif where boxes are drawn around the sprites.


I did this in GameMaker but you should be able to apply this to anything.

I’ll explain this by showing you each event that I created in my object.


First thing to do is create your ‘grass’ object and declare a couple variables in it for keeping track of the skew amount of your grass. I simply used xVar and yVar.

xVar = 0;
yVar = 0;


Next you’ll need to add a collision event with whatever you want to affect the grass. In it you’ll need to calculate the horizontal distance between the object and the grass and use that to set your grass variables:

var xDist = x – other.x;
var flattenAmount = .3;
xVar = xDist;
yVar = xDist * flattenAmount;   

(This is a simplified equation for yVar, ideally you should divide the xdist by the max amount it can be and use that to flatten the sprite, but I didn’t want to over complicate this explanation.)

End Step

At each step we should approach our normal scale.

xVar = xVar * .8;
yVar = yVar * .8;

(Again this is simplified, you could easily do some sort of easing function here and it would look much better)


Finally drawing the sprite. Just draw the sprite and skew/flatten the top of it

draw_sprite_pos(sprite_index, image_index,
   bbox_left + xVar,
   bbox_top + yVar,
   bbox_right + xVar,
   bbox_top + yVar,
   bbox_bottom + 1,
   bbox_bottom + 1,

There you have it! Squishy grass! 


      • Josh Maggard

More Posts

Send Us A Message

GameMaker Studio 2 Grass

More Posts

Send Us A Message