Exemplo n.º 1
0
bool GameLayer::isCollisionArea(COLL_STATE state, CCRect roleBox, CCRect collisionBox) {
    bool bFlag = false;
    
    switch (state) {
        case COLL_STATE_LEFT: {
            bFlag = isCollisionLeft(roleBox, collisionBox);
            break;
        }
        case COLL_STATE_RIGHT: {
            bFlag = isCollisionRight(roleBox, collisionBox);
            break;
        }
        case COLL_STATE_TOP: {
            bFlag = isCollisionTop(roleBox, collisionBox);
            break;
        }
        case COLL_STATE_BOTTOM: {
            bFlag = isCollisionBottom(roleBox, collisionBox);
            break;
        }
        default:
            break;
    }
    
    if (bFlag) {
        fixCollision(state, mRole, collisionBox);
    }
    
    return bFlag;
}
Exemplo n.º 2
0
void collisions() {
	//////////////////////////////////////////
	// Collisions
	//////////////////////////////////////////
	colSolidLeft = false;
	colSolidRight = false;
	colLeft = false;
	colRight = false;
	colTop = false;
	colBot = false;
	colLadder = false;
	colPlatBot = false;
	colPlat = false;
	colWaterTop = false;
	colIceBot = false;
	runKey = false;

	if (isCollisionMoveableSolidLeft(1)) {
		colSolidLeft = true;
	}
	if (isCollisionMoveableSolidRight(1)) {
		colSolidRight = true;
	}
	if (isCollisionLeft(1)) {
		colLeft = true;
	}
	if (isCollisionRight(1)) {
		colRight = true;
	}
	if (isCollisionTop(1)) {
		colTop = true;
	}
	if (isCollisionBottom(1)) {
		colBot = true;
	}
	if (isCollisionLadder()) {
		colLadder = true;
	}
	if (isCollisionPlatformBottom(1)) {
		colPlatBot = true;
	}
	if (isCollisionPlatform()) {
		colPlat = true;
	}
	if (isCollisionWaterTop(1)) {
		colWaterTop = true;
	}
	if (collision_point(x, y + 8, oIce, 0, 0)) {
		colIceBot = true;
	}
}
Exemplo n.º 3
0
interrupt void WDT_interval_handler(){
    
    // get reading from left sensor and checks against threshold value, if the reading is greater
    // then LED1 is turned on
    
    if (isCollisionLeft()){
        P1OUT &= ~BIT0;
    }
    else{
        P1OUT |= BIT0;
    }
    
    // get reading from right sensor and checks against hreshold value, if the reading is greater
    // then LED2 is turned on
    
    if (isCollisionRight()){
        P1OUT &= ~BIT6;
    }
    else{
        P1OUT |= BIT6;
    }
    
}