Changeset 311
- Timestamp:
- Jan 30, 2011, 6:31:14 PM (10 years ago)
- Location:
- trunk/monsterz
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/monsterz/board.cpp
r308 r311 218 218 for (int j = 0; j < 8; j++) 219 219 for (int i = 0; i < 8; i++) 220 data->pairs[i][j].id = 1 + rand() % 8;220 data->pairs[i][j].id = 1 + rand() % 9; 221 221 } while (ListMashes(list) || !(data->nmoves = ListMoves(list))); 222 222 … … 312 312 { 313 313 Piece *old = data->pairs[i][j].piece; 314 int id = 1 + rand() % 8;314 int id = 1 + rand() % 9; 315 315 data->pairs[i][j].id = id; 316 316 data->pairs[i][j].piece = new Piece(data->emitter, int2(i, j), 80 + 20 * id); … … 337 337 * the board. */ 338 338 int2 newpos = int2(i * 48, below->GetPos().y + 48); 339 int id = 1 + rand() % 8;339 int id = 1 + rand() % 9; 340 340 data->pairs[i][7].id = id; 341 341 data->pairs[i][7].piece = new Piece(data->emitter, int2(i, 7), 80 + 20 * id); -
trunk/monsterz/monsterz.h
r305 r311 18 18 static char const * const WAV_WHIP = "monsterz/sound/whip.wav"; 19 19 20 /* Duration of the idle loop */ 21 static int const DELAY_IDLE = 300; 20 22 /* Duration of a blink */ 21 static int const DELAY_BLINK = 400;23 static int const DELAY_BLINK = 200; 22 24 /* Wait time until the next whip sound is allowed */ 23 25 static int const DELAY_WHIP = 300; -
trunk/monsterz/piece.cpp
r303 r311 65 65 data->id = id; 66 66 data->state = PieceData::IDLE; 67 data->timer = RandF(DELAY_IDLE); 67 68 } 68 69 … … 237 238 { 238 239 case PieceData::IDLE: 239 break;240 case PieceData::BLINK:241 240 data->timer -= deltams; 242 241 if (data->timer < 0.0f) 242 data->timer = DELAY_IDLE; 243 break; 244 case PieceData::BLINK: 245 data->timer -= deltams; 246 if (data->timer < 0.0f) 247 { 243 248 data->state = PieceData::IDLE; 249 data->timer = RandF(DELAY_IDLE); 250 } 244 251 break; 245 252 case PieceData::GRAB: … … 265 272 } 266 273 if (data->timer > moving_time + 200.0f) 274 { 267 275 data->state = PieceData::IDLE; 276 data->timer = RandF(DELAY_IDLE); 277 } 268 278 break; 269 279 } … … 273 283 { 274 284 float3 pos(data->pos.x + 24, data->pos.y + 177, 5); 275 int start = data->id + 1 0;276 int stop = data->id + 1 3;285 int start = data->id + 12; 286 int stop = data->id + 15; 277 287 for (int id = start; id < stop; id++) 278 288 { 279 float3 vel(RandF(-0.3f, 0.3f), RandF(0.2f, 0.3f), 0.0f); 289 float angle = RandF(-1.2f, 1.2f); 290 float speed = RandF(0.3f, 0.5f); 291 float3 vel(speed * sinf(angle), speed * cosf(angle), 0.0f); 280 292 data->emitter->AddParticle(id, pos, vel); 281 293 } … … 303 315 { 304 316 case PieceData::IDLE: 305 break; 306 case PieceData::BLINK: 307 id = data->id + 1; 308 break; 309 case PieceData::GRAB: 310 id = data->id + 1; 317 { 318 int off = data->timer * 3 / DELAY_IDLE; 319 if (off < 0) off = 0; 320 if (off > 2) off = 2; 321 id = data->id + off; 322 break; 323 } 324 case PieceData::BLINK: 325 id = data->id + 3; 326 break; 327 case PieceData::GRAB: 328 id = data->id + 3; 311 329 z = 4; 312 330 break; 313 331 case PieceData::UNGRAB: 314 332 if ((data->cell * 48 - data->src).sqlen() > 24 * 24) 315 id = data->id + 5;333 id = data->id + 7; 316 334 z = 4; 317 335 break; … … 324 342 if (off < 0) off = 0; 325 343 if (off > 4) off = 4; 326 id = data->id + 5+ off;344 id = data->id + 7 + off; 327 345 break; 328 346 }
Note: See TracChangeset
for help on using the changeset viewer.