feat: Implement climbing system and tree collision avoidance for player
This commit adds: 1. Player climbing mechanism for small steps 2. Collision avoidance with trees (WOOD and LEAF pixels) 3. Enhanced animation states for climbing and jumping 4. Improved player movement and collision detection
This commit is contained in:
@@ -149,6 +149,20 @@ class Entity {
|
||||
isPixelSolid(x, y) {
|
||||
// Use ceiling for y coordinate to better detect ground below
|
||||
const pixel = getPixel(Math.floor(x), Math.ceil(y));
|
||||
|
||||
// For player entity, don't collide with trees (WOOD and LEAF)
|
||||
if (this.type === ENTITY_TYPES.PLAYER) {
|
||||
return pixel !== EMPTY &&
|
||||
pixel !== WATER &&
|
||||
pixel !== FIRE &&
|
||||
pixel !== SQUARE &&
|
||||
pixel !== CIRCLE &&
|
||||
pixel !== TRIANGLE &&
|
||||
pixel !== WOOD &&
|
||||
pixel !== LEAF;
|
||||
}
|
||||
|
||||
// For other entities, use the original collision detection
|
||||
return pixel !== EMPTY &&
|
||||
pixel !== WATER &&
|
||||
pixel !== FIRE &&
|
||||
|
||||
Reference in New Issue
Block a user