Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Infinite Runner Starter Pack

Discussion in 'Assets and Asset Store' started by opsive, May 23, 2013.

  1. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,701
    That's awesome - congratulations on your release! I'll download it to give it a try. I am starting to hear about more and more games being released with the starter pack. I think that I will make a page on the infinite runner website that contains all of the games completed with the pack (of course if I have the developers permission). It will be mutually beneficial - it with add more exposure for the completed game and it will show that it is possible to release a game with the starter pack.
     
  2. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    Nice, Stephen.
     
  3. jathoo

    jathoo

    Joined:
    Feb 11, 2013
    Posts:
    29
    is that a bug , even after you click on pause menu button (gui) ,the moveable obstacles keeps moving and hit the player and it makes game over ? , and on next version , can you put a destructible script on power ups so , the player will not run insde a big van / train and comeout when speed powerups or etc?
     
  4. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,701
    In the version that I have the moving obstacles do stop but I forgot when I fixed that and if it has been submitted yet. Either way, add this to the bottom of MovingObstacleObject.cs:

    Code (csharp):
    1.  
    2.     private void gamePaused(bool paused)
    3.     {
    4.         enabled = !paused;
    5.         thisRigidbody.isKinematic = paused;
    6.         if (obstacleAnimation) {
    7.             if (paused) {
    8.                 obstacleAnimation.Stop();
    9.             } else {
    10.                 obstacleAnimation.Play();
    11.             }
    12.         }
    13.     }
    14.  
    Can you explain your feature request in more detail? I don't completely understand.
     
  5. jathoo

    jathoo

    Joined:
    Feb 11, 2013
    Posts:
    29
    Hi , that "gamePaused" function you gave here is already there , but sometimes Moving obstacles are stopping and sometime its not ( i just one 1 Moving obstacle ). can you check it please ?


    feature request :

    Lets say player is on power up (Speed Boost ) . Moving obstacle is a long bus or a long train .


    when he's running with Speed Boost . He will get inside the long moving obstacle and coming out of it (because he's in power up mod , will not die hitting it ) but it doesen't look good / feel odd to get inside and come out .

    if we can destroy the moving obstacle( long bus / train) and run it'll look cool on the game ? and make it more addictive ? what you think?
     
    Last edited: Apr 25, 2014
  6. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,701
    I played through the demo scene a few times and the moving obstacles always stopped when the game paused. Can you list the steps to reproduce it using the demo scene?

    That feature request should be pretty easy. In fact you should be able to do it with just a few lines of code changes:

    Add the following variable to the top of ObstacleObject.cs:

    Code (csharp):
    1.  
    2. public bool destroyWithSpeedPowerup;
    3.  
    Then within the OnTriggerEnter you could destroy the object, play an animation, play a sound, etc

    Code (csharp):
    1.  
    2. public virtual void OnTriggerEnter(Collider other)
    3. {
    4.    ...
    5.             if (collide) {
    6.                 gameManager.obstacleCollision(this, other.ClosestPointOnBounds(thisTransform.position));
    7.  
    8.                 if (destroyWithSpeedPowerup  PowerUpManager.instance.isPowerUpActive(PowerUpTypes.SpeedIncrease)) {
    9.                     // Place code here for destruction or any sounds/animations
    10.                 }
    11.             }
    12. }
    13.  
    14.  
     
  7. jathoo

    jathoo

    Joined:
    Feb 11, 2013
    Posts:
    29
    please try it with the objects in different distances , let the moving object come bit close to the camera and pasue the button , i made a fresh clean project and imported the pack and played the demo and the objects are still moving sometime it stopped .it's just random

    //Update : on demo , pause on a 1st round(section 2 moving objects) ,it'll stop , press play and keep playing run for the 2ed round ( section 2 moving objects). try to pause it will not stop mostly , or it's random , but if you keep palying and getting in loop , it's random
     
    Last edited: Apr 25, 2014
  8. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,701
    Thanks, I was able to reproduce it with those steps. When the moving obstacle was reactivated from being within the object pool it never resubscribed itself to receive the gamePaused event notifications. You can fix it by moving

    Code (csharp):
    1.  
    2.         GameManager.instance.onPauseGame += gamePaused;
    3.  
    from line 30 of MovingObstacleObject:Start to line 46, the very bottom of MovingObstacleObject : orient.
     
  9. jathoo

    jathoo

    Joined:
    Feb 11, 2013
    Posts:
    29
    Spot on. thanks opsive
     
  10. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    Opsive, how do you make the character jump higher? I tried changing the jumpHeight but its still the same.
     
    Last edited: May 4, 2014
  11. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,701
    Are you still running an old version or did you update to the latest? I just tried changing jumpHeight and it worked. Maybe not everything was merged correctly? If you could tell me how to reproduce it from the demo scene imported from a fresh project I'd love to take a look at it.
     
  12. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    My bad, I changed the jumpHeight for character 2, I was using character 1.
     
    Last edited: May 4, 2014
  13. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    PM'ed you.
     
  14. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,701
    I just replied. It takes a little bit of time to generate the lightmaps.
     
  15. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    I followed this, but the camera is stuck at the position where it shows the character model. So I just added thisTransform.parent = playerTransform.FindChild("CharacterRig/root/MCH-head_socket2"); without removing any code, it works. But when game over and I go to main menu, the camera is still attached to the head in the hierarchy. How do I unattach it through code?
     
    Last edited: May 7, 2014
  16. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,701
    You can remove the parent with:

    Code (csharp):
    1.  
    2. thisTransform.parent = null;
    3.  
     
  17. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    Tried this, it works when I go to Main Menu > Start, but if I Restart, it's back to normal(not attached to head), which I don't want. I placed thisTransform.parent = null in the reset().
     
    Last edited: May 7, 2014
  18. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,701
    reset() is called when the user goes back to the main menu and the camera should reset back to its original starting position/rotation. Setting the parent to null here is good since that's what it started out with.

    When the game is restarted the following is called:

    Code (csharp):
    1.  
    2.     public void startGame(bool fromRestart)
    3.     {
    4.         playerController = PlayerController.instance;
    5.         playerTransform = playerController.transform;
    6.         if (fromRestart) {
    7. ..
    8.  
    You are probably going to have to put the attach code within this section.
     
  19. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    Thanks, fixed. Another thing, because I set the camera to first-person, when the character drops to the fire pit, he keeps dropping in first-person view. I tried to place a box collider below the fire pit, but the character just drops through.
     
  20. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,701
    Make sure that boxcollider is not a trigger and has a layer of "Platform" or "Floor".
     
  21. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    Thanks again, fixed.
     
  22. Nebster

    Nebster

    Joined:
    May 8, 2014
    Posts:
    3
    Hi there,

    Wounder if you can help me when i downloaded the infinite runner starter pack on my college system to try it out. I don't think i been able to downloaded all the correct assists.. Wasn't sure if my college block it ? or the download didn't work correct. I only got 17 imports? is this correct ?
     
  23. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,701
    There are definitely more than 17 files. I would email support@unity3d.com to see if they can help you out at all. In the meantime, PM/email me your invoice number and I can send you a link to download.
     
  24. Nebster

    Nebster

    Joined:
    May 8, 2014
    Posts:
    3
    thank you, i having a problem sending you a pm.. Do you have a email i can send it to ?

    "You have turned off private messages. You may not send private messages until you turn them on by editing your options." Im new to this website , only started using this year for college work
     
  25. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,701
  26. Nebster

    Nebster

    Joined:
    May 8, 2014
    Posts:
    3
    Thank you for your help :) i sent you an email :)
     
  27. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    Opsive, my character is using a rifle, how do I implement Raycast with each shot? Thx.
     
  28. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,701
    You are going to have to detect if there was a tap or a click using the Input class (http://docs.unity3d.com/Documentation/Manual/Input.html). When there is a press you will need to use a raycast to determine what object was hit (like you mentioned). The documentation has a pretty good set of examples of using raycast - http://docs.unity3d.com/Documentation/ScriptReference/Physics.Raycast.html. You want to use the method that has the hit parameter so you can notify the object that it was hit.
     
  29. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    Thanks, will try.
     
  30. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    Opsive, I'm planning to use character 1 as an AI enemy, do you have a general idea how to implement it? The enemy can spawn on each of the three slots, and will attack the player when he's within a certain range. The enemy doesn't have to move, just idling.
     
  31. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,701
    AI is such a broad topic and has many, many different implementations so it's hard to give a very specific answer but I can try.

    In your case, I would subclass ObstacleObject and start from there. In the specific example of attacking when the player is within range, you would put something like the following within the update loop:

    Code (csharp):
    1.  
    2. public void Update()
    3. {
    4.    if ((thisTransform.position - playerTransform.position).sqrMagnitude < YourRange) {
    5.       attack();
    6.    }
    7. }
    8.  
    You'd have to define the variables and fill in the attack method but that will work for determining if the player is within range. Basically what I would do is just start from this subclass and build up from there.
     
  32. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    Thanks, I need just a basic AI, if within range attack.
     
  33. painkiller2007

    painkiller2007

    Joined:
    May 25, 2013
    Posts:
    43
    I found 1 more bug.
    I was using the latest version 1.5.2
    and i am using Unity 4.3.2

    So, according to the other games which use NGUI, i did the same procedure.
    1) Deleted the NGUI folder from project.
    2) Imported NGUI 3.5.9
    3) Imported the "NGUI 3 Assets" inside the version 1.5.2
    4) Started the game through main scene.
    5) Works fine except one small thing, when i die and i click on restart again. I can never see the in - game GUI items like coins ,score,etc. It just vanishes. And when i die again, i see the game over menu again. I click on restart, same thing happens.

    I looked at the various things in the script. Difficult to find the problem exactly , is it compatible with the latest ngui ? Or else please specify which version of NGUI i would need to make it work :)
     
  34. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,701
    This relates to the differences between NGUI 2 versus NGUI 3. I am submitting an update next week that has this fixed but I can send you the file now. Can you send me a PM or an email with your invoice number and I'll send you the link? Your steps for importing NGUI are correct.
     
  35. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,701
    Version 1.5.3 of the Infinite Runner Starter Pack Pro has been submitted. You can see the full change log here. This links to the Opsive forums which I setup to allow better organization and searching of topics.
     
  36. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,701
    This version has been approved and is now on the Asset Store.
     
  37. Gametyme

    Gametyme

    Joined:
    May 7, 2014
    Posts:
    558
    Can anyone post the instructions. My download didn't come with any. Thanks in advance
     
  38. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,701
  39. Gametyme

    Gametyme

    Joined:
    May 7, 2014
    Posts:
    558
    Thanks!
     
  40. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    Opsive, I declared variables for playerTransform and yourRange, but I'm gettin NullReferenceException
    UnityEngine.Transform.get_position () error.
     
  41. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,701
    Make sure you assign the player transform within Start:

    Code (csharp):
    1.  
    2. playerTransform = PlayerController.instance.transform;
    3.  
     
  42. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    Using your code, I'm also within range when I'm next to the enemy. I want to call the attack function only when the player is directly in front of the enemy. Raycast?
     
  43. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,701
    Using a raycase with thisTransform.forward would work, though it is a bit overkill. Since you already know the position of the player you can just compute the angle:

    Code (csharp):
    1.  
    2. var direction = playerTransform.position - thisTransform.position;
    3. angle = Vector3.Angle(direction, thisTransform.forward);
    4. if (angle < YourValue) {
    5.   // in front
    6. }
    7.  
     
  44. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    I placed a debug.log in if(angle < yourvalue), and I set 1 to yourvalue. Sometimes it detects when it's near, sometimes there's nothing in front but the console still prints.
     
    Last edited: May 26, 2014
  45. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,701
    This just determines the angle, not the distance. You can get the distance with direction.magnitude.
     
  46. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    Ok working fine now. Since its a update function wont attack() be called many times?
     
  47. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,701
    Yes, so you'll need to set a bool when attack is called to true and not call attack again unless that bool is false.
     
  48. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    Some example code pls?
     
  49. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,701
    First off I highly recommend taking a look at the Learn page. This page will definitely help with getting familiar with scripting in Unity and you won't need to wait for me to respond.

    With that said, you set the attack within the update loop, so to prevent it from attacking just do something like:
    Code (csharp):
    1.  
    2. public void Update()
    3. {
    4. ...
    5.    if(canAttack) {
    6.       attack();
    7.    }
    8. ...
    9. }
    10.  
    Then within attack set that to false:

    Code (csharp):
    1.  
    2. public void attack()
    3. {
    4. ...
    5.    canAttack = false;
    6. ...
    7. }
    8.  
    Don't forget to reset canAttack when the object starts again:

    Code (csharp):
    1.  
    2. public override void Start()
    3. {
    4.    base.Start();
    5.    canAttack = true;
    6. }
    7.  
     
  50. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78