How to add creatures
From Platinum Arts Sandbox Free 3D Game Maker
Revision as of 17:05, 23 May 2012 by Chocolatepie33 (Talk | contribs)
- Before doing this tutorial, you need to understand how to use Code::Blocks to compile Sandbox. To do so, read the Compiling the source code tutorial first. You should also read the how to add more player character models tutorial.
In the original Cube 2, monsters are violent and will attack you. In Sandbox, monsters are known as creatures, and they just chase you around.
- To start: Open up main/src/fpsgame/monster.cpp. Scroll down a little bit, and you should find this:
namespace game { static vector<int> teleports;
static const int TOTMFREQ = 14; const int NUMMONSTERTYPES = 7;
const monstertype monstertypes[NUMMONSTERTYPES] = { { GUN_FIST, 4, 100, 3, 0, 100, 800, 50, 0, 5, S_PAINO, S_DIE1, "A Butterfly", "butterfly", "butterfly"}, { GUN_BITE, 20, 800, 5, 0, 400, 1600, 100, 60, 4000, S_PAINO, S_DIE1, "A Dragon", "rpg/characters/dragon", "Dragon"}, { GUN_FIST, 8, 800, 5, 0, 400, 1600, 100, 16, 4000, S_PAINO, S_DIE1, "A Golem", "rpg/characters/golem", "golem"}, { GUN_FIST, 12, 200, 5, 0, 400, 1600, 100, 16, 800, S_PAINO, S_DIE1, "A Grizzly", "rpg/characters/grizzly", "grizzly"}, { GUN_BITE, 25, 50, 5, 0, 400, 1600, 100, 2, 30, S_PAINO, S_DIE1, "A Rat", "rpg/characters/rat", "rat"}, { GUN_FIST, 7, 150, 5, 0, 400, 1600, 100, 16, 200, S_PAINO, S_DIE1, "A Snagon", "rpg/characters/snagon", "snagon"}, { GUN_BITE, 28, 80, 5, 0, 400, 1600, 100, 6, 150, S_PAINO, S_DIE1, "A Wolf", "rpg/characters/wolf", "wolf"}, };
the namespace game is a standard C++ coding thing, ignore that. I also believe that the part about the teleports may be irrelevant here.
Anyways, the first line you should pay attention to is the "const int NUMMONSTERTYPES = 7". This line declares the constant integer known as NUMMONSTERTYPES and also initializes it to be 7. As you can see, there are 7 lines within the "const monstertype monstertypes[NUMMONSTERTYPES]" area, each corresponding to a monster. The first part of this