Bomberman MiniGame: Difference between revisions

From Graal Bible
(Created page with "Welcome to the Bomberman Minigame Tutorial! Assets will be available for you to download and follow the tuto.")
 
No edit summary
Line 1: Line 1:
Welcome to the Bomberman Minigame Tutorial!
Welcome to the Bomberman Minigame Tutorial!
[[File:Bomberman cover.png|none|thumb|675x675px]]
Assets will be available for you to download and follow the tuto.


Assets will be available for you to download and follow the tuto.
Since this game is meant to be multiplayer, we will be placing the GameObjects in npc for them to be visible to all the players. (more info on that here: [[Placing GameObjects in NPC]])
 
First, we'll have the weapon that starts up the game and places the NPCs (''found under '''weapon: Merlin/BomberMan/Game''''')
function onActionServerside(cmd, x, y) {
  if (cmd == "bomb") {
    temp.pnpc = putnpc2(x, y, "");
    temp.pnpc.join("merlin_bomberman_bomb");
    //temp.pnpc.DropBomb(explvl);
  }
  if (cmd == "level") {
      temp.bombernpc = putnpc2(x, y, "");
      temp.bombernpc.join("merlin_bomberman_level");
  }
}
//#CLIENTSIDE
function onCreated() {
  echo(this.name @ " OnCreated");
  SetTimer(9999);
  level.explosionpower = 4; //for powerups with explosion
  level.numberofbombs = 2; //number of bombs allowed to place at a time
}
public function Load() {
  echo(this.name @ " LOAD");
  Object::destroy(this.bomberManParentNode);
  if (isObject("bomberman_Quit")) {
    "bomberman_Quit".destroy();
  }
  new GuiButtonCtrl("bomberman_Quit") {
    profile = GuiBlueButtonProfile;
    x = 600;
    y = 200;
    width = 150;
    height = 30;
    text = "bombermanQuit";
  }
  temp.warpLevel = "only_ground.nw";
  temp.warpX = 4.65;
  temp.warpY = 21.33;
  temp.warpZ = 0.7;
  WARPMANAGER.Warp(temp.warpX, temp.warpY ,temp.warpZ ,temp.warpLevel);
  sleep(0.5);
  start();
}
function bomberman_Quit.onAction() {
  BomberManQuit();
}
public function BomberManQuit() {
  echo("KartQui warp back to=" @ this.currentLevel @ " x=" @ this.currentX @ " y=" @ this.currentY @ " z=" @ this.currentZ);
  if (isObject("bomberman_Quit")) {
    "bomberman_Quit".destroy();
  }
  PLAYERMOVEMENT.UnFreeze();
  PLAYERMOVEMENT.canJump = true;
  this.GAMEON = false;
  Quattro3D::PlayerCamera::Instance.FreeCam = false;
  findweapon("Merlin/BomberMan/Player").onQuit();
  Object::destroy(this.bomberManParentNode);
  this.bomberManParentNode = null;
}
function start() {
  PLAYERMOVEMENT.canJump = false;
  this.GAMEON = true;
  triggerserver("gui", this.name, "level", -60 , 14);
}
function onKeyPressed(keycode, keychar) {
  if (this.GAMEON == true) {
    if (keycode == "32, ,57") {
      DropBomb();
    }
  }
}
function DropBomb() {
  this.hit = RaycastHit::create();
  done = Physics::Raycast(player.gameobject.transform.position, Vector3::Down, this.hit, 100);
  sleep(0.05);
  triggerserver("gui", this.name, "bomb", this.hit.transform.gameobject.transform.position.x, this.hit.transform.gameobject.transform.position.z);
}

Revision as of 09:46, 19 June 2021

Welcome to the Bomberman Minigame Tutorial!

Bomberman cover.png

Assets will be available for you to download and follow the tuto.

Since this game is meant to be multiplayer, we will be placing the GameObjects in npc for them to be visible to all the players. (more info on that here: Placing GameObjects in NPC)

First, we'll have the weapon that starts up the game and places the NPCs (found under weapon: Merlin/BomberMan/Game)

function onActionServerside(cmd, x, y) {
  if (cmd == "bomb") {
    temp.pnpc = putnpc2(x, y, "");
    temp.pnpc.join("merlin_bomberman_bomb");
    //temp.pnpc.DropBomb(explvl);
  }
  if (cmd == "level") {
     temp.bombernpc = putnpc2(x, y, "");
     temp.bombernpc.join("merlin_bomberman_level");
  }
}

//#CLIENTSIDE
function onCreated() {
  echo(this.name @ " OnCreated");
  SetTimer(9999);
  level.explosionpower = 4; //for powerups with explosion
  level.numberofbombs = 2; //number of bombs allowed to place at a time
}

public function Load() {
  echo(this.name @ " LOAD");
  Object::destroy(this.bomberManParentNode);
  if (isObject("bomberman_Quit")) {
    "bomberman_Quit".destroy();
  }
  new GuiButtonCtrl("bomberman_Quit") {
    profile = GuiBlueButtonProfile;
    x = 600;
    y = 200;
    width = 150;
    height = 30;
    text = "bombermanQuit";
  }

  temp.warpLevel = "only_ground.nw";
  temp.warpX = 4.65; 
  temp.warpY = 21.33; 
  temp.warpZ = 0.7; 
  WARPMANAGER.Warp(temp.warpX, temp.warpY ,temp.warpZ ,temp.warpLevel);
  sleep(0.5);
  start(); 
}

function bomberman_Quit.onAction() {
  BomberManQuit();
}

public function BomberManQuit() {
  echo("KartQui warp back to=" @ this.currentLevel @ " x=" @ this.currentX @ " y=" @ this.currentY @ " z=" @ this.currentZ);
  if (isObject("bomberman_Quit")) {
    "bomberman_Quit".destroy();
  }
  PLAYERMOVEMENT.UnFreeze();
  PLAYERMOVEMENT.canJump = true;
  this.GAMEON = false;
  Quattro3D::PlayerCamera::Instance.FreeCam = false;
  findweapon("Merlin/BomberMan/Player").onQuit();
  Object::destroy(this.bomberManParentNode);
  this.bomberManParentNode = null;
}

function start() {
  PLAYERMOVEMENT.canJump = false;
  this.GAMEON = true;
  triggerserver("gui", this.name, "level", -60 , 14);
}

function onKeyPressed(keycode, keychar) {
  if (this.GAMEON == true) {
    if (keycode == "32, ,57") {
      DropBomb();
    }
  }
}

function DropBomb() {
  this.hit = RaycastHit::create();
  done = Physics::Raycast(player.gameobject.transform.position, Vector3::Down, this.hit, 100);
  sleep(0.05);
  triggerserver("gui", this.name, "bomb", this.hit.transform.gameobject.transform.position.x, this.hit.transform.gameobject.transform.position.z);
}