Search Unity

Space Shooter Tutorial: Last step to make the game really challenging

Discussion in 'Community Learning & Teaching' started by RicciChile, Apr 1, 2014.

  1. RicciChile

    RicciChile

    Joined:
    Apr 1, 2014
    Posts:
    3
    The referred tutorial videos are really great and so is the Space Shooter game example used (I just start learning about game developing from those videos).

    However, from a player perspective, the game gets quickly boring because the game difficulty does not increase during the game session and there is no real challenge.

    One simple way to resolve this is just increasing the asteroid velocity after each wave.

    Also, I think that this is not as simple as it looks, as in the Game Controller script there is apparently no direct way to reference the asteroid speed instantiated.

    I think that the following code does not work, because some kind of reference to the asteroid Speed attribute is missing in the Asteroid prefabs class (originally set to constant value -10 through the object inspector):

    GameObject asteroidRef;
    AsteroidRef = Instantiate (hazard, spawnPosition, spawnRotation) as GameObject;
    AsteroidRef.Speed = asteroidSpeed; // This is the invalid line!

    Where the variable asteroidSpeed is increased by -1 after each wave.

    Does anybody know how to do this?

    Thanks,

    Ricci.
     
    Last edited: Apr 2, 2014
  2. RicciChile

    RicciChile

    Joined:
    Apr 1, 2014
    Posts:
    3
    OK, I found a solution to this issue and IMHO the game is now so much more fun! :p

    It is just a matter of declaring the asteroidSpeed variable as public static float in the GameController script so it can easily be accessed from the AsteroidMover script.

    Ricci.
     
  3. Thaenarys

    Thaenarys

    Joined:
    Jan 15, 2015
    Posts:
    1
    can you send the corrected code for that please ? I'm trying to do exactly the same but it just won't work ...

    Thaenarys
     
  4. Nivoset

    Nivoset

    Joined:
    Sep 20, 2014
    Posts:
    3
    I added in the enemy space ships (one strafes and the other just flys straight down shooting) to do alot of this i re-wrote quite a bit of the code.

    3 lives
    randomly scaled asteroids, minus points for missing and letting a bag guy past you. high scores.
    Also i put in code to do a free guy powerup type item.
    Also it works on android phones or PC.

    If you are interested i can post my new source i did, not perfect by any means, but adds a bit to the game.
     
  5. Nivoset

    Nivoset

    Joined:
    Sep 20, 2014
    Posts:
    3
    if you wanna try here is the android link.

    the icons are all small. not sure what to do onit yet, UI elements are odd to work with still for me. at the bottom of the splash screen the slider will let you pick one of 2 control methods. options will let you slide the ship to the edge of your screen.

    sorry its not more fully complete. but was fun to write

    https://www.appjenny.com/Android/App/com.marginalPro.SpaceShooter