Search Unity

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. awillshire

    awillshire

    Joined:
    Apr 29, 2014
    Posts:
    20
    Saving Level Data?

    Hi All,

    I'm at the stage where I am creating levels that can be moved across forwards & backwards. I was wondering if there are any design patterns or suggestions about the best way to save the level data. Basically, a mechanism to ensure that items & enemies left on the level are there when the player comes back.

    Thanks,
    Andrew.
     
  2. DMRhodes

    DMRhodes

    Joined:
    May 21, 2015
    Posts:
    81
    This a thousand times! I'm completely new to Unity and programming as is and have chosen this (Otherwise fantastic tutorial!) as my first learning experience as I'm really only interested in 2d. I was sitting frustrated at part 5 of the tutorial for days because the GameManager script was having some kind of issue when I tried to compile it.

    Nothing is more aggravating than following a tutorial step by step and getting different (or in this case broken) results, putting the brakes on the entire train.
     
  3. Markouuh

    Markouuh

    Joined:
    May 24, 2015
    Posts:
    1
  4. awillshire

    awillshire

    Joined:
    Apr 29, 2014
    Posts:
    20
    Hi Markouth,

    Sorry, my earlier suggestion was wrong! Not seeing your code makes it difficult, but this looks like the Board Manager script isn't properly set up in your GameManager class.

    Try debugging it and put a break point just before the line where the error is thrown. When you reach that point, inspect the variables in the debugger. You may find that the Board variable is set to null. If so, go back and check that you are setting all references to it correctly (compare your code with the completed sample).

    Cheers,
    Andrew.
     

    Attached Files:

    Last edited: May 25, 2015
  5. Matthew-Schell

    Matthew-Schell

    Joined:
    Oct 1, 2014
    Posts:
    238

    It's a bit tricky since you've translated the class names into spanish, however what seems to be happening is that something is going wrong with the list of enemies. It appears that you're trying to move an enemy at an index that is not in the list. Double check the GameManager script in video 11 to make sure that the enemies are being correctly added and cleared from the list.
     
  6. Matthew-Schell

    Matthew-Schell

    Joined:
    Oct 1, 2014
    Posts:
    238
    I would just take a look and make sure you've assigned all the relevant variables in the inspector, it's a bit hard to tell from what you've posted. A NullReferenceException is when you try to reference a variable that is empty or null. In Unity it happens a lot because you've declared a public variable and used it in a script without dragging something in in the inspector to assign it.
     
  7. Matthew-Schell

    Matthew-Schell

    Joined:
    Oct 1, 2014
    Posts:
    238
    I think @awillshire has given you some good advice, that said we're going to need more to go on if you'd like us to help you.
     
  8. Atap21

    Atap21

    Joined:
    Mar 28, 2015
    Posts:
    3
    Hello everybody, i'm having a problem and would like that you help me a little >_<.

    The problem is that when im testing the game after chapter 12, the level 1 loads well but when i go to the exit, it appears 3 board gameobject with their walls, soda, etc childs, and is like the 3 board gameobject are printed in the game, causing a strange and erroneous effect :/.

    Sorry for my english >_<.
     
  9. Matthew-Schell

    Matthew-Schell

    Joined:
    Oct 1, 2014
    Posts:
    238
    @Atap21 Make sure that there is not a game manager saved in the scene and that it is being instantiated properly by the Loader script. It's strange that it's starting after level 12, are you sure that it's behaving correctly before then?
     
  10. Matthew-Schell

    Matthew-Schell

    Joined:
    Oct 1, 2014
    Posts:
    238
    Guys for those asking about other procedural generation approaches, more refined techniques etc I recommend looking at this excellent series on Procedural Cavern Generation by Sebastian Lague:

    The first video is here:


    I've just started watching it but the explanation is clear and it looks interesting and relevant. The approach is similar to what is done in 2DRL in that it starts with nested for loops laying out a random grid with walls around it, but it then adds some cellular automata techniques to smooth out the result and make organic cave shapes. I look forward to going through it further, let me know if you do and find use for it. Hat tip to @Adam Buckner for pointing it out.
     
  11. pvqr

    pvqr

    Joined:
    Apr 27, 2015
    Posts:
    38
    @Matthew Schell Awesome tutorial, I found it a while ago and I've been watching the videos. Really recommend it, specially for those curious on how to improve/learn good game development techniques.
     
    Last edited: May 27, 2015
  12. byagcioglu

    byagcioglu

    Joined:
    Oct 8, 2014
    Posts:
    2
    for those who want to watch the creation process (step by step) of this game this is the NOT-english video series but it might be helpful if you're not at intermediate level:
     
  13. Sam_Se7erne

    Sam_Se7erne

    Joined:
    May 27, 2015
    Posts:
    1
    Hi, I have followed your tutorial exactly, same codes and everything but the game runs to day two, then repeats the day two text and cuts to the 'You starved after 5 days' screen. I have no idea what has caused this. Any suggestions?
     
  14. Atap21

    Atap21

    Joined:
    Mar 28, 2015
    Posts:
    3
    Matther i have said my idea badly, when i said chapter i refer to tutorial chapter. The GameManager is on the hierachry like tutorial said. When i end the level 1, then appears 3 board gameobjects and they are printed on the game one over another.

    Sorry again for my bad english and thanks for helping >_< :).

    EDIT: I have the same problem that @Sam_Se7erne, that ocurrs to me too.

    EDIT 2: Attached an image to a better explanation. I also made the test with the complete project prefabs and it went to the same error :/.

    errorUnity.png

    EDIT 3: Sorry for too many edits xD. I finally found my error. I must have seen the whole tutorial, so i could been noticed about "Loader.cs" script. It was which you said @Matthew Schell, thanks you xDDD
     
    Last edited: May 28, 2015
  15. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    We will probably need to have more information.

    First, I'd suggest double checking both the code and the scene setup to make sure that it follows the video is exactly. Don't forget that the code needs to be correct and the scene set up needs to be correct, otherwise the game will not behave as expected.

    If you still can't find the problem, then can you please post your code and screenshots of your hierarchy.
     
  16. Hedeag

    Hedeag

    Joined:
    Feb 10, 2015
    Posts:
    29
    Has anyone got an idea how to make a weapon switching?
    We've got wallDamage; and if we add a variable wallDamageOne;

    Then how to switch between them?
     
  17. pvqr

    pvqr

    Joined:
    Apr 27, 2015
    Posts:
    38
    Hmm.. You don't need to create a new variable like 'wallDamageOne', you can make a function to detect if the the player is using a weapon and modify the vallue of wallDamage from there.
    like
    Code (csharp):
    1.  
    2. if (isWeaponEquiped) {
    3.     wallDamage = 2;
    4. } else {
    5.     wallDamage = defaultDamage;
    6. }
    7.  
    And insert it in your update method. That should work.
     
  18. j03d4d

    j03d4d

    Joined:
    Oct 4, 2013
    Posts:
    21
    Matthew Schell Can you please help me?

    I have finished up to Chapter 11 of the tutorial and at first everything seems to be working fine. I'm not getting any compiler errors. The enemy and the character move exactly as they should. The weird thing is that I do not collide with the walls, food, or exit(I just walk right over them). The collision between me and the enemy does work though. I cannot walk through him and he will attack me.

    Any idea what might be causing this? I'm pretty sure it has nothing to do with the scripts. I've double checked all my scripts against yours quite a few times and everything seems fine. It is probably something as small as not setting the tag on something correctly or not checking a box like 'Is kinetic'.

    I can't seem to figure it out no matter how many times I watch your videos. Can you give me some sort of hint as to where to look? Why would I not be colliding with walls, food, and exit? What should I check? Do I need to check the 'is trigger' box on the walls or something??

    ***EDIT: I just noticed the enemy also walks through the walls. Is that a good clue?

    Actually it might be the game manager script that's the problem. I just commented out my script and copied your exact script from the tutorial but then the problem is even worse. There is no enemy and I can only take one step then I can't move . . .

    Can someone look at my GameManager.cs and see if they can tell why my enemies and player won't collide with the walls? Or why I don't pick up food?

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4. using System.Collections.Generic;
    5.  
    6. public class GameManager : MonoBehaviour {
    7.  
    8.     public float turnDelay = .1f;
    9.     public static GameManager instance = null;
    10.     public BoardManager boardScript;
    11.     public int playerFoodPoints = 100;
    12.     [HideInInspector] public bool playersTurn = true;
    13.  
    14.  
    15.     private int level = 3;
    16.     private List<Enemy> enemies;
    17.     private bool enemiesMoving;
    18.  
    19.  
    20.     //Use this for initialization
    21.     void Awake ()
    22.     {
    23.         if (instance == null)
    24.             instance = this;
    25.         else if (instance != this)
    26.             Destroy(gameObject);
    27.  
    28.         DontDestroyOnLoad(gameObject);
    29.         enemies = new List<Enemy>();
    30.         boardScript = GetComponent<BoardManager>();
    31.         InitGame();
    32.     }
    33.  
    34.     void InitGame()
    35.     {
    36.         enemies.Clear(); //Clears enemies when game starts
    37.         boardScript.SetupScene(level);
    38.     }
    39.  
    40.     public void GameOver()
    41.     {
    42.         enabled = false;
    43.     }
    44.  
    45.     // Update is called once per frame
    46.     void Update ()
    47.     {
    48.         if (playersTurn || enemiesMoving)
    49.             return;
    50.  
    51.         StartCoroutine(MoveEnemies());
    52.     }
    53.  
    54.     public void AddEnemyToList(Enemy script)
    55.     {
    56.         enemies.Add (script);
    57.     }
    58.  
    59.     IEnumerator MoveEnemies()
    60.     {
    61.         enemiesMoving = true;
    62.         yield return new WaitForSeconds(turnDelay);
    63.         if (enemies.Count == 0)
    64.         {
    65.             yield return new WaitForSeconds(turnDelay);
    66.         }
    67.  
    68.         for (int i = 0; i < enemies.Count; i++)
    69.         {
    70.             enemies[i].MoveEnemy();
    71.             yield return new WaitForSeconds(enemies[i].moveTime);
    72.         }
    73.  
    74.         playersTurn = true;
    75.         enemiesMoving = false;
    76.     }
    77. }
    78.  
    Thanks in advanced!
     
    Last edited: May 31, 2015
  19. pvqr

    pvqr

    Joined:
    Apr 27, 2015
    Posts:
    38
    Your problem seems to be the layers. Check if the prefabs are in the correct layers at the top of your inspector, near the tags. Your colliders should be fine after that.

    The touchOrigin shouldn't affect your game, it's just a warning of a variable that it's not being used for anything.
     
  20. j03d4d

    j03d4d

    Joined:
    Oct 4, 2013
    Posts:
    21
    Hmmm . . . The wall tiles, player, enemy1, and enemy2 prefabs are all in the blocking layer . . .

    I also noticed the 'sorting layer' for the wall prefabs is 'item' but player and enemy is 'unit'. Is this correct or should the wall prefabs also be 'unit'?
     
  21. Hedeag

    Hedeag

    Joined:
    Feb 10, 2015
    Posts:
    29
    @Pirizao
    Firstly, I'd like to thank you for an idea of random level generation. I've already done it.

    Secondly, about the weapon:
    I want to make several types of weapons in the game, such as a knife and club with indicators of dps and quanttiy, and switching between them.
     
  22. crunchyoverseas

    crunchyoverseas

    Joined:
    Nov 27, 2013
    Posts:
    29
    Really like the tutorial Matthew, just adding my +1!
     
  23. MrToad

    MrToad

    Joined:
    May 22, 2015
    Posts:
    2
    I'm trying to use OnTriggerExit2D function, but it's never called...
    Is it because BoxCollider2D is disabled on Move() ? Is there a way to fix this ?
     
  24. pvqr

    pvqr

    Joined:
    Apr 27, 2015
    Posts:
    38
    It's correct, the wall should be 'item' sorting layer.
    Can you please check if your player's BoxCollider2D is activated while the game is running? Just hit play and check it on the inspector. Also check the colliders of your walls/items.
    If we don't find an issue there, I think it will be time to start digging your code for some answers.
     
  25. pvqr

    pvqr

    Joined:
    Apr 27, 2015
    Posts:
    38
    I'm glad it worked.

    Well, there are several ways you could do that. One approach is to create a weapon class with all those attributes and then add some code on the player script to be able to use them.
    Your weapon class would have like
    Code (csharp):
    1.  
    2. public int damage;
    3. public int quantity;
    4.  
    Those variables you would set individually for each weapon on your inspector and then make a prefab.
    After that you could make some kind of inventory in your player's script.
    Code (csharp):
    1.  
    2. private List<Weapons> inventory = new List<Weapons>();
    3.  
    Then add them to the inventory on pick up. After that you could make a function to check which weapon is equiped and then modify the attack value of your player.

    I just wrote this from the top of my head, it might have some issues, but I think it's a good start.
     
  26. pvqr

    pvqr

    Joined:
    Apr 27, 2015
    Posts:
    38
    Guys, I finished the tutorial a while ago and made some modifications like level modifiers, inventory, items, restart, score system, UI...
    It's a pretty interesting game using the mechanics of this tutorial. If you guys want maybe I could try to clean the code and share with you all. The current code is a bit messy.. but it should help some of you.
     
    Choibedal likes this.
  27. Levviwolf

    Levviwolf

    Joined:
    Jun 2, 2015
    Posts:
    2
    @Matthew Schell Great tutorial, thank you! I finished it without any major errors, but I have a bug in my version that I can't seem to iron out. The player collides with the Food, Soda, and Exit by being next to them, not on top of them. Items are collected in all adjacent squares, and the exit is reached upon entering any of the squares that border it. If there are items next to each other, they are usually collected simultaneously. I have looked at my MovingObject.cs and Player.cs scripts because I think it's a 2D collider issue, but so far my code seems to match yours. Do you have any idea what might cause this, and what I might look for to correct it?
     
  28. Choibedal

    Choibedal

    Joined:
    Jun 2, 2015
    Posts:
    1
    @Levviwolf Did you check that your player's Box Collider 2D size is 0.9(X) and 0.9(Y) ? It's in the early videos, ut can't remember which :(

    @Pirizao I'd definitely take this, might be really useful !
     
    Levviwolf likes this.
  29. pvqr

    pvqr

    Joined:
    Apr 27, 2015
    Posts:
    38
    @Levviwolf Check your 2D colliders size, as @Choibedal said.
    The player should have a smaller collider so you don't trigger things before you get to them, like it's happening to you. But if that is the problem, if you move closer to a wall, you probably should get stuck, is this happening too?

    @Choibedal Ok then, give me a few days to sort it out and I'll post a link here.
     
    Levviwolf likes this.
  30. Levviwolf

    Levviwolf

    Joined:
    Jun 2, 2015
    Posts:
    2
    @Choibedal @Pirizao that is exactly what happened. I had altered the size of the wrong 2Dcollider. Thank you both for your help :)
     
  31. hitgamevg

    hitgamevg

    Joined:
    Jun 3, 2015
    Posts:
    15
    @Matthew Schell Superb tutorial. I learned a lot from this. Thanks! Just have one query. I got it to work on Android phones - Moto X and Sony Xperia Z3. However, on both, in Portrait mode, the game view is cut off from the sides. So you don't see the player or the outer wall tiles. When I rotate to landscape, all is visible, but the game does not cover the whole screen and appears in a small square in the middle of the screen. Any thoughts?
     
  32. pwnsdisease

    pwnsdisease

    Joined:
    May 27, 2015
    Posts:
    5
    I am on lesson 5 of the tutorial. About 25 seconds into it I run into a weird snag. First thing that happens is I am told to open the Game Manager script that I created in the previous video. I expect to get an empty script when instead I get a Game Manager script that is completely finished. The script in the video is empty but mine is not. I attempt to move ahead anyway and Unity starts to tell give me compiler errors. I make the conclusion that it is because I have a completed script that references other scripts that I haven't written yet so I empty the script so I can follow the tutorial more closely. I then replicate the script exactly as it is given to me in the video between :25 and 1:18 and try to proceed. When I do this I get another compiler error stating error CS0117: 'GameManager' does not contain a definition for 'instance'.

    I observe my Game Manager script and nothing appears to be wrong. It is EXACTLY as it appears in the tutorial. I can watch the tutor in the video test the script but I can not.

    Just so you can see it, this is my Game Manager script:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class GameManager : MonoBehaviour
    5. {
    6.  
    7.     public BoardManager boardScript;
    8.  
    9.  
    10.     private int level = 3;
    11.  
    12.  
    13.     void Awake ()
    14.     {
    15.         boardScript = GetComponent<BoardManager>();
    16.         InitGame();
    17.     }
    18.  
    19.     void InitGame()
    20.     {
    21.         boardScript.SetupScene(level);
    22.     }
    23.  
    24.     void Update ()
    25.     {
    26.  
    27.     }
    28. }
    29.  
    Any help is appreciated. Thanks in advance.
     
  33. pvqr

    pvqr

    Joined:
    Apr 27, 2015
    Posts:
    38
    Inside the assets you downloaded there is a folder containing all the complete scripts. Try removing this folder from inside your project, it might be confusing the Unity Editor. Remove the whole folder just to be sure it won't happen again and give it a try.
     
  34. RetroGamer28

    RetroGamer28

    Joined:
    Apr 28, 2015
    Posts:
    7
    I checked line 100 in the board manager script and there is nothing typed there at all. I will post the script:

    From line 1 to line 100:

    "using UnityEngine;
    using System;
    using System.Collections.Generic;
    using Random = UnityEngine.Random;

    public class BoardManager : MonoBehaviour
    {
    [Serializable]
    public class Count
    {
    public int minimum;
    public int maximum;

    public Count (int min, int max)
    {
    minimum = min;
    maximum = max;
    }
    }

    public int columns = 8;
    public int rows = 8;
    public Count wallCount = new Count (5, 9);
    public Count foodCount = new Count (1, 5);
    public GameObject exit;
    public GameObject[] floorTiles;
    public GameObject[] wallTiles;
    public GameObject[] foodTiles;
    public GameObject[] enemyTiles;
    public GameObject[] outerWallTiles;

    private Transform boardHolder;
    private List <Vector3> gridPositions = new List<Vector3>();

    void InitialiseList()
    {
    gridPositions.Clear();

    for (int x = 1; x < columns - 1; x++)
    {
    for (int y = 1; y < rows - 1; y++)
    {
    gridPositions.Add(new Vector3(x,y,0f));
    }
    }
    }


    void BoardSetup()
    {
    boardHolder = new GameObject {"Board"}.transform;

    for (int x = -1; x < columns + 1; x++)
    {
    for (int y = -1; y < rows + 1; y++)
    {
    GameObject toInstantiate = floorTiles[Random.Range (0,floorTiles.Length)];
    if (x == -1 || x == columns || y == -1 || y == rows)
    toInstantiate = outerWallTiles[Random.Range (0,outerWallTiles.Length)];

    GameObject instance = Instantiate(toInstantiate, new Vector3 (x,y,0f), Quaternion.identity) as GameObject;

    instance.transform.SetParent(boardHolder);
    }
    }
    }

    Vector3 RandomPosition()
    {
    int randomIndex = Random.Range(0, gridPositions.Count);
    Vector3 randomPosition = gridPositions[randomIndex];
    gridPositions.RemoveAt(randomIndex);
    return randomPosition;
    }

    void LayoutObjectAtRandom(GameObject[] tileArray, int minimum, int maximum)
    {
    int objectCount = Random.Range (minimum, maximum + 1);

    for (int i = 0; i < objectCount; i++)
    {
    Vector3 randomPosition = RandomPosition();
    GameObject tileChoice = tileArray[Random.Range (0, tileArray.Length)];
    Instantiate (tileChoice, randomPosition, Quaternion.identity);
    }
    }

    public void SetupScene(int level)
    {
    BoardSetup();
    InitialiseList();
    LayoutObjectAtRandom(wallTiles, wallCount.minimum, wallCount.maximum);
    LayoutObjectAtRandom(foodTiles, foodCount.minimum, foodCount.maximum);
    int enemyCount = (int)Mathf.Log(Level,2f);
    LayoutObjectAtRandom(enemyTiles, enemyCount, enemyCount);
    Instantiate(exit, new Vector3(columns - 1, rows -1, 0f), Quaternion.identity);"


    This is how the original told me to type the board manager up. Sorry about not added a coding tag and I couldn't find them.
     
  35. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Please learn to format your code:
    http://forum.unity3d.com/threads/using-code-tags-properly.143875/
     
  36. Matthew-Schell

    Matthew-Schell

    Joined:
    Oct 1, 2014
    Posts:
    238
    hey @j03d4d the sorting layer is for what order sprites are drawn in so won't be relevant for physics which is where the issue seems to be.

    Do the player and enemy prefabs have a Rigidbody 2D attached that's set to isKinematic? Double check that it's not a Rigidbody (intended for 3d). I would double check them side by side against the prefabs in the Completed folder.

    I don't THINK it's a scripting issue, I assume it's something with the prefabs.
     
  37. Matthew-Schell

    Matthew-Schell

    Joined:
    Oct 1, 2014
    Posts:
    238
    Can you give more info? The collider gets disabled and re-enabled before moving so I don't think that's it. What are you trying to trigger OnTriggerExit2D?
     
  38. Matthew-Schell

    Matthew-Schell

    Joined:
    Oct 1, 2014
    Posts:
    238
    There isn't anything in the project that addresses device orientation so this is something you'd need to script yourself. Take a look at http://docs.unity3d.com/ScriptReference/Screen-orientation.html That should give you a good starting point.
     
  39. Matthew-Schell

    Matthew-Schell

    Joined:
    Oct 1, 2014
    Posts:
    238
    @crunchyoverseas thank you! I appreciate the kind feedback.
     
  40. Matthew-Schell

    Matthew-Schell

    Joined:
    Oct 1, 2014
    Posts:
    238
    As @Pirizao points out you probably opened the Completed folder which is intended as a reference, not for you to work from. Moving that folder out of the project is a good step. You should make a new Scripts folder in the top level folder of your project. Make sure there are not two copies of the script GameManager in your project that share the same namespace. The one in Completed should be in the Completed namespace, it may be that you deleted that line.
     
  41. pvqr

    pvqr

    Joined:
    Apr 27, 2015
    Posts:
    38
    @Matthew Schell Matthew, is it okay if I post my modified scripts and the modified game version here? I uploaded the game at GameJolt page and scripts on my github. I'll wait for your answer before posting the links.
    There is a link to your tutorial on the game page as credits.
     
  42. Matthew-Schell

    Matthew-Schell

    Joined:
    Oct 1, 2014
    Posts:
    238
    Yeah please do! Go for it, interested to see what you did. And thanks for helping answer questions in the thread.
     
  43. pvqr

    pvqr

    Joined:
    Apr 27, 2015
    Posts:
    38
    Okay, so here we go. This is what I made out of this tutorial, it might not be the most optmized version and the code gets a little messy sometimes, but feel free to ask me any questions about it.

    The game: http://gamejolt.com/games/arcade/roguaholic-a-simple-2d-roguelike/65133/
    My scripts: https://github.com/Pedr0Rocha/Roguaholic

    Keep in mind that I can't find the original owner of the sprites, so.. credits to the unkown person who did Dungeon Crawl Stone Soup sprites.

    @Matthew Schell No problem, I absolutely loved your tutorial and after making another game out of it, the code became very familiar to me so I can answer and solve some basic problems related to it. Glad I'm able to help.
     
  44. Verden1

    Verden1

    Joined:
    Jun 4, 2015
    Posts:
    1
    Hello everyone,

    I just finished watching tutorial 11, and it seems like I can move ONCE ONLY, either up or right.

    I have tried to paste completed code, reading forums, YouTube comments and found that other people have this issue too, so I was wondering has anyone actually solved it?
     
  45. pvqr

    pvqr

    Joined:
    Apr 27, 2015
    Posts:
    38
    Don't worry, keep watching the tutorial. This issue is probably because your turn functions are not complete yet, so there is only 1 turn. If the problem isn't fixed in the next videos, then we start digging your code.
     
  46. MurDoK722

    MurDoK722

    Joined:
    Jun 9, 2015
    Posts:
    15
    Hi Matthew, first off I would like to say I love your work! as an aspiring game designer I have been studying hard on the unity tutorials and any documentation I can as well as going to college for a Game Design Bachelors of Science degree.

    Okay, I have a few issues. First off I just completed the Audio and Sound Manager video and all sounds are working properly. however, my Player takes one step and dies. There are no compiler errors or anything of that nature. I am really unsure of what happened. Before this issue, I also experienced an issue with the Exit. As in the Exit did not work and my Player could not progress to Day 2 and so on.
    If you could please get back to me as soon as you can I would greatly Appreciate it. I love everything to do with Unity and would like to finish the tutorials then start freelancing some games soon :)

    Thank you for your time,
    Free Kunce
     
  47. pvqr

    pvqr

    Joined:
    Apr 27, 2015
    Posts:
    38
    @MurDoK722
    Can I see your player's AttemptMove method? We can start searching for the issue from there.
     
  48. MurDoK722

    MurDoK722

    Joined:
    Jun 9, 2015
    Posts:
    15
    Here is my AttemptMove. I tried following the tutorials to the T. I am just trying to learn the basics before I try and take it a step further. However, there are no compiler errors and I went through some of the code but I know I am missing something...
     

    Attached Files:

  49. pvqr

    pvqr

    Joined:
    Apr 27, 2015
    Posts:
    38
    So the problem it not there. Check something for me, is the player health set to 100? Check the scripts and in the inspector too.
     
  50. MurDoK722

    MurDoK722

    Joined:
    Jun 9, 2015
    Posts:
    15
    In GameManager, my public int playerFoodPoints = 100. Is this what you mean? and Under Player I don't see it in the inspector. However, in GameManager the Player Food Points = 100.
     
Thread Status:
Not open for further replies.