God is here, and he will not be forgiveful about your sins
This commit is contained in:
parent
1af32bafd8
commit
3dda6a690a
@ -21,7 +21,7 @@ players:
|
||||
invaders:
|
||||
fireCooldown: 20
|
||||
size: 25
|
||||
speed: 2
|
||||
speed: 7
|
||||
distance: 10 # distance in pixels between invaders
|
||||
|
||||
typeA:
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
Position thrownVector;
|
||||
Position thrownTransition;
|
||||
|
||||
Position getLeftHandPos(unsigned screenWidth) const;
|
||||
Position getRightHandPos(unsigned screenWidth) const;
|
||||
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
13651974094361129891
|
||||
560753531201765499
|
||||
Thomas,1000
|
||||
Thomas,0
|
||||
Thomas,300
|
||||
Thomas,0
|
||||
Thomas,0
|
||||
Thomas,0
|
||||
|
@ -63,11 +63,10 @@ void Game::displayGod() const {
|
||||
case GodState::NONE:
|
||||
return;
|
||||
case GodState::AWAKE: {
|
||||
unsigned dividedCounter = god.counter/1;
|
||||
pm.drawGodBench(dividedCounter - GOD_BENCH_SIZE);
|
||||
pm.drawGodBench(god.counter - GOD_BENCH_SIZE);
|
||||
|
||||
Position leftHand(pm.getScreenWidth()-GOD_HAND_DISTANCE-GOD_HAND_SIZE, dividedCounter-GOD_BENCH_SIZE);
|
||||
Position rightHand(GOD_HAND_DISTANCE, dividedCounter-GOD_BENCH_SIZE);
|
||||
Position leftHand(GOD_HAND_DISTANCE, god.counter-GOD_BENCH_SIZE);
|
||||
Position rightHand(pm.getScreenWidth()-GOD_HAND_DISTANCE-GOD_HAND_SIZE, god.counter-GOD_BENCH_SIZE);
|
||||
pm.drawGodLeftHand(leftHand);
|
||||
pm.drawGodRightHand(rightHand);
|
||||
break;
|
||||
@ -76,7 +75,7 @@ void Game::displayGod() const {
|
||||
pm.drawGodBench(0);
|
||||
|
||||
Position leftHand(GOD_HAND_DISTANCE, 0);
|
||||
Position rightHand(pm.getScreenWidth()-GOD_HAND_DISTANCE-GOD_HAND_SIZE, 0);
|
||||
Position rightHand(god.getRightHandPos(pm.getScreenWidth()));
|
||||
pm.drawGodLeftHand(leftHand);
|
||||
pm.drawGodRightHand(rightHand);
|
||||
break;
|
||||
@ -88,7 +87,7 @@ void Game::displayGod() const {
|
||||
pm.drawGodBench(0);
|
||||
pm.drawGodLeftHand(Position(GOD_HAND_DISTANCE, 0));
|
||||
|
||||
Position pos(pm.getScreenWidth()-GOD_HAND_DISTANCE-GOD_HAND_SIZE, 0);
|
||||
Position pos(god.getRightHandPos(pm.getScreenWidth()));
|
||||
Position endPos = invIndexToPos(god.thrownInvPosX, god.thrownInvPosY);
|
||||
|
||||
applyBezier(pos, god.thrownTransition, god.counter / 100.0);
|
||||
@ -98,6 +97,7 @@ void Game::displayGod() const {
|
||||
pm.drawGodRightHand(pos);
|
||||
// TODO remove "closed" arg
|
||||
if(god.state==GodState::RETRIEVE2){
|
||||
|
||||
pos+=Position(GOD_HAND_SIZE/2, GOD_HAND_SIZE/2);
|
||||
pos-=Position(confData.invadersSize/2, confData.invadersSize/2);
|
||||
displayInvader(pos, god.thrownInvType);
|
||||
@ -109,7 +109,7 @@ void Game::displayGod() const {
|
||||
pm.drawGodLeftHand(Position(GOD_HAND_DISTANCE, 0));
|
||||
|
||||
// compute start position (not sure if we should store it or compute it each time ?)
|
||||
Position handPos = god.getLeftHandPos(pm.getScreenWidth());
|
||||
Position handPos = god.getRightHandPos(pm.getScreenWidth());
|
||||
|
||||
Position invaderPos = handPos;
|
||||
applyTransformation(invaderPos, GOD_HAND_SIZE, confData.invadersSize);
|
||||
@ -117,14 +117,15 @@ void Game::displayGod() const {
|
||||
invaderPos = invaderPos + a;
|
||||
|
||||
displayInvader(invaderPos, god.thrownInvType);
|
||||
if(god.counter>60){
|
||||
if(god.counter<30){
|
||||
// handling hand retraction
|
||||
unsigned handCounter;
|
||||
if(god.counter>30)handCounter = 30-god.counter;
|
||||
else handCounter = god.counter;
|
||||
if(god.counter<15)handCounter = god.counter;
|
||||
else handCounter = 30-god.counter;
|
||||
handPos = handPos + god.thrownVector * (handCounter / 100.0);
|
||||
pm.drawGodRightHand(handPos);
|
||||
}
|
||||
pm.drawGodRightHand(handPos);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ void Game::manageGod() {
|
||||
break;
|
||||
}
|
||||
case GodState::WAIT: {
|
||||
if (god.counter == 50) {
|
||||
if (god.counter == 100) {
|
||||
// init throw
|
||||
god.counter = 0;
|
||||
god.state = GodState::RETRIEVE1;
|
||||
@ -43,18 +43,18 @@ void Game::manageGod() {
|
||||
case GodState::RETRIEVE2: {
|
||||
if (god.counter == 0) {
|
||||
god.state = GodState::THROW;
|
||||
god.counter = 0;
|
||||
|
||||
// compute the launch vector
|
||||
|
||||
Position invaderMiddlePos(pm.getScreenWidth() - GOD_HAND_DISTANCE - GOD_HAND_SIZE / 2,
|
||||
GOD_HAND_SIZE / 2);
|
||||
|
||||
|
||||
playerID target;
|
||||
if (players.size() == 1)target = 0; // don't want to use random if not needed
|
||||
else target = rand() % players.size();
|
||||
Position playerMiddlePos(players[target].x + confData.playersWidth / 2,
|
||||
pm.getScreenWidth() - PLAYER_HEIGHT / 2);
|
||||
pm.getScreenHeight() - PLAYER_HEIGHT / 2);
|
||||
|
||||
god.thrownVector = playerMiddlePos - invaderMiddlePos;
|
||||
god.thrownVector = god.thrownVector / (god.thrownVector.computeMagnitude() / 1000.0);
|
||||
@ -67,7 +67,7 @@ void Game::manageGod() {
|
||||
++god.counter;
|
||||
|
||||
|
||||
Position invaderPos = god.getLeftHandPos(pm.getScreenWidth());
|
||||
Position invaderPos = god.getRightHandPos(pm.getScreenWidth());
|
||||
applyTransformation(invaderPos, GOD_HAND_SIZE, confData.invadersSize);
|
||||
Position a = god.thrownVector * (god.counter / 100.0);
|
||||
invaderPos = invaderPos + a;
|
||||
@ -75,11 +75,11 @@ void Game::manageGod() {
|
||||
bool touched = false;
|
||||
|
||||
// check if OOB (Out Of Bounds)
|
||||
if (invaderPos.getY() >= pm.getScreenWidth() &&
|
||||
if (invaderPos.getY()+confData.invadersSize >= pm.getScreenWidth() ||
|
||||
(invaderPos.getX() < 0 || invaderPos.getX() + confData.invadersSize >= pm.getScreenWidth())) {
|
||||
touched = true;
|
||||
// check player collision
|
||||
} else if (invaderPos.getY() + confData.invadersSize >= pm.getScreenWidth() - PLAYER_HEIGHT) {
|
||||
} else if (invaderPos.getY() + confData.invadersSize >= pm.getScreenHeight() - PLAYER_HEIGHT) {
|
||||
for (Player &p: players) {
|
||||
if (areLinesColliding(
|
||||
p.x, p.x + confData.playersWidth,
|
||||
@ -104,6 +104,6 @@ void Game::manageGod() {
|
||||
}
|
||||
}
|
||||
|
||||
Position God::getLeftHandPos(unsigned screenWidth) const {
|
||||
return Position(screenWidth - GOD_HAND_DISTANCE - GOD_HAND_SIZE, GOD_HAND_SIZE);
|
||||
Position God::getRightHandPos(unsigned screenWidth) const {
|
||||
return Position(screenWidth - GOD_HAND_DISTANCE - GOD_HAND_SIZE, 0);
|
||||
}
|
Loading…
Reference in New Issue
Block a user