dannyboy84 commited on
Commit
7aefad1
·
verified ·
1 Parent(s): 2ec36d9

make it 2 seconds for each piece

Browse files
Files changed (1) hide show
  1. script.js +22 -20
script.js CHANGED
@@ -88,22 +88,24 @@ this.keys = {
88
 
89
  // Generate initial food
90
  for (let i = 0; i < 50; i++) {
91
- const foodTypes = [
92
- { type: 'lollipop', radius: 12, color: '#FF5252', time: 1, rarity: 0.5 },
93
- { type: 'gummybear', radius: 10, color: '#FF4081', time: 1, rarity: 0.5 },
94
- { type: 'candycorn', radius: 8, color: '#FFD740', time: 1, rarity: 0.5 },
95
- { type: 'chocolate', radius: 14, color: '#7B3F00', time: 10, rarity: 0.1 },
96
- { type: 'marshmallow', radius: 9, color: '#FFFFFF', time: 5, rarity: 0.2 }
97
- ];
98
  const randomFood = foodTypes[Math.floor(Math.random() * foodTypes.length)];
99
  this.foods.push({
100
- x: Math.random() * this.canvas.width,
101
- y: Math.random() * this.canvas.height,
102
- radius: randomFood.radius,
103
- color: randomFood.color,
104
- type: randomFood.type,
105
- points: randomFood.points,
106
- time: Math.max(1, 5 - (this.players[this.playerId]?.segments.length * 0.05))
 
 
107
  });
108
  }
109
  this.gameStarted = true;
@@ -211,13 +213,13 @@ return false; // Remove food
211
  // Add new food if needed
212
  if (this.foods.length < 30 && Math.random() < 0.1) {
213
  const foodTypes = [
214
- { type: 'lollipop', radius: 12, color: '#FF5252', points: 10 },
215
- { type: 'gummybear', radius: 10, color: '#FF4081', points: 5 },
216
- { type: 'candycorn', radius: 8, color: '#FFD740', points: 3 },
217
- { type: 'chocolate', radius: 14, color: '#7B3F00', points: 15 },
218
- { type: 'marshmallow', radius: 9, color: '#FFFFFF', points: 8 }
219
  ];
220
- const randomFood = foodTypes[Math.floor(Math.random() * foodTypes.length)];
221
  this.foods.push({
222
  x: Math.random() * this.canvas.width,
223
  y: Math.random() * this.canvas.height,
 
88
 
89
  // Generate initial food
90
  for (let i = 0; i < 50; i++) {
91
+ const foodTypes = [
92
+ { type: 'lollipop', radius: 12, color: '#FF5252', time: 2, rarity: 0.5 },
93
+ { type: 'gummybear', radius: 10, color: '#FF4081', time: 2, rarity: 0.5 },
94
+ { type: 'candycorn', radius: 8, color: '#FFD740', time: 2, rarity: 0.5 },
95
+ { type: 'chocolate', radius: 14, color: '#7B3F00', time: 2, rarity: 0.1 },
96
+ { type: 'marshmallow', radius: 9, color: '#FFFFFF', time: 2, rarity: 0.2 }
97
+ ];
98
  const randomFood = foodTypes[Math.floor(Math.random() * foodTypes.length)];
99
  this.foods.push({
100
+ x: Math.random() * this.canvas.width,
101
+ y: Math.random() * this.canvas.height,
102
+ radius: randomFood.radius,
103
+ color: randomFood.color,
104
+ type: randomFood.type,
105
+ points: randomFood.points,
106
+ time: 2 // Fixed 2 seconds for all food types
107
+ ,
108
+ time: 2 // Fixed 2 seconds for all food types
109
  });
110
  }
111
  this.gameStarted = true;
 
213
  // Add new food if needed
214
  if (this.foods.length < 30 && Math.random() < 0.1) {
215
  const foodTypes = [
216
+ { type: 'lollipop', radius: 12, color: '#FF5252', points: 10, time: 2 },
217
+ { type: 'gummybear', radius: 10, color: '#FF4081', points: 5, time: 2 },
218
+ { type: 'candycorn', radius: 8, color: '#FFD740', points: 3, time: 2 },
219
+ { type: 'chocolate', radius: 14, color: '#7B3F00', points: 15, time: 2 },
220
+ { type: 'marshmallow', radius: 9, color: '#FFFFFF', points: 8, time: 2 }
221
  ];
222
+ const randomFood = foodTypes[Math.floor(Math.random() * foodTypes.length)];
223
  this.foods.push({
224
  x: Math.random() * this.canvas.width,
225
  y: Math.random() * this.canvas.height,