Need your IDEAS!! (Players building their own base)
Hello!
I've had an idea for this game for the past couple of months. Basicaly, the player builds their own "base" with defenses and creatures that would try to stop intruders... However, since i'm fairly new to the Game Development field and coding in general, I'm getting a bit confused.
My question is (and i doubt there is only 1"right" answer), how do i go about giving players the option of building their own structure (castle, dungeon, instance, etc) using the tools that the game provides them (ground, wall, traps, etc)?
The only thing I've come up with so far is: When the player chooses a tool (lets say a wall), he is then prompted to place it, when he does the game checks some conditions (if the wall can physically be placed there) and if all is good, the wall is placed, and its location is saved.
I hope I've explained it good enough! Now, is this the best way to do it? Are there other methods that you know of? or maybe a tutorial? Any form of advice or help would be greatly appreciated!! (I tried searching for answers, but the keywords are messing the search up, "players building their own structures")
Thank you all so much!
Answer by gpollak450 · Jun 01, 2016 at 06:39 PM
Im pretty new to Unity but, for the actual creation part, use the Object.Instantiate command.
In UnityScript it's like this :
var Object : GameObject;
function Start() {
Instantiate(Object);
}
I havn't tested it but that should work
also you can use a variable to choose what object your instantiating
Like this :
var Object : GameObject;
var Object2 : GameObject;
var select : 0;
function Update() {
if (Input.GetKeyDown("1")) {
select = 1;
}
if (Input.GetKeyDown("2")) {
select = 2;
}
if (Input.GetKeyDown("i")) {
if (select == 1) {
Instantiate(Object);
}
if (select == 2) {
Instantiate(Object2);
}
}
}
Hope you can use this!
Answer by Mmmpies · Jun 01, 2016 at 08:05 PM
I don't want to put you off but you're starting too big and asking far too generalized a question.
That's not really what this place is for. Go and make some of the tutorial games, not just for the programming skills you'll pick up but because making a working game - no matter how small is great.
You'll learn about instantiating game objects, prefabs, how to check if a location is valid. You'll learn about the UI (User Interface) and how you can use that to show scores and all sorts of things.
Do that until you're comfortable with Unity and you'll be far more likely to make the game you have in your head right now. If you start from scratch making the game you want you'll have to restart over and over and over as you realise you've missed something and that's just a horrible way to learn.