void manage_physics_lvl13() { if(player.box.x >= 8U && player.box.x <= 16U && player.box.y == PLAYER_SIZE+8U && player.state == CLIMBWALK) { player.box.y = 135U; switch_to_level(LEVEL10); return; } }
/* SEAGULL enemy_lvl4[1]={ {{96U, 96U, 6U, 9U}, 1,0U,0U, 128U, 28U} };*/ //6 x -1 y extern DOGGY doggy_lvl4 []; extern PLAYER player; extern Box* box1; extern Box* box2; extern const unsigned char Lvl4TileMap[];/* = {6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,11,13,6, 5,12,15,17,14,12,14,12,14,12,14,12,14,12,14,12, 6,15,17,3, 5,11,16,18,13,11,13,11,13,11,13,11,13,11,13,11, 6,16,18,3, 5,12,14,12,14,12,14,12,14,12,14,12,14,12,14,12, 6,12,14,3, 5,11,13,11,13,11,13,11,13,11,13,11,13,11,13,11, 6,11,13,3, 5,12,14,12,14,12,14,12,14,12,14,12,14,12,14,12, 6,12,14,3, 13,11,13,11,13,11,13,35,37,43,45,11,13,11,13,11, 6,11,13,3, 5, 5, 5,12,14,12,14,36,38,44,46,12,14,12,14,12, 6,12,14,3, 5, 5, 5,11,13,11,13,39,41,47,49,11,13,11,13,11, 6,11,13,3, 5, 5, 5,12,14,12,14,40,42,48,50,12,14,12,14,12, 6,12,14,3, 5, 5, 5,11,13,11,13,11,13,11,13,11,13,11,13,11, 6,11,13,3, 5, 5, 5,12,14,12,14,12,14,12,14,12,14,12,14,12, 6,12,14,3, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,11,13,3, 14,12,14,12,14,12,14,12,14,12,14,12,14,12,14,12, 6,12,14,3, 13,15,17,11,13,11,13,11,13,11,13,11,13,11,13,11, 6,15,17,3, 14,16,18,12,14,12,14,12,14,12,14,12,14,12,14,12,14,16,18,3, 13,11,13,11,13,11,13,11,13,11,13,11,13,11,13,11,13,11,13,3, 6,6,6,6,6,6,6,6,6,6,6,6,6,12,14,12,14,12,14,6}; */ void manage_physics_lvl4() { /*if(player.box.x == 8U && player.box.y == 136U && (player.state == CROUCHWALK || player.state == CROUCH) && player.dirX == -1) { player.newX = 160U-PLAYER_SIZE; player.newY = 136U; player.booleanState = player.booleanState | TRANSITIONNING; player.state = CROUCHTRANSITIONIN; player.timer = 0U; player.img_index = 0U; player.nextLevel = LEVEL3; }*/ if(player.box.x >= 104U && player.box.x <= 136U && player.box.y > 144U-9U ) { if((player.state == CLIMBWALK && player.dirY == -1) || player.state == JUMP || player.state == IDLE || player.state == WALK || player.state == CLIMB) { player.box.y = 8U+PLAYER_SIZE; if(player.state == IDLE || player.state == WALK) { player.state = JUMP; player.vely = 1U; } switch_to_level(LEVEL6); return; } } if(player.box.x == 8U && player.box.y >= 104U &&player.box.y <= 136U && player.dirX == -1 ) { player.box.x = 160U-PLAYER_SIZE-GROUND_HEIGHT-1U; switch_to_level(LEVEL3); return; } if(player.box.x >= 136U && player.box.x <= 152U && player.box.y == PLAYER_SIZE+8U && player.state == CLIMBWALK) { if(player.state == JUMP) player.vely = -3; player.box.y = 135U; switch_to_level(LEVEL2); return; } box1 = &(player.box); box2 = &(key_lvl4[0].box); if(player.key == NULL && !key_lvl4[0].used && checkCollision()) { player.key = key_lvl4; } box2 = &(doggy_lvl4[0].box); if(checkCollision()) { game_over(); } }
void manage_physics_lvl1(PLAYER* player) { if(player->box.x == 8U && player->box.y == 136U && (player->state == CROUCHWALK || player->state == CROUCH) && player->dirX == -1 ) { player->newX = 160U-PLAYER_SIZE; player->newY = 136U; player->booleanState = player->booleanState | TRANSITIONNING; player->state = CROUCHTRANSITIONIN; player->timer = 0U; player->img_index = 0U; player->nextLevel = LEVEL2; //switch_to_level(LEVEL2); }else if(player->box.x >= 104U && player->box.x <= 136U && player->box.y == PLAYER_SIZE+8U && player->state == CLIMBWALK) { player->box.y = 135U; switch_to_level(LEVEL4); }else if(player->box.x == 8U && player->box.y == 80U && (player->state == CROUCHWALK || player->state == CROUCH) && player->dirX == -1 ) { player->newX = 160U-PLAYER_SIZE; player->newY = 80U; player->booleanState = player->booleanState | TRANSITIONNING; player->state = CROUCHTRANSITIONIN; player->timer = 0U; player->img_index = 0U; player->nextLevel = LEVEL2; }else if(player->box.x == 72U-PLAYER_SIZE && player->box.y == 80U && (player->state == CROUCHWALK || player->state == CROUCH) && player->dirX == 1 ) { player->newX = 72U-2U; player->newY = 80U; player->booleanState = player->booleanState | TRANSITIONNING; player->state = CROUCHTRANSITIONIN; player->timer = 0U; player->img_index = 0U; player->nextLevel = NOLEVEL; //switch_to_level(LEVEL2); } else if(player->box.x == 80U && player->box.y == 80U && (player->state == CROUCHWALK || player->state == CROUCH)&& player->dirX == -1 ) { player->newX = 72U-PLAYER_SIZE+8U; player->newY = 80U; player->booleanState = player->booleanState | TRANSITIONNING; player->state = CROUCHTRANSITIONIN; player->timer = 0U; player->img_index = 0U; player->nextLevel = NOLEVEL; //switch_to_level(LEVEL2); } if(player->key != NULL && checkCollision(&(player->key->box), locks_lvl1[0].box)) { player->key->box.x = player->key->originX; player->key->box.y = player->key->originY; player->key->used = 1U; player->key = NULL; locks_lvl1[0].box->x = 0U; locks_lvl1[0].box->y = 0U; locks_lvl1[0].box->w = 0U; locks_lvl1[0].box->h = 0U; locks_lvl1[0].locked = 0U; victory(); SWITCH_ROM_MBC1(6); } /*if(checkCollision(&(enemy_lvl1[0].box), &(player->box))) { manage_enemy_collision(player, (ENEMY*) enemy_lvl1); }*/ }
void manage_physics_lvl4(PLAYER* player) { if(player->box.x == 8U && player->box.y == 136U && (player->state == CROUCHWALK || player->state == CROUCH) && player->dirX == -1) { player->newX = 160U; player->newY = 136U; player->booleanState = player->booleanState | TRANSITIONNING; player->state = CROUCHTRANSITIONIN; player->timer = 0U; player->img_index = 0U; player->nextLevel = LEVEL3; } else if(player->box.x >= 104U && player->box.x <= 136U && player->box.y > 144U-9U ) { if((player->state == CLIMBWALK && player->dirY == -1) || player->state == JUMP || player->state == IDLE || player->state == WALK) { player->box.y = 8U+PLAYER_SIZE; if(player->state == IDLE || player->state == WALK) { player->state = JUMP; player->vely = 1U; } switch_to_level(LEVEL1); } }else if(player->box.x == GROUND_HEIGHT && player->box.y == 56U && (player->state == CROUCHWALK || player->state == CROUCH) && player->dirX == -1 ) { player->newX = 160U; player->newY = 56U; player->booleanState = player->booleanState | TRANSITIONNING; player->state = CROUCHTRANSITIONIN; player->timer = 0U; player->img_index = 0U; player->nextLevel = LEVEL3; }else if(player->box.x == 8U && player->box.y >= 104U &&player->box.y <= 136U && player->dirX == -1 ) { player->box.x = 160U-PLAYER_SIZE-GROUND_HEIGHT-1U; switch_to_level(LEVEL3); }else if(player->box.x >= 136U && player->box.x <= 152U && player->box.y == PLAYER_SIZE+8U && player->state == CLIMBWALK) { if(player->state == JUMP) player->vely = -3; player->box.y = 135U; switch_to_level(LEVEL6); } else if(player->key == NULL && !key_lvl4[0].used &&checkCollision(&(player->box), &(key_lvl4[0].box))) { player->key = key_lvl4; } if(checkCollision(&(enemy_lvl4[0].box), &(player->box))) { manage_enemy_collision(player, (ENEMY*) enemy_lvl4); } }