Forum begins after the advertisement:


[Part4] The game freeze when Player dash the Enemy

Home Forums Video Game Tutorial Series Creating a Metroidvania in Unity [Part4] The game freeze when Player dash the Enemy

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #17435
    32 Siti fajrin maulidiya
    Level 1
    Participant
    Helpful?
    Up
    0
    ::
    View post on imgur.com

    The Game is freeze when Player dash to the Enemy and why are there so many heart container in the hierarchy?

    #17436
    Ser Apustaja
    Level 5
    AI Assistant
    (BETA)
    Helpful?
    Up
    0
    ::

    It seems like you’re experiencing a couple of issues with your game. Let’s address them one by one.

    1. Game Freezing When Player Dashes to Enemy:

      • This could be due to an error in your collision detection or handling when the player dashes into the enemy. Here are a few things you can check:
        • Make sure that the dash function is not causing an infinite loop or recursive calls that lead to freezing.
        • Check if there are any exceptions being thrown in the console when the dash action occurs. These could give you clues about what’s going wrong.
        • Review the collision logic between the player and enemies. Ensure that the physics settings and colliders are correctly set up to handle what happens during a dash.
    2. Many Heart Containers in the Hierarchy:

      • If you’re seeing multiple heart containers, it could be that they are being instantiated every time the game starts or when the player collects a heart. Here are some suggestions to fix this:
        • Check your code to see if you are accidentally instantiating new heart containers each time an event occurs (like starting the game or collecting a heart).
        • If you’re using a prefab for heart containers, ensure that you are managing them properly. You might want to implement a check to only add a new heart if one doesn’t already exist in the hierarchy.
        • Consider using a pool system for your heart containers if they are meant to be reused.

    If you can provide more details about the code related to the dash mechanics and how you’re managing the heart containers, I could give you more specific advice!

    #17440
    Terence
    Level 30
    Keymaster
    Helpful?
    Up
    0
    ::

    How many heart containers do you have when the game is not in play mode?

    #17474
    32 Siti fajrin maulidiya
    Level 1
    Participant
    Helpful?
    Up
    0
    ::

    there is no heart container when the game is not in play mode.

    and can you tell me the message I have is because I miss something in your video? why the restore time value is never use?

    #17475
    Ser Apustaja
    Level 5
    AI Assistant
    (BETA)
    Helpful?
    Up
    0
    ::

    It seems like you’re facing an issue with a game where heart containers are not displayed when the game is not in play mode, and you’re also confused about the restore time value not being used. Let’s break this down and see how we can help you troubleshoot the issue.

    1. Heart Container Visibility:

      • Ensure that the heart containers are set to be displayed in the UI regardless of the game mode. Check the code where the UI elements are initialized or rendered. You may need to add a condition to display the heart containers even when not in play mode.

      Example (pseudo-code):

      if (!game.isInPlayMode) {
          displayHeartContainers();
      }
    2. Restore Time Value:

      • If the restore time value is not being used, look into the logic that dictates when and how this value should be applied. Make sure that there is a function or method that utilizes this value during gameplay.

      Example (pseudo-code):

      function restoreHealth() {
          if (restoreTime > 0) {
              // Logic to restore health over time
          }
      }
    3. Debugging:

      • Use console logs or debugging tools to trace the flow of your game logic. Check if the relevant conditions for displaying heart containers and applying restore time are being met.
    4. Reference to Video:

      • If you are following a tutorial video, revisit the parts where the UI is set up and where the game logic is implemented. Ensure that you haven’t missed any critical steps or code snippets that could affect the heart container display and restore time functionality.

    If you can provide more specific code snippets or context, I can assist further in pinpointing the exact issue.

    #17511
    Terence
    Level 30
    Keymaster
    Helpful?
    Up
    0
    ::

    @32sitifajrinmaulidiya the screenshot that you’ve uploaded onto Imgur is invalid. Can you post the screenshot again?

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: