Search Unity

2D Infinite Runner Toolkit

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

  1. freakprince

    freakprince

    Joined:
    Apr 25, 2012
    Posts:
    63
    Dreek i wanted to ask, i saw you use Sprites as Buttons? in what script do you use code which transforms a single sprite into a button? how can i add other buttons like that myself?
     
  2. jhample

    jhample

    Joined:
    Jul 7, 2012
    Posts:
    47
  3. gobard

    gobard

    Joined:
    May 20, 2014
    Posts:
    1
    Hi,

    I'm planning to do a 2d infinite runner, but it's going to scroll to the top of the screen (instead of to the right) a bit like a treadmill with the camera on top of it.

    Would this "plugin" still be useful if I try to change the scrolling direction, Is the physics will still work or will I end up re-write everything?

    Thanks a lot!
     
  4. GiusCo

    GiusCo

    Joined:
    Aug 1, 2009
    Posts:
    405
    one thing / bug I'm not able to amend at this time:

    - after changing the power-ups price from the inspector, they go back to predefined values (300 for blast, shield, speed and 450 for revive) at runtime ... what's happening with powerUpPrices initialization and how do I control that?
     
    Last edited: May 21, 2014
  5. Dreeka

    Dreeka

    Joined:
    Jul 15, 2010
    Posts:
    507
    freakprince:
    It is simple. I put the sprites to the "GUI" layer, set their tags to "Button", and I add a box collider to them (with trigger enabled). This way the Input Manager handles them as buttons. Their behaviour is defined in the GUI Manager's ButtonPressed() function.

    jhample:
    Really nice game, good job! :)

    gobard:
    To create a vertical scrolling level, you need to change a few lines the moving/scrolling layer script. You will also need to set a new starting/spawning position for the layer elements in the inspector. It is doable in a few hours, and if you are stuck, I will help you.

    GiusCo:
    Are you using the latest version? Because they are not initialized in the code, only in the inspector.
     
  6. GiusCo

    GiusCo

    Joined:
    Aug 1, 2009
    Posts:
    405
    Yes sure! I'm a bit puzzled because I can't honestly say where these pre-set values come from in my laptop.

    Are you able to change the powerups' price from the inspector and keep the new values in runtime after initialization? Any fellow using this template who's willing to try that modification and report? Thanks in advance.


    $off.jpg
    $runtime.jpg
     
    Last edited: May 23, 2014
  7. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    I found it in the inspector. Under the GUI gameobject. Latest option Shop Prices :)

    $Shop Price.JPG
     
    Last edited: May 23, 2014
  8. GiusCo

    GiusCo

    Joined:
    Aug 1, 2009
    Posts:
    405
    a ha! :rolleyes: thank you very much, I owe you one :D
     
  9. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    Dreeka
    - If i have certain powerup it keeps spawning. In next update can you fix this too
     
  10. GiusCo

    GiusCo

    Joined:
    Aug 1, 2009
    Posts:
    405
    Hello folks, here again with a possible bug?

    If I collect one extra-speed while already using one, extra-speed effect goes on indefinitely and never stops.

    Adding some sort of check in the code to avoid this indefinite "double up".
     
  11. NikolaiAnkergren

    NikolaiAnkergren

    Joined:
    Aug 29, 2013
    Posts:
    3
    Greetings

    And ty for this great pack ,, i just bought it !!

    So i have a qustion about the powerups ...
    When i start the game the powerups show up and i can use them.. but if i restart or go back to the menu .. the powerups dose not come back up , ony if i restart the game i can get the powerups to come back up,, is this a bug and if not how to i make them come up again .. i have looked in the scripts and tryed some exstra resets and nothing work atm..

    i hope you will help my issue ,

    and second i found a bug ..

    if you start a new game ,, and restarts and activate the speed power up and click on another boste while the spees boste is runing the speed boste will go in to infinite mode and just keep on going.


    Kind regards

    Nikolai
     
  12. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    Dreeka replied other threads but not his own one. His last reply in this thread is already 1 week old
     
  13. GiusCo

    GiusCo

    Joined:
    Aug 1, 2009
    Posts:
    405
    hopefully he will come with neat advice for the extra speed bug, which is a show-stopper for in-app purchases and leaderboards logic.
     
  14. Dreeka

    Dreeka

    Joined:
    Jul 15, 2010
    Posts:
    507
    Sorry for the late reply!
    I am working on the bug fix update. Most if the bugs is fixed already, and the audio manager is added. It will be submitted on monday.
     
  15. GiusCo

    GiusCo

    Joined:
    Aug 1, 2009
    Posts:
    405
    Fantastic!

    May you please share the bugs fixed list? I may be going to ship next week and can't overwrite my project now, with all modifications! If the case, I would surely have a look at your amendments before deploying and hopefully help myself.

    Best, Giuseppe
     
  16. Dreeka

    Dreeka

    Joined:
    Jul 15, 2010
    Posts:
    507
    Every reported bug, except for the powerup activation, and infinite extra speed. But I will fix them as well before the release of the update.
     
  17. naglesoftware

    naglesoftware

    Joined:
    May 28, 2014
    Posts:
    2
    For powerups not being shown properly on game start:
    add

    item.gameObject.SetActive(true);

    to

    MainGUI.cs before line 165
     
  18. naglesoftware

    naglesoftware

    Joined:
    May 28, 2014
    Posts:
    2
    I'm working on the infinite extra speed bug. It's happening in PowerupManager.ExtraSpeedEffect() line 91 -- paused is true. Steps to reproduce: Hit pause and then retry before using extra speed powerup. variable pause is not getting reset to false...

    The Fix:

    add

    powerupManager.Reset();

    to GUIManager.Retry() after line 264

    to reset the pause variable in the powerupManager
     
    Last edited: Jun 5, 2014
  19. stressfree

    stressfree

    Joined:
    Nov 11, 2013
    Posts:
    1
  20. Dreeka

    Dreeka

    Joined:
    Jul 15, 2010
    Posts:
    507
    naglesoftware:
    Thanks for your comments:

    stressfree:
    Looks good, I wish you good luck with it! :)

    For those, who are waiting for the update:
    Because of some non unity related delays, I was not able to release the update on the given time. However, I will be able to finish it, and upload it to the Asset Store this week!

    -----------------
    Update:

    Version 2.1 has been submitted to the asset store! It should be available soon! Features:
    o An audio system has been added, with audio clips
    o The second, alien themed skin has been added.
    o Bug fixes
     
    Last edited: Jun 9, 2014
    GiusCo likes this.
  21. drswoboda

    drswoboda

    Joined:
    Nov 2, 2012
    Posts:
    18
    Your Package is really good and very helpful. I just picked it up this week, and I'm working my way through it, albeit, slowly.

    I'm looking for some guidance on adding support for the Windows Phone Back Button. I'd like to add it into your existing GUI, instead of just hacking it in. To read the Back Button you need to do something like this:

    // Exiting game via Windows Back Button
    if (Input.GetKeyDown(KeyCode.Escape))
    {
    // Add logic here for a UI Button confirming user wants to quit.
    Debug.Log("Pressed Escape Key - Quitting");
    Application.Quit(); // Or just catch input here
    }

    Officially, the back button is supposed to Exit App from main screen. And, it is supposed to close any open UI menu elements. During game play it should go to the pause screen.

    What is the best way to hook this into the existing code? Since the Back Button is not a Unity GUI element, would I have to cast it to a Game Object and then do this:

    guiManager.ButtonPressed(button.gameObject.name);

    Then add an entry into GUIManager and try check for open menus or game play situations?

    Thanks,
    -David
     
  22. drswoboda

    drswoboda

    Joined:
    Nov 2, 2012
    Posts:
    18
    Hello,

    Scrolling sand.png issues on Windows Phone 8.1 with Lumia 1020.

    The out-of-the-box project has an issue (at least with Lumia 1020) and the sand.png texture (1024x72 NPOT).

    The REPEAT WRAP mode is not supported with NPOT textures. (See screen grab)

    I have replace the texture with my own (1024x128) and this works. However, I can see a slight slipping between the LayerScrolling and the LayerMoving>Background>FourthLayer. It's very hard to tell if this slipping is in the out-of-the-box project as the sand layer is a gradient, with only the top edge usable as a visual guide for slipping.

    How are you controlling the speed of those two layers being exactly the same (locked), since you are using two different methods for scrolling them?

    Thanks,
    -David
    NPOT.png
     
  23. Dreeka

    Dreeka

    Joined:
    Jul 15, 2010
    Posts:
    507
    To add the escape key to the kit, I would suggest the following approach:
    Add the following to the InputManager's Update function:
    Code (CSharp):
    1. if (Input.GetKeyDown(KeyCode.Escape))
    2.        guiManager.ButtonPressed("Escape");
    The go to the GUIManager, and add the following to the ButtonPressed function:
    Code (CSharp):
    1. case "Escape":
    2.          //Define your behaviour here
    3.          break;
    The correct sand scrolling speed can be calculated using this formula:
    (fourth layer starting speed / 10) * sand.material.mainTextureScale.x
     
  24. drswoboda

    drswoboda

    Joined:
    Nov 2, 2012
    Posts:
    18
    Dreeka,

    Thank you for the suggestions. I'll roll those into my build. I see that a new version just hit the Asset Store. Since I just started my project this week, I will rebuild my changes into the latest version and get the benefit of some of your updated code.

    Do you have any major changes on the near horizon that I should wait for, or will I be pretty safe to lock-off your code base and then start my own personal modifications?

    Sincerely,
    -David
     
  25. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    I start to test new version
    - Fresh import and after first play i got this error
     
  26. Dreeka

    Dreeka

    Joined:
    Jul 15, 2010
    Posts:
    507
    drswoboda:
    There are no major changes on the horizon, you can start your own personal modifications! :)

    drswoboda:
    I did several fresh imports to test this, however I have not experienced this issue. I would suggest you to download the kit and import it again.
     
  27. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    Your advice (Redownloading asset) worked ;)
     
  28. John-Sandrey

    John-Sandrey

    Joined:
    Jul 2, 2012
    Posts:
    119
    I was just wondering about the sand glitching the longer you play the game. I put the project on my samsung note2 and the back ground looks fine its just the sand starts glitching after a while.
     
  29. drswoboda

    drswoboda

    Joined:
    Nov 2, 2012
    Posts:
    18
    Import and run issues with v2.1 asset and Unity 4.5.0f6 (and 4.3.2)

    I get the following errors right after importing the asset into a new project:
    Untitled picture1.png

    Then when I run the project, I get this error:
    Untitled picture2.png

    I have re-downloaded the asset three times from the store. I have tried importing in an older version of Unity 4.3.2 and I get the same errors.

    I see Fahrettin had an issue which reimporting appears to have fixed. Over here that has not worked. Do we have a strange edge case with this file?

    My Windows build system is an i7 running Win8.1 update 1, with Visual Studio Ultimate 2013.

    I went back to v2.0 of the asset and have no issues.

    Help Please!

    -David
     
  30. Dreeka

    Dreeka

    Joined:
    Jul 15, 2010
    Posts:
    507
    John Sandrey:
    I will release a fix for that.

    drswoboda:
    The latest update requires unity 4.5.0.
    If you have this issue in unity 4.5 as well, you should check 2 thing. First, are the missions assigned to the mission manager? Secondly, did the save manager loaded the data values? Please check these, and let me know what did you found.
     
  31. drswoboda

    drswoboda

    Joined:
    Nov 2, 2012
    Posts:
    18
    Tried on both Unity v4.5.0f6 & v4.5.1f3. With newly downloaded file and fresh import.

    The missions appear to be assigned correctly.
    Untitled picture3.png

    Using the Find Refs in Scene command finds no references to the SaveManager script. Oops! Is that the issue with this file?

    -David
     
  32. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    I finished all the missions and started to get this error.

    It prevents you to see finish menu and pause menu. If i try to pause i get this error.

    I added extra mission and pause menu showed up. After finishing that one same errors happened. You really need to fix that Dreeka
     
  33. Dreeka

    Dreeka

    Joined:
    Jul 15, 2010
    Posts:
    507
    Update 2.1.1 has been submitted to the asset store!

    Features:
    - Mission Manager related error has been fixed
    - Sand scrolling speed issue has been fixed
    - Audio Manager improvements

    To fix the mission manager issue, change line 50 to the following:
    Code (CSharp):
    1. if (missionID[i] != -1 && !missions[missionID[i]].IsCompleted())
     
  34. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    On actual device after first torpedos it just shows warning but doesnt launch torpedos. I dont know why happens is it just me or general bug ?
     
  35. qkhanh02

    qkhanh02

    Joined:
    Jun 18, 2014
    Posts:
    1
    Hi,
    I'm new to Unity.
    How could I change the main background image ?
     
  36. Dreeka

    Dreeka

    Joined:
    Jul 15, 2010
    Posts:
    507
    Update 2.1.1 has been released to the asset store!

    Fahrettin:
    They are working fine on my device. Did you modified the torpedo scripts?

    qkhanh02:
    To do that, you have to put your own texture to the Textures folder. Then in the Hierarchy window, find the gameobject named "Background" (it is under the LevelGenerator), and replace it with your own texture.
     
    Last edited: Jun 18, 2014
  37. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    I didnt touch any script but randomly it works and randomly stops :D I dont know what to say maybe i need to start from 1st step again. Thanks for updates

    One more thing. Ex: player collects revive powerup and its keep spawning. Game need to stop revive when you have it. (Or shield)
     
    Last edited: Jun 18, 2014
  38. John-Sandrey

    John-Sandrey

    Joined:
    Jul 2, 2012
    Posts:
    119
    I have the same problem with the torpedoes, a couple waves of them and they just stop.
     
  39. superwendel

    superwendel

    Joined:
    Jun 18, 2013
    Posts:
    105
    I'm also having the same issues with the torpedoes as both John and Fahrettin are having. The exclamation point image will appear but they aren't being generated.

    I'm also still able to recreate the infinite speed power-up bug, was this a piece that you've been able to fix in the updates?
     
  40. StriderHiro

    StriderHiro

    Joined:
    Jun 20, 2014
    Posts:
    6
    Hey Guys, Just downloaded this, Its amazing! Bit of a noob here, how would I got about making the submarine animated? I've already created the images I will use. Also how would i go about changing the background to this one?

    https://www.assetstore.unity3d.com/en/#!/content/15189

    Thanks!
     
  41. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    Dreeka can answer your questions. Most of us like you, noobs :D

    Now i learnt infinite speed bug ^^
    1- Buy one or more speed
    2- Start game
    3- Pause game
    4- Go start of the game with Quit button
    5- Use speed and its infinite :D

    Doesnt work with finish menu. Code seems same but we have a problem with pause menu
     
    Last edited: Jun 20, 2014
  42. Dreeka

    Dreeka

    Joined:
    Jul 15, 2010
    Posts:
    507
    Fahrettin, John Sandrey, StevenWendel:
    Thanks for reporting the issues, I will look into it, and post a solution.

    StriderHiro:
    Remove the current background elements from the kit, and import the new one. Place the images in the middle, and set their sorting order. Then put a Scrolling Layer script in every sprite, and set their starting speed depending on your needs. Then assign them to the Level Generator. Also, don't forget to remove the sand reference from the Resolution Manager.
     
  43. GiusCo

    GiusCo

    Joined:
    Aug 1, 2009
    Posts:
    405
    hi dreeka

    i can confirm torpedoes stop appearing after some time in the game

    also reset mission does not work well: what we get from reset in main menu (array mission 0,1,2 as expected) is different from what pause menu window shows (array mission 3,1,2) and this impacts the game because missions are not working any more ... sometimes if we click on main menu reset many times it goes well but most of times does not ... i was trying to modify and reset to 0,0,0 instead of 0,1,2 in array and see what happens.
     
  44. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    Off topic
    I want to touch and click certain points or objects on screen which has colliders. Input manager script is good but i cant make it simple.
     
  45. MGMT

    MGMT

    Joined:
    May 18, 2014
    Posts:
    9
    How come the obstacles are over the finish menu after you die?
     
  46. StriderHiro

    StriderHiro

    Joined:
    Jun 20, 2014
    Posts:
    6
    Thanks for your response! I'll try this today after work! First time using Unity so I may be back asking more questions!

    Also, how would i go about making the image used for the submarine animated? I have created the 6 images for the animation already. And for the coins, would it be possible to use 4 diff images and have it randomly generate them as coins?
     
  47. dgranlet98

    dgranlet98

    Joined:
    Jan 10, 2013
    Posts:
    4
    I have a strange problem the torpedo's are constantly on the screen

    any ideas? They disappear after they fire
     
    Last edited: Jun 22, 2014
  48. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    Its resolution problem i think. Change Free Aspect to whatever it fits ;)
     
  49. dgranlet98

    dgranlet98

    Joined:
    Jan 10, 2013
    Posts:
    4
    that actually makes sense :) will try now.

    yep fixes it in build where it counts :)

    Thank you.
     
    Last edited: Jun 22, 2014
  50. MGMT

    MGMT

    Joined:
    May 18, 2014
    Posts:
    9
    Can anyone help me with several issues?

    One problem I am having is the power ups are hidden behind the sand... Like If I purchase a shield, the button to activate it is behind the sand layer.

    Also, when you die, all the obstacles like coins,etc. are over the finish menu. How would one fix that?

    Thanks for whoever helps me