Thanks for all the info guys!
@Quew8
This is our Inventory in-game so far:
http://puu.sh/2XoI1.png
Sadly, it’s just an image that pops up when you press E. (Toggleable)
So let me explain how it’s supposed to work, the main row at the bottom is the hot bar, and all the other rows surrounding the player are for carrying any item/weapon.
And it’s supposed to function like Minecraft’s inventory where you can drag stuff and what not.
But for now, my friend told me to start off simple and make it so it works like a First Person Shooter’s inventory (Array of 5, top-row number keys access indexes 0 to 4)
So, I understand that concept, and I’ve been following this game’s code for the weapon-manager (https://www.dropbox.com/s/7p2jazq587h5ecx/Enigma.7z)
Here’s a snippet of code from the gunManager class and abstractWeapon class (basically a template for a weapon Object, so each weapon Object will extend from this class) I’ve been making:
boolean bulletFired = false;
boolean triggerPulled = false;
public Timer fireRate = new Timer(0100);
private ShootType shootType;
//Shoot code block
Sound singleFire;
Sound autoFire;
Sound reloadFull;
Sound reloadEmpty;
public static double magSize;
public static double currentMagSize;
public static double currentRemainingAmmo;
public static double ammoCarryLimit;
public static double damage;
public static double recoil;
public static double maxRecoil;
double spawnX;
double spawnY;
Timer spawnRate;
public static double getMagSize() {
return magSize;
}
public static double getCurrentMagSize() {
return damage;
}
public static double getCurrentRemainingAmmo() {
return currentRemainingAmmo;
}
public static double getAmmoCarryLimit() {
return ammoCarryLimit;
}
public static double getDamage() {
return damage;
}
public static double getRecoil() {
return recoil;
}
public static double getMaxRecoil() {
return maxRecoil;
}
public static double getRecoilReduction() {
return recoilReduction;
}
- gunManager snippet_1 (code has been ripped from Enigma, so it’s more so a reference than a straight copy from the game and it hasn’t been optimized to fit our game’s design pattern yet)
public double getCurrentRemainingAmmo() {
if (this.currentWeapon.equals("Pistol"))
return Pistol.getCurrentRemainingAmmo();
if (this.currentWeapon.equals("ShotGun"))
return ShotGun.getCurrentRemainingAmmo();
if (this.currentWeapon.equals("LE9AR"))
return LE9AR.getCurrentRemainingAmmo();
if (this.currentWeapon.equals("MP5"))
return MP5.getCurrentRemainingAmmo();
if (this.currentWeapon.equals("Barrett")) {
return Barrett.getCurrentRemainingAmmo();
}
return 0;
}
public double getMagSize() {
if (this.currentWeapon.equals("Pistol"))
return Pistol.getMagSize();
if (this.currentWeapon.equals("ShotGun"))
return ShotGun.getMagSize();
if (this.currentWeapon.equals("LE9AR"))
return LE9AR.getMagSize();
if (this.currentWeapon.equals("MP5"))
return MP5.getMagSize();
if (this.currentWeapon.equals("Barrett")) {
return Barrett.getMagSize();
}
return 0;
}
public double getCurrentMagSize() {
if (this.currentWeapon.equals("Pistol"))
return Pistol.getCurrentMagSize();
if (this.currentWeapon.equals("ShotGun"))
return ShotGun.getCurrentMagSize();
if (this.currentWeapon.equals("LE9AR"))
return LE9AR.getCurrentMagSize();
if (this.currentWeapon.equals("MP5"))
return MP5.getCurrentMagSize();
if (this.currentWeapon.equals("Barrett")) {
return Barrett.getCurrentMagSize();
}
return 0;
}
public double getGunRecoilReduction() {
if (this.currentWeapon.equals("Pistol"))
return Pistol.getRecoilReduction();
if (this.currentWeapon.equals("ShotGun"))
return ShotGun.getRecoilReduction();
if (this.currentWeapon.equals("LE9AR"))
return LE9AR.getRecoilReduction();
if (this.currentWeapon.equals("MP5"))
return MP5.getRecoilReduction();
if (this.currentWeapon.equals("Barrett")) {
return Barrett.getRecoilReduction();
}
return 0.0D;
}
So, would you guys suggest that I should start on our initial idea of the inventory (basically your idea of an RPG styled inventory, quew8), or should I start off slow with a Halo/FPS type inventory and then once I get that working – change it so it fits the initial idea?
And I’ll be sure to check out the source code for that game, dime26.