feat: Add rabbit element with jumping and movement behaviors

This commit introduces a new rabbit element with the following features:
- Jumping mechanics with variable height
- Random direction changes
- Falling and basic ground interaction
- Color variations
- Avoidance of water

The changes include:
- Added RABBIT constant to element types
- Created rabbit.js with updateRabbit function
- Added RABBIT_COLORS to constants
- Implemented basic rabbit movement and behavior logic
This commit is contained in:
Kacper Kostka (aider)
2025-04-05 15:57:54 +02:00
parent bb45c9fba8
commit 60c2db558f
2 changed files with 112 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ const FLOWER_COLORS = ['#FF0000', '#FFFF00', '#FF00FF', '#FFA500', '#FFFFFF', '#
const LEAF_COLOR = '#228B22';
const FIRE_COLORS = ['#FF0000', '#FF3300', '#FF6600', '#FF9900', '#FFCC00', '#FFFF00'];
const LAVA_COLORS = ['#FF0000', '#FF3300', '#FF4500', '#FF6600', '#FF8C00'];
const RABBIT_COLORS = ['#FFFFFF', '#E0E0E0', '#D3C8B4']; // White, Light Gray, Light Brown
// Color variation functions
function getRandomColorVariation(baseColor, range) {
@@ -58,6 +59,7 @@ const TREE_SEED = 11;
const LEAF = 12;
const FIRE = 13;
const LAVA = 14;
const RABBIT = 15;
// Flammable materials
const FLAMMABLE_MATERIALS = [GRASS, WOOD, SEED, GRASS_BLADE, FLOWER, TREE_SEED, LEAF];