Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Official 2D Roguelike: Q&A

Discussion in 'Community Learning & Teaching' started by Matthew-Schell, Feb 10, 2015.

Thread Status:
Not open for further replies.
  1. PolitelySpooky

    PolitelySpooky

    Joined:
    Apr 19, 2015
    Posts:
    3
    Hi! I've been doing the 2D Roguelike tutorial and I have reached a problem in part 6 of 14 Moving Objects where you write the moving object script. i have finished and as far as i can see i have written the script right... The problem is that the error reads
    "Assets/Scripts/MovingObject.cs(21,20): error CS0161: `MovingObject.Move(int, int, out UnityEngine.RaycastHit2D)': not all code paths return a value"
    i have checked the script and this is what it looks like:
    Code (CSharp):
    1. protected bool Move (int xDir, int yDir, out RaycastHit2D hit)
    2.     {
    3.         Vector2 start = transform.position;
    4.         Vector2 end = start + new Vector2(xDir, yDir);
    5.  
    6.         boxCollider.enabled = false;
    7.         hit = Physics2D.Linecast(start, end, blockingLayer);
    8.         boxCollider.enabled = true;
    9.  
    10.         if (hit.transform == null)
    11.         {
    12.             StartCoroutine(SmoothMovement(end));
    13.             return true;
    14.         }
    15.     }
    The red line is under Move incase you cant see it. Is this a problem with my code or Unity 5.2.2? Thanks in advance!! :3
     
  2. malialis

    malialis

    Joined:
    Feb 4, 2015
    Posts:
    24
    [Update]

    Solved it. I missed a bracket and the code worked but it made it auto load the game over screen. So no actual errors, it was doing what it should. Not what I wanted. But now that I added the brackets it is working as intended.

    Yay.

    Hello.

    Great tutorial. Very informative and fun. I am near the end, did not have much trouble. But after the SoundManager tutorial. I die instantly. I press play to load the game, and the game loads but once I move in any direction the game over screen comes up. I do not get an error. I hear the BG music, I hear my death sound. But when i click on the GameManger I still have 100 food points.

    So I should not of starved to death. It happened after I added the audio clips to the wall prefabs. That is the best I got to narrowing it down. It played fine up till then. Not sure what to post for screen shots.

    Thank you in advance.
     
    Last edited: Nov 16, 2015
  3. Matthew-Schell

    Matthew-Schell

    Unity Technologies

    Joined:
    Oct 1, 2014
    Posts:
    238
    Glad to hear you solved it.
     
  4. Matthew-Schell

    Matthew-Schell

    Unity Technologies

    Joined:
    Oct 1, 2014
    Posts:
    238
    No Vector3 is not too heavy (assuming you mean computationally intense) and because even in 2D mode Unity is still representing things in 3D space (sprites are just all flat on the same Z axis location) sometimes the use of a Vector3 is needed.
     
  5. ryanmeister

    ryanmeister

    Joined:
    Aug 29, 2015
    Posts:
    1
    Hi,

    I have a quick question that is related to an issue I think is pretty specific.

    When I hit play it loads the scene properly I can break walls, food works correctly, but no enemies spawn. Then when I go to the exit it says "Level 3" instead of level 2 and all the sudden I have 0 food or -1 or something like that. I don't know if it's a state issue, like not carrying over or resetting my food, or maybe it's something more simple, also there are always enemies when I go to the exit and it goes to the next level, displaying "Level 3".


    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine.UI;
    5.  
    6. public class GameManager : MonoBehaviour {
    7.  
    8.     public float levelStartDelay = 2f;
    9.     public float turnDelay = .1f;
    10.  
    11.     public static GameManager instance = null;
    12.     public BoardManager boardScript;
    13.     public int playerFoodPoints = 100;
    14.     [HideInInspector] public bool playersTurn = true;
    15.  
    16.  
    17.     private Text levelText;
    18.     private GameObject levelImage;
    19.     private int level = 1;
    20.     private List<Enemy> enemies;
    21.     private bool enemiesMoving;
    22.     private bool doingSetup;
    23.  
    24.  
    25.     // Use this for initialization
    26.     void Awake ()
    27.     {
    28.         if (instance == null)
    29.             instance = this;
    30.         else if (instance != this)
    31.             Destroy(gameObject);
    32.  
    33.         DontDestroyOnLoad (gameObject);
    34.         enemies = new List<Enemy> ();
    35.         boardScript = GetComponent<BoardManager> ();
    36.         InitGame ();
    37.     }
    38.     void OnLevelWasLoaded (int index)
    39.     {
    40.         level++;
    41.  
    42.         InitGame ();
    43.     }
    44.  
    45.     void InitGame()
    46.     {
    47.         doingSetup = true;
    48.         levelImage = GameObject.Find ("LevelImage");
    49.         levelText = GameObject.Find ("LevelText").GetComponent<Text> ();
    50.         levelText.text = "Day " + level;
    51.         levelImage.SetActive (true);
    52.         Invoke ("HideLevelImage", levelStartDelay);
    53.  
    54.         enemies.Clear ();
    55.         boardScript.SetupScene (level);
    56.     }
    57.  
    58.     private void HideLevelImage ()
    59.     {
    60.         levelImage.SetActive (false);
    61.         doingSetup = false;
    62.     }
    63.  
    64.     public void GameOver()
    65.     {
    66.         levelText.text = "After " + level + " days, you starved.";
    67.         levelImage.SetActive (true);
    68.  
    69.         enabled = false;
    70.     }
    71.     // Update is called once per frame
    72.     void Update ()
    73.     {
    74.         if (playersTurn || enemiesMoving || doingSetup)
    75.             return;
    76.  
    77.         StartCoroutine(MoveEnemies());
    78.     }
    79.  
    80.     public void AddEnemyToList(Enemy script)
    81.     {
    82.         enemies.Add (script);
    83.     }
    84.  
    85.     IEnumerator MoveEnemies()
    86.     {
    87.         enemiesMoving = true;
    88.         yield return new WaitForSeconds(turnDelay);
    89.         if (enemies.Count == 0)
    90.         {
    91.             yield return new WaitForSeconds(turnDelay);
    92.         }
    93.         for (int i = 0; i < enemies.Count; i++)
    94.         {
    95.             enemies[i].MoveEnemy();
    96.             yield return new WaitForSeconds(enemies[i].moveTime);
    97.         }
    98.         playersTurn = true;
    99.         enemiesMoving = false;
    100. }
    101. }

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using UnityEngine.UI;
    4.  
    5. public class Player : MovingObject {
    6.  
    7.  
    8.     public int wallDamage = 1;
    9.     public int pointsPerFood = 10;
    10.     public int pointsPerSoda = 20;
    11.     public float restartLevelDelay = 1f;
    12.     public Text foodText;
    13.  
    14.     private Animator animator;
    15.     private int food;
    16.  
    17.     // Use this for initialization
    18.     protected override void Start ()
    19.     {
    20.         animator = GetComponent <Animator> ();
    21.         food = GameManager.instance.playerFoodPoints;
    22.  
    23.         foodText.text = "Food: " + food;
    24.  
    25.         base.Start ();
    26.  
    27.     }
    28.  
    29.     private void OnDisable()
    30.     {
    31.         GameManager.instance.playerFoodPoints = food;
    32.  
    33.     }
    34.     // Update is called once per frame
    35.     void Update ()
    36.     {
    37.         if (!GameManager.instance.playersTurn)
    38.             return;
    39.  
    40.         int horizontal = 0;
    41.         int vertical = 0;
    42.  
    43.         horizontal = (int)Input.GetAxisRaw ("Horizontal");
    44.         vertical = (int)Input.GetAxisRaw ("Vertical");
    45.  
    46.         if (horizontal != 0)
    47.             vertical = 0;
    48.  
    49.         if (horizontal != 0 || vertical != 0)
    50.             AttemptMove<Wall> (horizontal, vertical);
    51.  
    52.     }
    53.     protected override void AttemptMove <T> (int xDir, int yDir)
    54.     {
    55.         food--;
    56.         foodText.text = "Food: " + food;
    57.  
    58.         base.AttemptMove <T> (xDir, yDir);
    59.  
    60.         RaycastHit2D hit;
    61.  
    62.         CheckIfGameOver ();
    63.  
    64.         GameManager.instance.playersTurn = false;
    65.     }
    66.     private void OnTriggerEnter2D (Collider2D other)
    67.     {
    68.         if (other.tag == "Exit")
    69.         {
    70.             Invoke ("Restart", restartLevelDelay);
    71.             enabled = false;
    72.                     }
    73.         else if (other.tag == "Food")
    74.                     {
    75.             food += pointsPerFood;
    76.             foodText.text = "+" + pointsPerFood + " Food: " + food;
    77.                     other.gameObject.SetActive (false);
    78.             }
    79.             else if (other.tag == "Soda")
    80.             {
    81.                 food += pointsPerSoda;
    82.             foodText.text = "+" + pointsPerSoda + " Food: " + food;
    83.                 other.gameObject.SetActive(false);
    84.  
    85.             }
    86.                     }
    87.  
    88.     protected override void OnCantMove <T> (T component)
    89.     {
    90.         Wall hitWall = component as Wall;
    91.         hitWall.DamageWall (wallDamage);
    92.         animator.SetTrigger ("playerChop");
    93.     }
    94.  
    95.     private void Restart ()
    96.     {
    97.         Application.LoadLevel (Application.loadedLevel);
    98.     }
    99.  
    100.     public void LoseFood (int loss)
    101.     {
    102.         animator.SetTrigger ("playerHit");
    103.         food -= loss;
    104.         foodText.text = "-" + loss + " Food: " + food;
    105.         CheckIfGameOver ();
    106.     }
    107.     private void CheckIfGameOver()
    108.     {
    109.         if (food <= 0)
    110.             GameManager.instance.GameOver ();
    111.     }
    112.    
    113.  
    114. }
    115.  
     
  6. Mr-Sev

    Mr-Sev

    Joined:
    Jun 28, 2013
    Posts:
    2
    Hi, at first, thank you for this awesome tutorial!
    I followed the whole tutorial and it's working just fine, however i tried to add something from myself in regard of learning, and i tried to make an in-game main menu. So i created another scene, add canvas and put a simple code, which i learned from different tutorial.

    And everything would be ok, if not that when i hit "New Game" in menu, the game starts from level 2, and then skips every uneven level, so, after level 2 it goes for level 4, then level 6 and goes on...

    I don't know what would be a problem, because thoes scenes and scripts can not collide with each other...

    For some reference, here is my code for main menu:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class MainMenu : MonoBehaviour {
    5.  
    6. public string startLevel;
    7.  
    8. public void NewGame()
    9. {
    10. Application.LoadLevel(startLevel);
    11. }
    12.  
    13. public void QuitGame()
    14. {
    15. Application.Quit();
    16. }
    17. }
     
  7. stay1gold

    stay1gold

    Joined:
    Nov 18, 2015
    Posts:
    2
    Hi, great tutorial, I've just finished it but am having some problems with the very last part.

    When I use my iPhone with Unity Remote no touch inputs register, still works with keyboard but no touch screen input.

    Here is my touch input code, any help is greatly appreciated!

    Code (CSharp):
    1. #if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBPLAYER
    2.  
    3.         horizontal = (int)Input.GetAxisRaw ("Horizontal");
    4.         vertical = (int)Input.GetAxisRaw ("Vertical");
    5.  
    6.         if (horizontal != 0)
    7.         {
    8.             vertical = 0;
    9.         }
    10.  
    11.     #elif UNITY_IOS || UNITY_ANDROID || UNITY_WP8 || UNITY_IPHONE
    12.  
    13.         if (Input.touchCount > 0)
    14.         {
    15.             Touch myTouch = Input.touches[0];
    16.  
    17.             if (myTouch.phase == TouchPhase.Began)
    18.             {
    19.                 touchOrigin = myTouch.position;
    20.             }
    21.  
    22.             else if (myTouch.phase == TouchPhase.Ended && touchOrigin.x >= 0)
    23.             {
    24.                 Vector2 touchEnd = myTouch.position;
    25.                 float x = touchEnd.x - touchOrigin.x;
    26.                 float y = touchEnd.y - touchOrigin.y;
    27.                 touchOrigin.x = -1;
    28.                 if (Mathf.Abs(x) > Mathf.Abs(y))
    29.                     horizontal = x > 0 ? 1 : -1;
    30.                 else
    31.                     vertical = y > 0 ? 1 : -1;
    32.             }
    33.         }
    34.  
    35.     #endif
     
  8. Matthew-Schell

    Matthew-Schell

    Unity Technologies

    Joined:
    Oct 1, 2014
    Posts:
    238

    It sounds to me like the OnLevelWasLoaded function in GameManager is being called twice. This is where the 'level' variable is getting incremented. I'd double check your level loading code and make sure you're not loading the level twice somehow.
     
  9. Matthew-Schell

    Matthew-Schell

    Unity Technologies

    Joined:
    Oct 1, 2014
    Posts:
    238
    I just tested it and reproduced the problem, the code looks correct. It may be an issue with the remote. I'll talk to the devs and see what we can figure out.
     
  10. stay1gold

    stay1gold

    Joined:
    Nov 18, 2015
    Posts:
    2
    Okay, many thanks!
     
  11. Mr-Sev

    Mr-Sev

    Joined:
    Jun 28, 2013
    Posts:
    2
    I just checked the Hierarchy when i click the "New Game", and it seams that you might be right, because it creates two different levels in the same time, for example first and second level, however it just shows the second level "in-game" window (it kind of overlaps the first level objects).
    Well, i'm not entirely sure how to prevent it, however i will try to come with something....
     
  12. kleinrock

    kleinrock

    Joined:
    Oct 5, 2015
    Posts:
    3

    Sounds like it may not have wiped the last board. I have had this problem too.
     
  13. kleinrock

    kleinrock

    Joined:
    Oct 5, 2015
    Posts:
    3
    It would be really great if someone posted the code for a restart button at the end of the game that starts a fresh game correctly. Going through this thread there seems to be a lot of questions about this.
     
  14. ColeCam

    ColeCam

    Joined:
    Nov 20, 2015
    Posts:
    2
    Might have already been posted, but I had to copy the code directly from underneath the video and now I am getting the "The namespace 'Completed' already contains a definition for GameManager" error and I am not sure what to do.
     
  15. kleinrock

    kleinrock

    Joined:
    Oct 5, 2015
    Posts:
    3
    Matthew-Schell likes this.
  16. PolitelySpooky

    PolitelySpooky

    Joined:
    Apr 19, 2015
    Posts:
    3
    Hello again!
    My past question didn't get answered so i decided just to restart the whole MovingObject script again. This sounded like the best thing to do for me but now i have finished not only do i have the same error as before but i have many more which mostly say something about 'ambiguity between X and Y'
    As i'm not sure on how the errors will show by posting the code i will send screenshots.
    upload_2015-11-21_15-56-0.png
    Thanks!

    EDIT: Its also not letting me add my code to my post as its 'spam'
     

    Attached Files:

    Last edited: Nov 22, 2015
  17. Kaytlyn

    Kaytlyn

    Joined:
    Jul 11, 2012
    Posts:
    17
    Honestly that looks like you may not have the script spelled right in unity. I don't see any coding issues on it. This is seeing it compared to my script. I may have missed something, but that's what it looks like to me. Could you copy and paste the error ?
     
  18. Kaytlyn

    Kaytlyn

    Joined:
    Jul 11, 2012
    Posts:
    17
    So I'm having a problem with my game. I completed the tutorial however, I can't make the player attack (I don't know what your supposed to press but I tried all my keys and mouse buttons, and the player won't attack also my player goes outside the game board. meaning he goes past the outerwalls which he's not supposed to do. Let me know what scripts you need to see and I'll post them when you reply. I'm sure they are correct, as I compared them to the completed ones and except the comments which I added it was the only thing that was missing.
     
  19. KodingK

    KodingK

    Joined:
    Jul 6, 2015
    Posts:
    1
    Hello, I am at part 11 of the tutorial, and I can not get the screen to work properly. The text displays, but the board does not display, and all I see is the food bar. Please help.
     
  20. SolidWhiteTiger

    SolidWhiteTiger

    Joined:
    Oct 26, 2015
    Posts:
    4
    Hello, having a problem at video 11 (possibly 10 was the problem). When I try to play I am getting the error, "Assets/Scripts/Enemy.cs(48,19): error CS0122: `Player.LoseFood(int)' is inaccessible due to its protection level". Here is the code that the console takes me to when i double click the error with line 48 being the specific one. Any ideas? : /
    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System;
    4.  
    5. public class Enemy : MovingObject
    6. {
    7.     public int playerDamage;
    8.  
    9.     private Animator animator;
    10.     private Transform target;
    11.     private bool skipMove;
    12.  
    13.     protected override void Start ()
    14.     {
    15.         animator = GetComponent<Animator>();
    16.         target = GameObject.FindGameObjectWithTag("Player").transform;
    17.         base.Start();
    18.     }
    19.  
    20.     protected override void AttemptMove<T>(int xDir, int yDir)
    21.     {
    22.         if (skipMove)
    23.         {
    24.             skipMove= false;
    25.             return;
    26.         }
    27.  
    28.         base.AttemptMove<T>(xDir, yDir);
    29.  
    30.         skipMove = true;
    31.     }
    32.     public void MoveEnemy()
    33.     {
    34.         int xDir = 0;
    35.         int yDir = 0;
    36.  
    37.         if (Mathf.Abs(target.position.x - transform.position.x) < float.Epsilon)
    38.             yDir = target.position.y > transform.position.y ? 1 : -1;
    39.         else
    40.             xDir = target.position.x > transform.position.x ? 1 : -1;
    41.  
    42.         AttemptMove<Player>(xDir, yDir);
    43.     }
    44.     protected override void OnCantMove<T>(T component)
    45.     {
    46.         Player hitPlayer = component as Player;
    47.  
    48.         hitPlayer.LoseFood(playerDamage);
    49.     }
    50. }
     
    Last edited: Nov 28, 2015
  21. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Can you please learn to use code tag properly?

    http://forum.unity3d.com/threads/using-code-tags-properly.143875/
     
  22. C4G65

    C4G65

    Joined:
    Nov 3, 2015
    Posts:
    4
    If all tiles are gameobjects, how big of a problem that will become in very large worlds? Grid sizes like 300x300 or more? Is there better alternatives to gameobjects?
     
  23. SolidWhiteTiger

    SolidWhiteTiger

    Joined:
    Oct 26, 2015
    Posts:
    4
    Nevermind, found the problem myself. I had the function LoseFood in player script set to private instead of public.
     
    Matthew-Schell likes this.
  24. Hedeag

    Hedeag

    Joined:
    Feb 10, 2015
    Posts:
    29
    I want to thank Matthew for this lesson, I was about to give up Unity when I came across
    it and decided to make a game. It took me 7 months, but in the end, I’ve learned Unity
    and made my first game thanks to this lesson.

    Thanks again, Matthew.


    I’ve made a FanFic Roguelike of my favorite game Fallout 2. It's free and without ads.
    https://play.google.com/store/apps/details?id=hede.ru

    If anyone of the forum members download it and have questions on the implementation of one or another
    of the specialties, I will gladly tell them how I did it. So, you can download and ask questions, I'm open.
     
    Last edited: Dec 8, 2015
    wilberh likes this.
  25. dani-unity-dev

    dani-unity-dev

    Joined:
    Feb 22, 2015
    Posts:
    174
    You may want to extract the duplicated code into a component of its own.
     
    Matthew-Schell likes this.
  26. Matthew-Schell

    Matthew-Schell

    Unity Technologies

    Joined:
    Oct 1, 2014
    Posts:
    238
    Awesome! Very cool to see!
     
  27. Matthew-Schell

    Matthew-Schell

    Unity Technologies

    Joined:
    Oct 1, 2014
    Posts:
    238
  28. Matthew-Schell

    Matthew-Schell

    Unity Technologies

    Joined:
    Oct 1, 2014
    Posts:
    238
    I would double check to make sure the black image we're using between levels is being properly activated and deactivated in the game manager.
     
  29. Matthew-Schell

    Matthew-Schell

    Unity Technologies

    Joined:
    Oct 1, 2014
    Posts:
    238
    Can you check your scene and prefabs against those in Completed? I am guessing there is an issue with the player or one of the other prefabs not being set on the Blocking Layer.
     
  30. wilberh

    wilberh

    Joined:
    Oct 29, 2014
    Posts:
    4
    Any fix yet? I'm experiencing the same problem. I can see the game on my Android device but the touch screen is not responsive. Can anyone help here?
     
  31. ColeCam

    ColeCam

    Joined:
    Nov 20, 2015
    Posts:
    2
    I have the error "The type or namespace name 'enemy' could not be found (are you missing a using directive or an assembly reference?)" Code 1.PNG Code 2.PNG Code 3.PNG Code 4.PNG
     
  32. Hedeag

    Hedeag

    Joined:
    Feb 10, 2015
    Posts:
    29
  33. RohailTariq

    RohailTariq

    Joined:
    Jan 7, 2015
    Posts:
    8
    Hi, I trying to add menu system in 2D Roguelike Sample Project. But When i create a new scene to play the game, it switches to next scene and starts the game but it shows "Day 2" instead of "Day 1" and after that it shows "Day 4". I mean the game is skipping levels. I'm Confused what to do!
     
  34. Hedeag

    Hedeag

    Joined:
    Feb 10, 2015
    Posts:
    29
    Look through the pages, it was there already on page 5 or near.
     
    Last edited: Dec 10, 2015
  35. buugy123

    buugy123

    Joined:
    Dec 11, 2015
    Posts:
    5
    Hi guys,

    I have done the Tutorial up to "Audio and Sound Manager". Now the problem I ran into is the following: The game runs fine when I run it in unity, but when I build it for windows things get weird.

    For some reason, the game starts at Day 2 (sometimes with overlapping food, enemies and walls) and continues with Day 4 after I reach the exit (again sometimes with overlapping tiles) and a food reserve of 0.

    Game start:
    start-day2.png

    next level:
    next-day4.png

    I have absolutely no idea where this comes from.
    Even if I take the completed version of the tutorial and build it I run into the same issue (but with some music for a change).

    Any idea what the reason for this problem could be?

    Btw: I am using Unity 5.3.0f4 Personal edition on Windows 7
     
    Last edited: Dec 11, 2015
  36. Hedeag

    Hedeag

    Joined:
    Feb 10, 2015
    Posts:
    29
    U delete original music or not?
    Usually such an error happens when one of the public game objects is lost.
     
    Last edited: Dec 12, 2015
  37. buugy123

    buugy123

    Joined:
    Dec 11, 2015
    Posts:
    5
    No I just put the Main Scene of the completed version into the hierarchy, delete my own scene and build it from there. Again. Everything works perfectly fine when I run it in Unity, but gets all wonky after being built.
     
  38. Hedeag

    Hedeag

    Joined:
    Feb 10, 2015
    Posts:
    29
    Maybe the problem is in the build options, for whitch platform do u make the build?
    Try make a build for another platform it is the best solution when u don't know what the problem is.
     
  39. buugy123

    buugy123

    Joined:
    Dec 11, 2015
    Posts:
    5
    I built it for Windows for both architectures x86 and x86_64, makes no difference. In Linux I cant even get it started.
     
  40. Hedeag

    Hedeag

    Joined:
    Feb 10, 2015
    Posts:
    29
    Try Web Player or Adndroid
     
  41. buugy123

    buugy123

    Joined:
    Dec 11, 2015
    Posts:
    5
    It did not work, with a Web Player build. However, even if it did ... it should work as a Windows built shouldn't it?
     
  42. Hedeag

    Hedeag

    Joined:
    Feb 10, 2015
    Posts:
    29
    I've never tried make it for windows but made for web and android and it works. I think everyone here make this game for web and android | ios only. If u made for web and android and it didn't work, look for errors in code.

    Also try download full clear version from store and make build.
     
  43. buugy123

    buugy123

    Joined:
    Dec 11, 2015
    Posts:
    5
    Well, thats what I did and have the same problem.
    (the completed version being the finished one distributed with the tutorial)
     
  44. Kvothe0408

    Kvothe0408

    Joined:
    Nov 23, 2015
    Posts:
    1
    Hello, thanks for your tutorial, that helps a lot.
    I have encountered a few problems. First, when my character go to next level, my food value auto go back to 100. Second, I can move my character when the LevelImage is on. Last one, you said that we should move FoodText on top of LevelImage so that unity will render it first, but when I moved it, the color of LevelImage stopped showing.
     
  45. puhri

    puhri

    Joined:
    Nov 4, 2015
    Posts:
    1
    Hey There Matt & Co.!

    Just curious how to use UnityEngine.SceneManagement in Player.CS since the new Unity 5.3 update states that Application.LoadLevel(Application.loadedLevel) is obsolete.

    Thanks!
     
  46. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    You may need to be patient as we get all of our learning materials up to speed with 5.3.
     
  47. Hedeag

    Hedeag

    Joined:
    Feb 10, 2015
    Posts:
    29
    I've found a WASD problem, if you press WD or AW the player moves diagonally. How to fix it?
     
  48. malialis

    malialis

    Joined:
    Feb 4, 2015
    Posts:
    24
    Hello.

    I made a restart game button. It takes you back to the main menu and you can choose to play game or exit. Exit works, but play game loads the game at the next level of when the player died. Example, I starved after 3 days. I start the game again with out exiting and now it loads to day 4 and I have minus 19 food points.

    I can not move and the game does not go to game over.

    Is there a way to clear the player settings that are keeping the food points and reset it to level one?

    thank you in advance.
     
  49. dougyuri

    dougyuri

    Joined:
    Dec 9, 2015
    Posts:
    7
    Hello @RamonBoza!

    Have past a long time since this thread, but I'd facing the same problem and found how to solve it. So, for helping people facing it, confirm if the Z axis of Main Camera is lower than the Player's Z axis (e.g. -10 and 0). That's gonna make the trick!
     
  50. Boris_VTR

    Boris_VTR

    Joined:
    May 19, 2015
    Posts:
    8
    How would one go about turning this game into mobile game and making level to cover whole screen? Right now in landscape mode it will only fill center screen (it will fill height), but on the sides there would be a lot of empty space. Any info or some general advice (maybe link to other tutorial solving generating tile level for mobile)?
     
    deviantony likes this.
Thread Status:
Not open for further replies.