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 /
avatar image
0
Question by Civita_88 · Nov 24, 2016 at 07:22 AM · gametimespeedsystemstructure

Game structure: Time intervals, enemy speed, enemy quantity. How best to set this up?

Hi, my game currently has enemy spawners that endlessly run at a consistent speed. Enemies move from the left side of the screen to the right. There is no real variance in gameplay. So, I've decided to structure my game in waves. In these waves, I'd like to be able to have sliders to adjust A.) which enemies are available (there are three total classes), B.) how many of them there are / spawn density, and C.) their speed. I'd also like to be able to have controls to change the duration of these waves (seconds).

I'm new to C#, and I was wondering if anyone had any guidance for how I might be able to begin setting up this system so I can begin tweaking values to get the gameplay perfect.

Thank you!

Comment
Add comment · Show 3
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 AndreiMarian · Nov 24, 2016 at 11:01 AM 0
Share
  1. What kind of sliders do you want: UI, Inspector?

  2. On what do you want to base the waves: on time, on last going/dying enemy, a mix (some time from last dying enemy)?

avatar image Civita_88 AndreiMarian · Nov 27, 2016 at 09:16 AM 0
Share
  1. Inspector. So I'd need $$anonymous$$ and max values for each then, yes? Quantity (per class type)- $$anonymous$$in: 0, $$anonymous$$ax ...hm. 50? Speed - not sure which units of measurement are used. I guess since quantity can become zero, then there's no need for a third adjustment area that deals with which units are present and which are not.

  2. Time alone.

Thank you, @andreimarian !

avatar image Civita_88 AndreiMarian · Dec 03, 2016 at 05:54 PM 0
Share

Were you able to figure something out, potentially, @Andrei$$anonymous$$arian ? I really appreciate your help!

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by ma22be61 · Nov 27, 2016 at 10:17 AM

I usually do not use C# but hopefully that will help you. To set a limit to the (endlessly) running you need to set the waves first (so you can later on set the max and min value for the spawners at every wave). For example (you need to translate the code because I do not have unity handy right now so I'm just writhing a simple example)

 wave : integer;
 currentwave : integer ;
 spawnerquantity=50; //the quantity of enemies your spawner will spawn every wave
 spawner =gameobject  ;//you will need to use the spawner gameobject in the inspector (or transform) from the scene (the one that spawns the enemies from the left to the right)
 spawnerenemy = gameobject; //set the enemy in the inspect that the spawner will spawn
 spawnerenemyhealth = int; //your spawner enemy health . I assume your spawner spawns enemies that have a health
 
 void start ()
 {
 currentwave=1 //sets the current wave to 1 when game starts
 }
 
 void update ()
 {
 //here you will need to use a bit of the enemy variables (from the scripts that you already have) 
 //I assume your enemies have got a health (like 100)
 if (spawnerenemyhealth <=0 && wave==currentwave && spawnerquantity >=1) //if an enemy spawned is killed then decrease the spawnerquantity by 1 and destroy the gameobject (aka the enemy)
 {
 //destroy the enemy 
 spawnerquantity = spawnerquantity -1;
 }
 else if (spawnerquantity ==0 && wave==currentwave)
 {
 wave=currentwave +1;
 spawnerquantity=spawnerquantity+20; //adds 20 enemies to the next wave everytime a wave is finished
 }
 
 }

So that is the basic spawning and wave system (the code will not work , it's just to give you an idea). The speed and the kind of enemies available are simple to setup if you already have them. The speed needs to be set from your enemy script (like if wave=2 then speed =2) and the kinds of enemies are the same thing (if wave=2 then enemy2=true).

The density (or quantity) can be set in my script but you will have to play around with it. Once again , sorry for the bad scripting haha (it's just a fast-typed example)

Comment
Add comment · Show 1 · 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 Civita_88 · Dec 03, 2016 at 05:53 PM 0
Share

I appreciate the outline! Thank you for taking the time to make this response.

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

Accelerate/Decelerate Custom Game Clock 2 Answers

changing speed for 10 seconds and then return it back to its value 0 Answers

Lerp - Time Remaining 1 Answer

Game runs in slow motion in iOS even using Time.deltaTime 1 Answer

Increase ball speed by time 1 Answer


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