Author Topic: Space Game Starter Kit  (Read 4386 times)

Urwin78

  • Guest
Space Game Starter Kit
« on: May 16, 2013, 02:06:11 PM »
This kit looks great and I want to order the kit but i'm also interested in this post on Unity support page.

Quote
Dear Aren, First of all, i would like to thank you for building this fantastic starterkit. I do have 2 questions about the spline controlled level.
Question 1 = How can i stop and continue time when following the spline (i want the ship to stop at certain points and load some cargo, and after 30 seconds, the ship should continue from it's last position)
Question 2 = I would like to use the trusters as some sort of boost on the spline (when the user presses a button, the ship fly's a little bit forward, using its trusters, and when the player releases the button, the ship should get back at it's original position)

Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Space Game Starter Kit
« Reply #1 on: May 16, 2013, 02:36:02 PM »
#1 would depend on how you want to pause it. Do you want the entire game to stop? If so you need to set Time.timeScale to 0. If you only want the ship to stop, then your best bet is to pause the sampling of the spline. The ship there simply follows a fixed spline by sampling it in update.

Same with #2 -- since you are the one who's sampling the spline, you can simply sample it ahead of where the ship would normally be, and temporarily move the ship there.

zeppeldep

  • Guest
Re: Space Game Starter Kit
« Reply #2 on: June 10, 2013, 02:03:52 PM »
How does the Player object get created?

The Hierarchy list before run has no Player (see before image attached)

Then.. when running/playing the Player has been created (see after image attached)

Where in the Project does the Player object get created?
Thanks Aren .. The answer to this will help me understand the process a lot better..

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Space Game Starter Kit
« Reply #3 on: June 10, 2013, 02:46:45 PM »
Spawn Point object should have a script on it that instantiates the player.

zeppeldep

  • Guest
Re: Space Game Starter Kit
« Reply #4 on: June 11, 2013, 02:29:49 PM »
Ok .. I am almost there ..
Scripts > Game > Spaceship.cs appended variable for audioclip named thrustsound (see attached 11-shipthrust) and included: AudioSource.PlayClipAtPoint(thrustsound, Camera.main.transform.position);
inside UpdateSteering method.

also applied this to the spaceship in the scene (but this is the enemy ship, I think so it does not help)
attached: 11-insship

But .. I need to add some code in player.cs - dont know what?
(see attached: 11-player) do not know how to instruct the variable to hold the audio clip asset in code.
..?






ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Space Game Starter Kit
« Reply #5 on: June 11, 2013, 09:08:47 PM »
PlayClipAtPoint is not the right way to go. You should just have an audio source on the ship set to loop, and control it from the spaceship class -- alter the pitch, start/stop it. You shouldn't be trying to play it at the camera's position.

This is really a Unity-usability question, not a question about the Starter Kit.

zeppeldep

  • Guest
Re: Space Game Starter Kit
« Reply #6 on: June 23, 2013, 09:41:01 AM »
: ) I have sounds!!!
Added audio source to spaceship under Model / Ship folder, then updated spaceship.cs to initiate clip in Start and alter pitch in UpdateSteering .. THX!
Then .. added audio source components to Models / Explosion (big and small), direct audio clips not needing changes to code.
Then .. did the same with Plasma beam ...
... Please help me with two other sounds .. Missiles and Target Reticle..
I added audio source to Missile but that didnt work..
Target Reticle is part of Spaceship .. would like to ad a ping sound when target is 'hot'
Thanks Aren  : )