Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

2D Infinite Runner Toolkit

Discussion in 'Assets and Asset Store' started by Dreeka, Jun 9, 2013.

  1. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    Can you check layer orders for sand ?
     
  2. Dreeka

    Dreeka

    Joined:
    Jul 15, 2010
    Posts:
    507
    First of all, sorry for the little late reply!

    To fix the infinite speed bug, add the following line to the GUI Manager’s QuitToMain() method, at line 258:
    Code (CSharp):
    1. powerupManager.Reset();
    To fix the torpedo spawning bug, go the Torpedo Layer script, and change the code in line 116 to the following:
    Code (CSharp):
    1. torpedo.position = new Vector3(startAt, yPos, 0);
    GiusCo:
    What do you mean mission reset?

    Fahrettin:
    If you would like to add touchable objects to the level, add the Level layer the Input Manager’s mask (you can do it in the inspector, by selecting the Overlord). This way, the Input Manager will recognise touch/click events on that layer as well. Then define your game logic inside the Input Manager.

    MGMT:
    I think your sorting order is messed up. Redownload the kit to a new project, and compare the sorting order between the two projects.

    StriderHiro:
    Take a look at this tutorial for animations:
    http://unity3d.com/learn/tutorials/modules/beginner/2d/2d-controllers

    Yes, you can change the texture of the coins to a random one. When the kit spawns a new obstacle group, loop through the group’s child elements, and if you find a coin, change the texture to a new random one. If you need more help, I can send an example script to you.
     
  3. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    Your code for infinite speed bug worked but torpedo one didnt. When i change new one i completely lost torpedos. They never spawn. (Tried 4-5 times)
     
  4. Dreeka

    Dreeka

    Joined:
    Jul 15, 2010
    Posts:
    507
    Fahrettin:
    You have probably changed the starting position value on the torpedo layer, or moved the level to a new X position. By default, the starting position should be at 21. If it does not fit your need, then change the value to something else, depending on your modifications.
     
  5. freakprince

    freakprince

    Joined:
    Apr 25, 2012
    Posts:
    63
    Dreeka any reason why my pause menu moves every time i press the pause button and each time moves a little offscreen?
     
  6. StriderHiro

    StriderHiro

    Joined:
    Jun 20, 2014
    Posts:
    6
    StriderHiro:
    Take a look at this tutorial for animations:
    http://unity3d.com/learn/tutorials/modules/beginner/2d/2d-controllers

    Yes, you can change the texture of the coins to a random one. When the kit spawns a new obstacle group, loop through the group’s child elements, and if you find a coin, change the texture to a new random one. If you need more help, I can send an example script to you.[/QUOTE]

    Thanks! thats great! Yes an example script would be awesome cheers!
     
  7. StriderHiro

    StriderHiro

    Joined:
    Jun 20, 2014
    Posts:
    6
    StriderHiro:
    Take a look at this tutorial for animations:
    http://unity3d.com/learn/tutorials/modules/beginner/2d/2d-controllers

    Im sorry, I live in China and the tutorial videos don't work here! I'm guessing there hosted on youtube! any chance of a simple explanation? the animation I want is just 6 images constantly moving, so not based on movement just a consatntly animated character
     
  8. superwendel

    superwendel

    Joined:
    Jun 18, 2013
    Posts:
    105
    Thanks for the updates Dreeka.

    I think I know why Fahrettin was having issues with the torpedoes spawning as I was having the same problem with my own project with the new line of code at line 116.
    The inspector variable for the parent object of Torpedo: startAt is set to -7.5 by default, make this +7.5 and the torpedoes will now be resetting back to the correct starting position.
     
  9. Eternalmars

    Eternalmars

    Joined:
    Jun 11, 2014
    Posts:
    2
    Hey, I would love to see the code for how the sub moves up and tilts up as well, where can I find this on the package?

    I have tried to recreate it but its extremely difficult for me.
     
  10. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    Thanks for advice Steven. It works now
     
  11. Dreeka

    Dreeka

    Joined:
    Jul 15, 2010
    Posts:
    507
    Eternalmara:
    The vertical speed of the submarine defines the rotaton. You can see the related code in the Player Manager's MoveAndRotate() function.
     
  12. freakprince

    freakprince

    Joined:
    Apr 25, 2012
    Posts:
    63
    Dreeka can you please answer to me? why is the pause menu moving off its original position every time i press the pause button to show it? why it isnt returning in its original position?
     
  13. Muralidaran

    Muralidaran

    Joined:
    May 2, 2014
    Posts:
    93
    Awesome asset, thanks. But I am having one issue. I need to make the background layer elements appear at different positions on the Y-axis but I am not having any luck. Could you tell me what to change in the code.

    Thanks for the help.
     
  14. Dreeka

    Dreeka

    Joined:
    Jul 15, 2010
    Posts:
    507
    freakprince:
    Sorry, I accidentally skipped your post.
    Can you define your issue a little bit more? Also, do you have this problem with the original code, or did you modified something?

    Muralidaran:
    Do you need those items to appear on a predetermined Y position? If yes, then simply move them to their designated locations in the scene view.
     
  15. Ghostfrog

    Ghostfrog

    Joined:
    Feb 17, 2014
    Posts:
    10
    First time poster and I have to say, this kit was well worth the money. It helped me create my first game and I thanks Dreeka for that.
    Having recently submitted my app to the App Store and being approved, I figured I would improve upon the game and I fired up unity.
    For some odd reason, I thought it would be a good idea to gain the functionality of Update 2.0 and so I imported it into my current project.
    I got a ton of errors in the compiler about naming and whatnot so I added a 2 to the end of each one.
    Now I have these errors and I was hoping that someone here, or even Dreeka himself, could help me out.
    I would really appreciate it!
    Thanks
     

    Attached Files:

  16. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    Dont put your backup scripts with other ones or you need to change class names of new scripts.

    Admob banned my account and i am looking for a new way for banners. I searched but cant find a way to use one. I tried Revmob but their example too complicated for me. If anyone use free solution i need help :(
     

    Attached Files:

    Last edited: Jul 4, 2014
  17. Ghostfrog

    Ghostfrog

    Joined:
    Feb 17, 2014
    Posts:
    10
    Just to clarify, these aren't backup scripts. I imported Update 2.0 and it screwed everything up. I would really appreciate it if someone knows how to fix this without me having to start from scratch. Thanks.

    Fahrettin:
    Regarding ads, I don't know if iAds would work for you or not as I don't know what platform you're developing for. However, in the Unity documentation, there is example code for iAds that works perfectly.

    Here it is for anyone who might need it:

    publicclassiAds : MonoBehaviour
    {
    privateADBannerViewbanner = null;
    voidStart()
    {
    banner = newADBannerView(ADBannerView.Type.Banner, ADBannerView.Layout.Bottom);
    ADBannerView.onBannerWasClicked += OnBannerClicked;
    ADBannerView.onBannerWasLoaded += OnBannerLoaded;
    }

    voidOnBannerClicked()
    {
    Debug.Log("Clicked!\n");
    }

    voidOnBannerLoaded()
    {
    Debug.Log("Loaded!\n");
    banner.visible = true;
    }
    }

    On another note, how easy is RevMob or Admob to use?
     
    Last edited: Jul 4, 2014
  18. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    Did you try to change class names ?
    Dreeka knows better but update 2.0 changed lots of things. I think fresh start will be good for you.


    I am working on android. Admob banned my account and now when i register new one they ban in 2-3 days :S Its really stupid because they dont give second chance.
     
  19. Ghostfrog

    Ghostfrog

    Joined:
    Feb 17, 2014
    Posts:
    10
    Yes, I did change the class names and then I get another one about the old scripts.
    I move them out of the assets folder and end up with some PowerUp errors.
    I guess I'll just wait for Dreeka to see this and hope he's got a solution then because a fresh start isn't really a great solution.
    Well, regarding ads, I'm not much more use. Sorry. But that sounds pretty harsh. Can't you appeal to them or something?

    Thanks.

    PS. Dreeka, updates are meant to be updates. Not fresh starts. I understand that everything was simplified - which is great and all - but people who've already created a game should be able to take advantage of it, as well, without starting over. Just something to keep in mind for the next one.
     

    Attached Files:

  20. Ghostfrog

    Ghostfrog

    Joined:
    Feb 17, 2014
    Posts:
    10
    Fahrettin:
    Actually, I just found Chartboost and thought you might like to know about it...
    They even have a Unity Plugin - just search google for it.
     
  21. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    Thanks Ghostfrog I will look for it ;)
    Many of them have unity plugin but not easy to implement for a noob like me.
     
  22. Ghostfrog

    Ghostfrog

    Joined:
    Feb 17, 2014
    Posts:
    10
    Is anyone here still on the first version? If so, could they possibly upload the original "Scripts" file? I believe this could fix my issue. Thanks in advance!
     
  23. Muralidaran

    Muralidaran

    Joined:
    May 2, 2014
    Posts:
    93
    Hi Dreeka

    I was hoping for something a bit more random but I can make enough groups that the player will need to be really watching to notice that it's not truly random.

    I am going through the code because I want to change the controls to tilt controls but if you could point out where I change the code it would help me out a lot.

    Thanks
     
  24. Dreeka

    Dreeka

    Joined:
    Jul 15, 2010
    Posts:
    507
    Also in case you haven't noticed, we have included a brand new HD graphics in the most recent update, as a thank you for our fellow customers!


    Ghostfrog:
    Version 2.0 is not compatible with the previous version, because almost everything has changed.
    However, I can send you a pre 2.0 version, if you need. Send me your invoice number, along with the requested verison.

    Muralidaran:
    Attach this script to each group you wish to randomise:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class ObjectRandomiser : MonoBehaviour
    5. {
    6.     public float maxYPos;
    7.     public float minYPos;
    8.  
    9.     void OnEnable()
    10.     {
    11.         Vector3 pos;
    12.  
    13.         foreach (Transform item in transform)
    14.         {
    15.             pos = item.position;
    16.             pos.y = Random.Range(minYPos, maxYPos);
    17.             item.position = pos;
    18.         }
    19.     }
    20. }
    21.  
     
    Last edited: Jul 6, 2014
  25. Rishi1012

    Rishi1012

    Joined:
    Jul 12, 2013
    Posts:
    9
    Hey! Can I change the Submarine Texture with an animation . If yes then How ? . I have the Images separates of the animation and even have them in sprite form . Pls explain in Detail !! I want to place another animation in place of submarine instead of it being static and i want to do it for the rest of the thing !? Can I do that ?
     
  26. Muralidaran

    Muralidaran

    Joined:
    May 2, 2014
    Posts:
    93
    Cool, thanks. Seems to be working great. Now I just need to figure out the movement and how to add more subs to buy. Any pointers would be greatly appreciated.
     
  27. Ghostfrog

    Ghostfrog

    Joined:
    Feb 17, 2014
    Posts:
    10
    Rishi1012:
    Yes it's possible to have an animated sprite as your "submarine".
    First you need to import your sprite with all the different pictures separated in a grid. (Essentially, create a sprite sheet. Look up TexturePacker on google - perfect tool for this).
    After you've imported your sprite sheet, set it to "Multiple" under sprite mode and open the sprite editor. You can have Unity automatically crop the sprite sheet to each individual picture or you can do it manually - matter of preference.
    The Sprite Sheet should now have an arrow next to it that if clicked brings down a dropdown of all the different pictures you cropped out in the Sprite Editor.
    From there, you drag the sprite sheet into your scene and just drop there.
    Once dropped, Unity will prompt you and ask if you would like to animate it. Create the animator and name it as you wish.
    Then you can take the sprite sheet and place as the sprite for the submarine and drag the new animator that unity created and attach it to the "Submarine".
    If you did this correctly, it should be animated now.

    Dreeka:
    I'll send you a message now. Thanks.
     
  28. Rishi1012

    Rishi1012

    Joined:
    Jul 12, 2013
    Posts:
    9
    .Hey Thanks for the answer but in the End part I got confused Which sprite I have to attach to submarine and how Do I change it ? and What to attach to submarine ? I am Kind of confused . i can see my animation in the scene it is working But the submarine is still there . My animation is just in the middle and i don;t know what to do with it . How to replace the submarine with animation ? Also remember I have to do this for all elements or for most of them so Pls explain in Detail !!
     
    Last edited: Jul 7, 2014
  29. Rishi1012

    Rishi1012

    Joined:
    Jul 12, 2013
    Posts:
    9
    No Reply yet ??
     
  30. Dreeka

    Dreeka

    Joined:
    Jul 15, 2010
    Posts:
    507
    Rishi1012:
    If you see the animation in the scene, that select it, and in the inspector you will see a component called "Animator". Do a right click with the mouse in it, and select "Copy Component". Then select the submarine, and do a right click on the title of the Transform component, and click "Paste Component as New". Then delete the original animation from the scene, and click play.

    Muralidaran:
    You should expand the shop, and add the new submarine skins to it (you can do it based on the current shop). Then give an ID to each skin. If the player changes to a new skin, save the ID of the new one. Then change the intact and damaged texture of the submarine based on that.
     
  31. freakprince

    freakprince

    Joined:
    Apr 25, 2012
    Posts:
    63

    Dreeka no i didnt change any code and i didnt have this problem with the original code i modified the skin of the pause menu and some of the names
     
  32. GiusCo

    GiusCo

    Joined:
    Aug 1, 2009
    Posts:
    405
    Ok that's my version, just approved into the App Store for iOS! Thanks again to Dreeka for his great work!!

    Only markets with iADs and selected others for in-app purchases... Game Center included with two leaderboards (go as far as you can in one run OR complete all 8 missions as fast as you can)

    Download from iTunes at : https://itunes.apple.com/us/app/nuclear-scroller/id882598579


     
    Last edited: Jul 9, 2014
  33. Muralidaran

    Muralidaran

    Joined:
    May 2, 2014
    Posts:
    93
    Thanks Dreeka, I will try that and if I have any trouble I will let you know.

    I did find a bug though. I put my game on my iPad to test it and for some reason, at random times, when I die and hit the play button the menu goes away but the level doesn't restart. I haven't touched any of the code, just changed skins, added particle effects etc. Not sure what is causing the bug
     
  34. Muralidaran

    Muralidaran

    Joined:
    May 2, 2014
    Posts:
    93
    So I have a favor to ask the community. Could someone put up a tutorial, written or video, on how to add new subs for players to buy. This is my first unity project (all of my previous apps were done in GameMaker Studio, which is quite different). I am not sure how to add the IDs and allow players to change skins as Dreeka suggested.

    Thanks, I appreciate the help.
     
  35. Rishi1012

    Rishi1012

    Joined:
    Jul 12, 2013
    Posts:
    9
    Dreeka Thanks for Replying But the method id not working I did what you told But the submarine is still there and the game works the same . I wan't to replace the submarine with my own animated Character
     
  36. Remy_

    Remy_

    Joined:
    Jul 23, 2013
    Posts:
    5
    Hello Rishi,
    Just drag and drop your animation in the hierarchy on the Submarine object to attach it to it, then you can disable the sprite renderer of the submarine, it will not be rendered. Well, this is what i've done, that's maybe not the best but it worked!
     
  37. Rishi1012

    Rishi1012

    Joined:
    Jul 12, 2013
    Posts:
    9
    Are you saying to Cover the submarine with my own animation . I did that but then I can't add animation to its death . I need a Better way !. Can Someone make a little tutorial Video On how to do that or show me sample image of replacing most of the elements with animation
     
    Last edited: Jul 11, 2014
  38. MGMT

    MGMT

    Joined:
    May 18, 2014
    Posts:
    9
    Can someone please help me? Just by opening the 2.1.1 project fresh, I already have the error that the power up activations are behind the sand and also when you die and the menu comes up, the obstacles are over the menu(like the coins). I checked the sorting layer of my sand and it is at 3. please help
     
  39. Dreeka

    Dreeka

    Joined:
    Jul 15, 2010
    Posts:
    507
    freakprince:
    You should not change the name of the buttons. The GUI Manager determinates what action to take depending on the names.

    GiusCo:
    Congratulations on releasing you game! Good luck with it! :)

    Muralidaran:
    Did you changed the name of the buttons?

    About the different submarines, add the new rows to the shop, representing the different submarines. Add a button to each row, and name them SubmarineSkin1, SubmarineSkin2, and so on. Make them a button, by adding a collider to them, moving them to the GUI layer, and set their tag to Button. Then in the GUI Manager, extend the ButtonPressed() function for these new buttons, and define the new button behaviors, so when the player activates the SubmarineSkin2 button, the texture of the submarine is changes to the second skin.

    Rishi1012:
    I am not an expert in the animations topic, but you can check these videos:
    https://unity3d.com/learn/tutorials/modules/beginner/animation

    MGMT:
    I have downloaded a fresh version of the kit on both my PC and my mac, but I do not have this issue. I would suggest you to redownload the kit, and import it to a fresh project after than.
     
  40. Rishi1012

    Rishi1012

    Joined:
    Jul 12, 2013
    Posts:
    9
    --------------------------------------------------------------------------------))))))>>>>>>>
    Hey! Dreeka Thanks Your Earlier Method Worked Thanks for the trick I was doing something Wrong . But the Problem is When it Crashes . You can't see the damage submarine . What I need is when it Struck any obstacles my animation Should change to another sprite/Image or animation . and it should fall on that spot Not drag like the sub Does . But thanks and one more thing I want my Character to move faster and not Flap that much Should be something Like Jetpack Joyride . Thanks in Advance !
     
    Last edited: Jul 13, 2014
  41. MGMT

    MGMT

    Joined:
    May 18, 2014
    Posts:
    9
    Just redownloaded the kit..and same problem. @Dreeka I added screenshots so you can see what I mean
     

    Attached Files:

  42. Muralidaran

    Muralidaran

    Joined:
    May 2, 2014
    Posts:
    93
    Hi Dreeka. Thanks for the feedback. I figured out what I did that was making the game crash. I had removed the sprite renderer on some of the chains and replaced it with particle effects. This was causing a bunch of errors.

    Now as far as the new subs goes. I got the buttons put in and renamed. It is the "define new buttons behavior" part that is stumping me.

    Here's what I have done so far:

    in the GUIManagerJS script

    27 public var submarineSkin1 : boolean;
    28 public var submarineSkin2 : boolean;

    Lines 133 to 139

    case "BuySubmarineSkin1":
    BuySubmarineSkin1();
    break;

    case "BuySubmarineSkin2":
    BuySubmarineSkin2();
    break;

    The I copied the BuyRevive functions and started changing them for the new skins. This is where I am at:

    //Purchases SubmarineSkin1, if there is enough coin
    private function BuySubmarineSkin1()
    {
    var submarineSkin1Price : int = int.Parse(shopPrices[4]);
    if (SaveManagerJS.coinAmmount - submarineSkin1Price >= 0)
    {
    SaveManagerJS.coinAmmount -= submarineSkin1Price;
    SaveManagerJS.revive += 1;
    SaveManagerJS.SaveData();

    missionManager.ShopEvent("Revive");
    UpdateGUIData();
    }
    }

    //Purchases SubmarineSkin2, if there is enough coin
    private function BuySubmarineSkin2()
    {
    var submarineSkin2Price : int = int.Parse(shopPrices[5]);
    if (SaveManagerJS.coinAmmount - submarineSkin2Price >= 0)
    {
    SaveManagerJS.coinAmmount -= submarineSkin2Price;
    SaveManagerJS.revive += 1;
    SaveManagerJS.SaveData();

    missionManager.ShopEvent("Revive");
    UpdateGUIData();
    }
    }

    Now if I understand this right I need to delete the missionManager.ShopEvent("Revive"); lines since I have no missions for buying the new subs but I am not sure if I need to keep the UpdateGUIData();

    I also need to add something to the SaveManagerJS, right? But if I am right it needs to be a boolen just stating if the player bought the new skin or not.

    After that I need to change something so that it applies the new skin and I really don't know what to do there.

    Again if anyone else has already done this (and I know people have because I have downloaded some of those games) could you possibly put up a tutorial for me and anyone else who runs into this issue in the future.

    Thanks for the help.
    Mura
     
  43. GiusCo

    GiusCo

    Joined:
    Aug 1, 2009
    Posts:
    405
    I am done with this, sorry for not being of help Mura. The only tip I can add is that the first feedback for my Nuclear Scroller is: "Game too difficult, character can't move fast enough or obstacles are too packed". People want instant gratification instead of competition. Trying to make it simpler now and send update as soon as possible.

    EDIT: in particular I want to make obstacles less packed and allow more space for control
     
    Last edited: Jul 14, 2014
  44. Muralidaran

    Muralidaran

    Joined:
    May 2, 2014
    Posts:
    93
    Yeah, I made a game called Mad Marble and people didn't like it because I designed it to force you to think and figure out what to do. That's why I am still amazed that Flappy Bird did as well as it did. Talk about a pain in the 4$$ game...
     
  45. Muralidaran

    Muralidaran

    Joined:
    May 2, 2014
    Posts:
    93
    Hi Dreeka. Just wondering if you had a chance to look at that code I posted. Buying the new subs skins is the last thing I need to put in my game and it is ready to submit.

    Thanks for the help
    Mura
     
  46. Que

    Que

    Joined:
    Mar 14, 2014
    Posts:
    135
    @Dreeka

    I'm interested to buy this Kit, will you please guide me on how to change the character and the background to personalize the game.

    Thank you.
     
  47. Que

    Que

    Joined:
    Mar 14, 2014
    Posts:
    135
    Maybe you have some documentations, please let me know or send me email to em @ king.net.

    Looking forward to hear from you.
    Thank you.
     
  48. Dreeka

    Dreeka

    Joined:
    Jul 15, 2010
    Posts:
    507
    Sorry for the really late reply!

    Rishi1012:
    When the submarine crash, you should change the animation to a crash animation. As I said, I am not an expert in the animations topic, but the videos I sent you should cover the needed topics.

    MGMT:
    What Unity version do you use?

    Muralidaran:
    Purchasing a new skin is a one time purchase, right? So, you have to store the purchase state of each skin in the save manager. You should add a new variable for each skin in the save manager. Then in the GUIManager it should look like this:
    Code (CSharp):
    1. private function BuySubmarineSkin1()
    2. {
    3.     if (SaveManagerJS.subSkin1Owned == 1)
    4.     {
    5.         PlayerManagerJS.UpdateSkin(1);
    6.     }
    7.     else
    8.     {
    9.         var submarineSkin1Price : int = int.Parse(shopPrices[5]);
    10.         if (SaveManagerJS.coinAmmount - submarineSkin1Price >= 0)
    11.         {
    12.             SaveManagerJS.coinAmmount -= submarineSkin1Price;
    13.             SaveManagerJS.subSkin1Owned = 1;
    14.             SaveManagerJS.SaveData();
    15.  
    16.             missionManager.ShopEvent("SubmarinSkin1");
    17.             PlayerManagerJS.UpdateSkin(1);
    18.         }
    19.     }
    20. }
    You also have to implement the PlayerManagerJS.UpdateSkin(int id) function. This function should change the texture of the submarine, depending on the given int. So if you call PlayerManagerJS.UpdateSkin(1), the 1. skin will be applied. You also have to extend the shop prices array in the GUI Manager, so the skins will have their own custom price.

    Que:
    The background and the character can be easily swapped by changing the provided textures. if you get stuck, you can always send me an email, or post your question here.
     
  49. Que

    Que

    Joined:
    Mar 14, 2014
    Posts:
    135
    @Dreeka

    Please send me your email at em @ king.net.

    Thank you,
    EM
     
  50. Que

    Que

    Joined:
    Mar 14, 2014
    Posts:
    135
    @Dreeka
    I purchased it, will start learning today. I've got your email from the documentation.

    I will keep in touch.
    Thank you,
    EM