void Asteroid::reset() { posX = dbObjectPositionX(obj); posY = dbObjectPositionY(obj); posZ = dbObjectPositionZ(obj); if(posY <= -22 || posX <= -25 || posX >= 25 || posY >= 35) { totalSpeed = moveSpeed + GAME_SPEED; dbPositionObject ( obj, dbRnd(47) -25 , dbRnd(10) +25 , 0); } return; }
//TINY_ROID Tiny_Roid::Tiny_Roid() { obj = findFreeObject(100); dbCloneObject(obj, TINY_OBJ); moveSpeed = TINY_STROID_SPEED; totalSpeed = moveSpeed + GAME_SPEED; maxMoveSpeed = TINY_STROID_MAX_SPEED; size = 1; health = 5; dmg = .5; SC_SetupObject(obj, 1, 2); //dbSetObjectAmbient ( ASTERIOD5, 0 ); SC_UpdateObject(obj); //updates the map's collision box dbRotateObject (obj, dbRnd(360) - 360, dbRnd(360) - 360, dbRnd(360) - 360 ); dbPositionObject(obj, -30, 4,0); dbSetObjectCollisionToPolygons(obj ); }
//LARGE_ROID Large_Roid::Large_Roid() { obj = findFreeObject(100); dbCloneObject(obj, LARGE_OBJ); moveSpeed = LARGE_STROID_SPEED; totalSpeed = moveSpeed + GAME_SPEED; maxMoveSpeed = LARGE_STROID_MAX_SPEED; size = 5; health = 20; dmg = 2.0; SC_SetupObject(obj, 1, 2); //dbSetObjectAmbient ( ASTERIOD1, 0 ); SC_UpdateObject(obj); //updates the map's collision box dbRotateObject (obj, dbRnd(360) - 360, dbRnd(360) - 360, dbRnd(360) - 360 ); dbPositionObject(obj, 0, -30,0); dbSetObjectCollisionToPolygons(obj ); }
//MEDIUM_ROID Medium_Roid::Medium_Roid() { obj = findFreeObject(100); dbCloneObject(obj, MEDIUM_OBJ); moveSpeed = MEDIUM_STROID_SPEED; totalSpeed = moveSpeed + GAME_SPEED; maxMoveSpeed = MEDIUM_STROID_MAX_SPEED; size = 3; health = 10; dmg = 1.0; SC_SetupObject(obj, 1, 2); //dbSetObjectAmbient ( ASTERIOD3, 0 ); SC_UpdateObject(obj); //updates the map's collision box dbRotateObject (obj, dbRnd(360) - 360, dbRnd(360) - 360, dbRnd(360) - 360 ); dbPositionObject(obj, -30, 4,0); dbSetObjectCollisionToPolygons(obj ); }
void Missile::initialize() { explosion.turnOffExplosion(); resetSounds(); setAnimation(eFlying); if(!facingRight) changeDirection(); x = dbRnd(100) - 300; speed = maxSpeed; if(dbRnd(1)) { speed = maxSpeed * -1; x = dbRnd(100) + 1100; changeDirection(); } y = 163; }