Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Bomb {
- private int time;
- private int power;
- private int xPos;
- private int yPos;
- public Bomb(int xpos,int ypos, int power){
- xPos = xpos;
- yPos = ypos;
- bomberman.BomberMan.board[xPos][yPos] = 3;
- }
- public void time(){
- time--;
- if(time==0){
- explode();
- }
- }
- public void explode(){
- boolean up = true;
- boolean down = true;
- boolean left = true;
- boolean right = true;
- for(int a=1;a<=power;a++){
- if(up){
- if(bomberman.BomberMan.board[xPos][yPos+a]==0){
- up = false;
- }
- else if(bomberman.BomberMan.board[xPos][yPos+a]==4){
- up = false;
- bomberman.BomberMan.board[xPos][yPos+a]=1;
- }
- else{
- bomberman.BomberMan.board[xPos][yPos+a]=2;
- }
- }
- if(down){
- if(bomberman.BomberMan.board[xPos][yPos-a]==0){
- down = false;
- }
- else if(bomberman.BomberMan.board[xPos][yPos-a]==4){
- down = false;
- bomberman.BomberMan.board[xPos][yPos-a]=1;
- }
- else{
- bomberman.BomberMan.board[xPos][yPos-a]=2;
- }
- }
- if(left){
- if(bomberman.BomberMan.board[xPos+a][yPos]==0){
- left = false;
- }
- else if(bomberman.BomberMan.board[xPos+a][yPos]==4){
- left = false;
- bomberman.BomberMan.board[xPos+a][yPos]=1;
- }
- else{
- bomberman.BomberMan.board[xPos+a][yPos]=2;
- }
- }
- if(right){
- if(bomberman.BomberMan.board[xPos-a][yPos]==0){
- right = false;
- }
- else if(bomberman.BomberMan.board[xPos-a][yPos]==4){
- right = false;
- bomberman.BomberMan.board[xPos-a][yPos]=1;
- }
- else{
- bomberman.BomberMan.board[xPos-a][yPos]=2;
- }}}
- //make it check alive.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement