virtual public void update() { //Chequear por click y activar poder dependiendo del click. //Si se activo uno de los poderes entonces hay que empezar a correr el cooldown if (CMouse.firstPress(CMouse.BUTTONS.LEFT) && isActivePower && leftPowerElapsedCooldown >= leftPowerBaseCooldown) { this.leftClickPower(); leftPowerElapsedCooldown = 0f; } else if (CMouse.firstPress(CMouse.BUTTONS.RIGHT) && isActivePower && rightPowerElapsedCooldown >= rightPowerBaseCooldown) { this.rightClickPower(); rightPowerElapsedCooldown = 0f; } if (leftPowerElapsedCooldown < leftPowerBaseCooldown) { leftPowerElapsedCooldown += Time.deltaTime; } if (rightPowerElapsedCooldown < rightPowerBaseCooldown) { rightPowerElapsedCooldown += Time.deltaTime; } }
//Es como un manager de tiles public void update() { //Si la iteracion no pasa el maximo se repite for (int y = 0; y < MAP_HEIGHT; y++) { //Si la iteracion no pasa el maximo se repite for (int x = 0; x < MAP_WIDTH; x++) { //se update los tiles a medida que cambie mMap[y][x].update(); } } int col = (int)(CMouse.getX() / TILE_WIDTH); int row = (int)(CMouse.getY() / TILE_HEIGHT); CTile tile = getTile(col, row); if (tile != null) { if (CMouse.firstPress()) { int index = tile.getTileIndex(); if (index == 0) { tile.setTileIndex(1); tile.setImage(mTiles[1]); } else if (index == 1) { tile.setTileIndex(0); tile.setImage(mTiles[0]); } } } }
public override void update() { base.update(); if (CMouse.firstPress()) { CGame.inst().setState(new CMenuState()); } }
//Comportamiento del Board en STATE_NORMAL public void tokenSelection() { if (CMouse.firstPress(0)) { int[] mousePos = getMouseTile(); if (mousePos[0] != -1 & secondSelect[0] == -1) { firstSelect[0] = mousePos[0]; firstSelect[1] = mousePos[1]; matrixBoard[firstSelect[0]][firstSelect[1]].select(); } } if (CMouse.pressed(0)) { int[] mousePos = getMouseTile(); if (mousePos[0] != firstSelect[0] | mousePos[1] != firstSelect[1]) { if (mousePos[0] == -1 & firstSelect[0] != -1) { matrixBoard[firstSelect[0]][firstSelect[1]].deselect(); firstSelect[0] = -1; firstSelect[1] = -1; } if (mousePos[0] != -1 & firstSelect[0] != -1) { secondSelect[0] = mousePos[0]; secondSelect[1] = mousePos[1]; matrixBoard[secondSelect[0]][secondSelect[1]].select(); if (contiguousTiles(firstSelect[0], firstSelect[1], secondSelect[0], secondSelect[1])) { switchTokens(firstSelect[0], firstSelect[1], secondSelect[0], secondSelect[1]); current_state = STATE_CHANGING; matrixBoard[firstSelect[0]][firstSelect[1]].deselect(); matrixBoard[secondSelect[0]][secondSelect[1]].deselect(); } else { matrixBoard[firstSelect[0]][firstSelect[1]].deselect(); matrixBoard[secondSelect[0]][secondSelect[1]].deselect(); firstSelect[0] = -1; firstSelect[1] = -1; secondSelect[0] = -1; secondSelect[1] = -1; } } } } if (CMouse.release(0) & firstSelect[0] != -1) { matrixBoard[firstSelect[0]][firstSelect[1]].deselect(); } }
public bool nextScreenClick() { bool clicked = false; if (CMouse.firstPress()) { float button1MinX = btnNextScreen.getX() - btnNextScreen.getWidth() / 2; float button1MaxX = btnNextScreen.getX() + btnNextScreen.getWidth() / 2; float button1MinY = btnNextScreen.getY() - btnNextScreen.getHeight() / 2; float button1MaxY = btnNextScreen.getY() + btnNextScreen.getHeight() / 2; float mouseX = CMouse.getPos().x; float mouseY = CMouse.getPos().y; if (mouseX >= button1MinX && mouseX <= button1MaxX && mouseY >= button1MinY && mouseY <= button1MaxY) { clicked = true; } } return(clicked); }
public bool optionsClick() { bool clicked = false; if (CMouse.firstPress()) { float button1MinX = optionsBttn.getX() - optionsBttn.getWidth() / 2; float button1MaxX = optionsBttn.getX() + optionsBttn.getWidth() / 2; float button1MinY = optionsBttn.getY() - optionsBttn.getHeight() / 2; float button1MaxY = optionsBttn.getY() + optionsBttn.getHeight() / 2; float mouseX = CMouse.getPos().x; float mouseY = CMouse.getPos().y; if (mouseX >= button1MinX && mouseX <= button1MaxX && mouseY >= button1MinY && mouseY <= button1MaxY) { clicked = true; } } return(clicked); }
public bool exitClick() { bool clicked = false; if (CMouse.firstPress()) { float button1MinX = exit.getX(); float button1MaxX = exit.getX() + exit.getWidth(); float button1MinY = exit.getY(); float button1MaxY = exit.getY() + exit.getHeight(); float mouseX = CMouse.getPos().x; float mouseY = CMouse.getPos().y; if (mouseX >= button1MinX && mouseX <= button1MaxX && mouseY >= button1MinY && mouseY <= button1MaxY) { clicked = true; } } return(clicked); }
private bool skill2Click() { bool clicked = false; if (CMouse.firstPress()) { float button2MinX = button02.getX() - button02.getWidth() / 2; float button2MaxX = button02.getX() + button02.getWidth() / 2; float button2MinY = button02.getY() - button02.getHeight(); float button2MaxY = button02.getY(); float mouseX = CMouse.getPos().x; float mouseY = CMouse.getPos().y; if (mouseX >= button2MinX && mouseX <= button2MaxX && mouseY >= button2MinY && mouseY <= button2MaxY) { clicked = true; } } return(clicked); }
public void update() { for (int y = 0; y < MAP_HEIGHT; y++) { for (int x = 0; x < MAP_WIDTH; x++) { mMap [y] [x].update(); // RUNNER //mMap[y][x].setVelX(-400); } } int col = (int)(CMouse.getX() / TILE_WIDTH); int row = (int)(CMouse.getY() / TILE_HEIGHT); CTile tile = getTile(col, row); if (tile != null) { if (CMouse.firstPress()) { int index = tile.getTileIndex(); if (index == 0) { tile.setTileIndex(1); tile.setImage(mTiles[1]); } else if (index == 1) { tile.setTileIndex(0); tile.setImage(mTiles[0]); } } } }