Adding the Game Mechanics to my 3D Puzzle Game [episode 2]

Поділитися
Вставка
  • Опубліковано 21 вер 2024
  • I’m this video I added the game mechanics into the 3d puzzle game I’m making in the unity game engine.
    After I got in the player and made him move, I needed to add in one of his mechanics, that being walking on walls.
    Once the player can do this, I added the core mechanic, the camera gun. The camera gun can shoot cameras onto walls and from these cameras the player can do one of four things. Look around, exit the camera, shoot another camera, and teleport to the camera’s position with the gravity of the wall the camera is on.
    After this, I moved on to making the secondary mechanics. These secondary mechanics that I added in to this 3D puzzle game I’m making were: switches, buttons, pressure plates and lasers.
    Once all of those were in, I added another mechanic which replaces a bad mechanic I came up with when prototyping. This mechanic lets the player shoot a spot on the wall and then a movable object, and that object will be pulled towards the point.
    Subscribe: / @willhessgamedev
    Instagram: / will_hess_yt
    If you have any questions DM me over Instagram

КОМЕНТАРІ • 11

  • @tiagosoares9204
    @tiagosoares9204 2 роки тому +1

    Will i have watched all of your videos and it was a blast the whole time. Your big brain and personality were made for entertaining i laughed and learned something all at the same time it was great .

  • @SpikeEscape
    @SpikeEscape 2 роки тому +1

    Hey Will! Love the videos and the energy! Just watched the part about the buttons and using IDs to differentiate between them, totally fine for the scale of that project but in the future I would look up something called a c# Interface as a solution to that problem, you can think of them as an almost empty class that only contains definitions for variables and functions.
    Say I wrote an interface called IPlayerInteractable (Interfaces are usually prefaced by the letter I), it would have an empty function called: public void Interact(),
    and then on your button script you inherit the interface by saying ButtonScript : MonoBehavior, IPlayerInteractable
    and then you write the implementation of what Interact() actually does inside of the Button Script!
    So when you raycast out of the players camera and find gameobjects you would simply check if it is interactable by going:
    IPlayerInteractable interactable = hit.collider.gameObject.GetComponent(typeof(IPlayerInteractable))
    if (interactable != null) interactable.Interact();

    • @SpikeEscape
      @SpikeEscape 2 роки тому

      And then to have the button know which door to open I would just expose a Door component to the editor inside of the Button gameobject, drag and drop the door you want to open into the property in the inspector, and the Interact() function in the button would be defined as: public void Interact() { if(!door.isOpen) door.Open(); }

    • @WillHessGameDev
      @WillHessGameDev  2 роки тому +1

      First off, thank you so much for taking the time to write all this just to help me out! Very much appreciated! If I’m being honest I’m baffled with how kind helpful and thoughtful this whole message was, so thank you!
      I am conceptually aware of interfaces (meaning I know they exist, and well… that’s about it), but I never thought of using them like this. I will definitely look more into these so I can use them in other projects. I remember before I used unity and just messed around with the eclipse ide for Java, I would use abstract classes quite a bit, and I know (at least in Java) that these are similar. Never actually used them though, but I will 100% start looking into these.

    • @SpikeEscape
      @SpikeEscape 2 роки тому

      @@WillHessGameDev I've never used java actually! But the way that c# uses abstract classes is very similar to interfaces, except you can add an interface to any class regardless of inheritance and you can attach as many interfaces as you want!
      I find that interfaces are best for actions that will apply to many objects but in different ways, Player interact works well cause you could want something to happen when you look at a button but something else to happen when you click on an item on the ground,
      Or say in Zelda when you pick up a pot and hold it over your head, it's the exact same code as lifting a chicken except with a chicken you have to turn off the AI movemeny, anything you want to make the player able to carry you would just add ILiftable to the class and throw in any specific logic to your object.
      And your player script doesn't need to change at all when you add a chicken or a barrel that you hide inside of when you lift it becuse all it needs to know is "Oh this object is liftable, tell it I'm gonna lift it"

  • @somecoder6985
    @somecoder6985 2 роки тому

    Nice Job! Also the editing is sick.

  • @paulytheking7365
    @paulytheking7365 2 роки тому +1

    One mechanic you should probably make for the game is walls that cameras can’t attach to.

    • @WillHessGameDev
      @WillHessGameDev  2 роки тому +1

      I totally agree, I have the model for the uncamerable surfaces done, I just haven’t hooked it up yet, even though it’ll take less than 5 minutes lol

    • @paulytheking7365
      @paulytheking7365 2 роки тому +1

      Huh, guess you were already thinking about that. I can’t wait to see the kinds of puzzles you could make with that.