Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by Saif_youssef89 · Mar 30, 2016 at 01:12 PM · 2djavascriptplayerstructurewall collision

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!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

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!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

'OpenClose' is not a member of 'Pushpull' Javascript help 0 Answers

2D player hides behind the room setting 2 Answers

How would you create a 2D endless runner with objects moving in the background? 0 Answers

If two Vector2 are same 1 Answer

My Player Controllercode isn't working 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges