One way I have used in the past is to have gravity areas, which are actually an invisible sprite. Create a Sprite called "GravityZone" and give it a semi transparent red colour. Then add an numerical instance variable called "gravity_angle". Change the "Initially visible" setting to false for GravityZone. Now you will be able to see the zones in the editor, but not in the game.
On your event sheet add an event with the condition "GravityZone is overlapping Insect", then add the action "Insect set gravity angle" with the expression "GravityZone.gravity_angle". Place gravity zones along your walls and change the angle for each instance to point towards the wall. Now whenever your insect is next to that wall it will be attracted to it.
This presumes your insect is using the platform behaviour, you can probably adjust this technique to other ways of creating gravity. The transition between gravity zones can be a little awkward unfortunately, but some adjustment to the events can often smooth it out.