Worm Walking

From Worms Knowledge Base

Revision as of 22:10, 4 December 2006 by Etho (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Walkexample.png

Worms wouldn't be very fun if your worm stopped moving every time a pixel got in your way. So to keep movement smoother, the game's physics coding initiates upto an 8 pixel check to see if your worm can be moved ontop of the collided pixel(s). Your worm gets shifted upwards if a negative collision is returned from the loop (1 to 8). If not, your worm will stop moving.

The above image demonstrates how the game calculates what to do when a collision occurs in the walking sequence. White refers to the worm mask, Green refers to the terrain mask, Blue refers to pixels where the two layers have collided, and the Red Arrow refers to the horizontal shift occuring in the frame.


Similarly, to prevent your worm from walking on thin air, the game needs to detect if there are degradations in the landscape as you are walking. This is done by initiating an 8 pixel check below the worm mask. Your worm gets shifted downwards if a positive collision is returned from the loop (1 to 8). If not, the gravity formula gets applied to the worm and the falling sequence is initiated.

Personal tools