i'm happy to see that you are basing this off of things learned from Game Dev Experiments! Excellent coding foundation as he follows good practices. It would have been nice to see you update what he did years ago with more modern concepts though... Input system comes to mind immediately and its very simple to convert to.
Hi @jimchilluffo433 I am new to unity. What other modern concepts do you recommend using / what resource do you use to learn about modern concepts (youtube channels etc) ? Thanks
@@eduardoz7665 git-amend has some pretty good pattern explanations as does One Wheel Studio. Other than that, you just need to start small... like re-make an old atari or nintendo game. (NES and Atari 2600) old simple stuff...
1-) Can you tell us how you set up the colliders for the lamps and the house? If we use the Tilemap Collider 2D, then the boundaries for the collision are automatically set and are not editable. The collision boundaries for the lamps and the house both fully cover the respective objects and so the character can't walk behind them. 2-) I couldn't figure out the solution to the Tilemap Collider 2D so I removed it and all the other objects and only placed a lamp in the Foreground sorting layer with the SolidObjects layer. Gave it a Box Collider 2D, edited the collision boundary to place it at the bottom of the lamp so that the player could walk behind the lamp. However, when the character goes behind the lamp, the character still appears infront of it. What's the problem here?
I changed things up a bit and have this as a base to work with... No ChallengerController but an extended NPCController called HostileNPCController public class NPCController : MonoBehaviour, Interactable { public virtual void Interact() { throw new System.NotImplementedException(); } } public class HostileNPCController : NPCController { public override void Interact() { //base.Interact(); May not want to use base interact also } } Cheers!
Very nice video! But not sure why you made one sprite's RigidBody Kinematic and the other's as Static. They both seem to prevent them from falling. What's the difference?
This tutorials are really god for understanding of some fundamental programming concepts. Also I have one question. Could we create parent class that will have this Rigid2D physics and then extend that class to create Player, NPC, Challenger, Merchant etc? That parent class could also implement other identical behaviour that all child classes would have.
Hi, I a, using new input system and box collider for interaction and i got a problem with interact function . Help last line of code code using System.Collections; using System.Collections.Generic; using Unity.VisualScripting; using UnityEngine; using UnityEngine.InputSystem; public class PlayerMovement : MonoBehaviour { [SerializeField] bool canMove = true; [SerializeField] int movementSpeed = 10; Vector2 onMoveVector; Rigidbody2D myRigidbody; Animator animator; BoxCollider2D myBoxCollider; float movX, movY=0; private void Awake() { myRigidbody = GetComponent(); animator = GetComponent(); myBoxCollider = GetComponent(); } private void Update() { Movement(); } private void OnMove(InputValue value) { onMoveVector = value.Get(); } void OnInteraction(InputValue value) { if (value.isPressed) { Interact(); } } private void Movement() {
if (canMove) { movX = onMoveVector.x; movY = onMoveVector.y; if (onMoveVector.x != 0) { animator.SetBool("isRunning", true); myRigidbody.velocity = new Vector2(onMoveVector.x * movementSpeed, 0); AnimatorMovement(); } else if (onMoveVector.x == 0) { animator.SetBool("isRunning",true); myRigidbody.velocity = new Vector2(0, onMoveVector.y * movementSpeed); if (onMoveVector.y != 0) { AnimatorMovement(); } } } if (myRigidbody.velocity.magnitude == 0) { animator.SetBool("isRunning", false); } } void AnimatorMovement() { animator.SetFloat("idleX", movX); animator.SetFloat("idleY", movY); } void Interact() { if (myBoxCollider.IsTouchingLayers(LayerMask.GetMask("interactable"))) { myBoxCollider.GetComponent()?.Interact(); } } }
I spent the day watching your videos and I have to say great job. I am not a programmer or developer but I can follow along nicely. Thank you!
I'm following this tutorial series, just wanted to tell you this has been really helpful and easy to understand! thank you for making this!
I've been following this series, and the mic upgrade is huge. Thanks for that
bro i follow finished but not work dont show You will walk to this NPC
Very good video. Thanks for that. The mic is much better! Look forward for the next tutorial.
Tha k you @gamedakos ! This makes me so happy
How was this video? Thanks for all the support! Join my discord community discord.gg/tVx4waqCPT
Great video. Very understandable with all the theory!
Glad you enjoyed it!
i'm happy to see that you are basing this off of things learned from Game Dev Experiments! Excellent coding foundation as he follows good practices. It would have been nice to see you update what he did years ago with more modern concepts though... Input system comes to mind immediately and its very simple to convert to.
Yes! Gave dev experiments is my inspiration! I wanted to do my own take for people that don’t have strong coding experience
Hi @jimchilluffo433 I am new to unity. What other modern concepts do you recommend using / what resource do you use to learn about modern concepts (youtube channels etc) ? Thanks
@@eduardoz7665 git-amend has some pretty good pattern explanations as does One Wheel Studio. Other than that, you just need to start small... like re-make an old atari or nintendo game. (NES and Atari 2600) old simple stuff...
I love your video
Thanks alot 👍🏽
Thank you very much! @softchipz , this makes my day!
I l-love this video so much! thank you teacher!
love the videos
1-) Can you tell us how you set up the colliders for the lamps and the house? If we use the Tilemap Collider 2D, then the boundaries for the collision are automatically set and are not editable. The collision boundaries for the lamps and the house both fully cover the respective objects and so the character can't walk behind them.
2-) I couldn't figure out the solution to the Tilemap Collider 2D so I removed it and all the other objects and only placed a lamp in the Foreground sorting layer with the SolidObjects layer. Gave it a Box Collider 2D, edited the collision boundary to place it at the bottom of the lamp so that the player could walk behind the lamp. However, when the character goes behind the lamp, the character still appears infront of it. What's the problem here?
yes have same problem
@@lorale8095 Search for "Unity sorting layers"
I changed things up a bit and have this as a base to work with... No ChallengerController but an extended NPCController called HostileNPCController
public class NPCController : MonoBehaviour, Interactable
{
public virtual void Interact()
{
throw new System.NotImplementedException();
}
}
public class HostileNPCController : NPCController
{
public override void Interact()
{
//base.Interact(); May not want to use base interact also
}
}
Cheers!
That sneaky little Britney Spears reference... toxic!
great work! illustrate how interface work clear than my java book😂I found learning something is also about the intention and motivation.
i follow finished but not work dont show You will walk to this NPC can help?
Very nice video! But not sure why you made one sprite's RigidBody Kinematic and the other's as Static. They both seem to prevent them from falling. What's the difference?
This tutorials are really god for understanding of some fundamental programming concepts. Also I have one question. Could we create parent class that will have this Rigid2D physics and then extend that class to create Player, NPC, Challenger, Merchant etc? That parent class could also implement other identical behaviour that all child classes would have.
For some reason Z is not working for me so I used ,,I“ to Interact and it works? Is that normal?
It's Very good. Thanks for everything i'm from iran also your fan , pls don't stop recording the video and fix the voice quality😍🥰
Hi, I a, using new input system and box collider for interaction and i got a problem with interact function . Help
last line of code
code
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayerMovement : MonoBehaviour
{
[SerializeField] bool canMove = true;
[SerializeField] int movementSpeed = 10;
Vector2 onMoveVector;
Rigidbody2D myRigidbody;
Animator animator;
BoxCollider2D myBoxCollider;
float movX, movY=0;
private void Awake()
{
myRigidbody = GetComponent();
animator = GetComponent();
myBoxCollider = GetComponent();
}
private void Update()
{
Movement();
}
private void OnMove(InputValue value)
{
onMoveVector = value.Get();
}
void OnInteraction(InputValue value)
{
if (value.isPressed)
{
Interact();
}
}
private void Movement()
{
if (canMove)
{ movX = onMoveVector.x;
movY = onMoveVector.y;
if (onMoveVector.x != 0)
{
animator.SetBool("isRunning", true);
myRigidbody.velocity = new Vector2(onMoveVector.x * movementSpeed, 0);
AnimatorMovement();
}
else if (onMoveVector.x == 0)
{
animator.SetBool("isRunning",true);
myRigidbody.velocity = new Vector2(0, onMoveVector.y * movementSpeed);
if (onMoveVector.y != 0)
{
AnimatorMovement();
}
}
}
if (myRigidbody.velocity.magnitude == 0)
{
animator.SetBool("isRunning", false);
}
}
void AnimatorMovement()
{
animator.SetFloat("idleX", movX);
animator.SetFloat("idleY", movY);
}
void Interact()
{
if (myBoxCollider.IsTouchingLayers(LayerMask.GetMask("interactable")))
{
myBoxCollider.GetComponent()?.Interact();
}
}
}
Hello! What is the error that you are getting?
@@epicgdev Solved it
@@AryanSingh-cw6ce so happy to hear this!!! Good Job!!
you can join my discord community to ask for help
@@AryanSingh-cw6ce discord.gg/tVx4waqCPT