Simple Camera Shake 2D | INFINITE RUNNER game like CANABALT #9 | UNITY TUTORIAL

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ธ.ค. 2024

ความคิดเห็น • 52

  • @superjustin5000
    @superjustin5000  2 ปีที่แล้ว +2

    My apologies, it seems during the encoding process, the audio and video got slowly out of sync the further you are in the video. Doesn't seem to be too bad though. Also JUST updated the project files link to include this one.

    • @Deathzuki.
      @Deathzuki. ปีที่แล้ว

      Great series. How do you make the same jump system but with touch control that you click on the screen or you hold the screen for jumping?

    • @art3misj260
      @art3misj260 ปีที่แล้ว

      @@Deathzuki. I have the same problem i need the player to jump when touched the screen but it cant because the jump is on spacebar. I thought deleting the line in the player script where it says if input key spacebar but i dont know it doesnt work. i cant find a solution for this

    • @art3misj260
      @art3misj260 ปีที่แล้ว

      @superjustin5000 do we need another script for that or must be there made changes in the player script for making the player jump on touchscreen ( or hold the touchscreen for bigger jump)???

    • @mikimiyagui9269
      @mikimiyagui9269 ปีที่แล้ว +2

      @@art3misj260 just change the GetKey for a GetButtonDown("Fire1")

    • @Deathzuki.
      @Deathzuki. ปีที่แล้ว +1

      @@mikimiyagui9269 i did that but then the player jumps only on click, like if you hold the screen he wont jump further

  • @BlackIce420
    @BlackIce420 2 ปีที่แล้ว

    i completed the entire series. its pretty sweet so far. thank you for being helpful, clear easy to understand. good lookin out yo.

    • @superjustin5000
      @superjustin5000  2 ปีที่แล้ว

      Nice work, happy to hear that, and hope you're able to make something awesome! Thanks.

  • @Deathzuki.
    @Deathzuki. ปีที่แล้ว +3

    Thanks a lot for the tutorials, Im learning many things I didnt know and it helps a lot. I actually had a question. How do you add coins ( like you did with the obstacles ) so that they randomly spawn on the ground. Not like the obstacles that you have to avoid them but actually collect the coins that are randomly spawning so they dont decrease your move speed. Maybe with a counter of collected coins. The idea was you play again and again dying but collecting coins that are randomly spawned and also by making a shop ( like for skins or buffs) you can waste your money/coins you collected from the previous attempts. That would give the game a little more potential and it would give the game more sense to spend more time playing it and Im sure this would help a lot for people who are also looking for something like this. Maybe you could explain it to me or make another tutorial, but anyways I would be very grateful for everything.

    • @superjustin5000
      @superjustin5000  ปีที่แล้ว +1

      Sure thing. It shouldn't be too much heavy lifting, and a lot of what you need can be copied from what you have. Like you said, the obstacles randomly generate, so creating something similar would represent the coin. You can check the type in the OnTriggerEnter function, and distinguish between obstacle vs coin. The UI text is already there for distance, so something similar for coins. The only thing left is to track the count of how many you've collected.

    • @Deathzuki.
      @Deathzuki. ปีที่แล้ว

      @@superjustin5000 Seems makeable. The thing is I'm new to unity so I needed some help and your opinion. Alright, thanks for sharing and the time you wasted to answer me, I will try this but not sure if I can do it xD Anyways I'll give it a try, thanks a lot.

  • @nerseus
    @nerseus ปีที่แล้ว +1

    Great series - very helpful explanations! I especially love the parallax and the technique/math for introducing new buildings/obstacles.
    I do have a question about a bug I've noticed. In play testing there's a bug related to ray detection. Frequently, when landing after a jump on top of a "collapsing" building - the code doesn't trigger the "isGrounded" correctly - and the player falls through the middle of the building. Similarly (I think) when the player starts going a decent speed/velocity they occasionally pass through an obstacle without it trigging a hit. These seem more fundamental to the ray cast implementation for hit detection and the ray not being "long" enough to detect a hit in some cases?
    I haven't attempted a solution yet. I'm thinking it would involve testing with more interpolation of where we predict the player might be next frame, to see if we'd pass over an obstacle or into a building, etc. That is - create the length of the ray based on that "next" position? I'm wondering if keeping the ray cast solution is worth it, or abandoning that in favor of (as you suggested on another comment) using rigidbodies with kinematic/continuous hit detection.
    If you see this comment I'd be curious about your thoughts on continuing with the raycast checks, especially knowing the speed of the player is important and the time between frames, given a potentially slow mobile device, might be pretty jumpy? I'm thinking "will I run into more bugs related to missed ray cast checks" that will need addressing later, and would using another method of collision detection be more future-proof?

    • @superjustin5000
      @superjustin5000  ปีที่แล้ว +1

      Hey thanks!
      Funny enough I was just running into a similar issue in my other project, so thanks for bringing it up. The raycast should work similarly to a continuous collider collision check so you can try that too, but I think it's because the position and velocity are incremented before the actual raycast check is happening, so the raycast is a frame off / ahead.
      Try to first save the previous position into a variable before advancing it by velocity and use the previous position when calculating the raycast origin.
      OR.. just do the raycast checking earlier and do the updates of position and velocity later, or at the end of the update or something.
      If that's not entirely the reason this issue is presenting itself, it's at least partly responsible.

    • @sdkontheblock
      @sdkontheblock 8 หลายเดือนก่อน

      @@superjustin5000 Hi, I just solved the problem mentioned above. There were two problems. The first one is that you mentioned from above reply (plus a little bit of floating point error), and the second one was from GroundFall.cs. There's part that if the ground is falling, player position and groundheight of the decremented with fall speed, even when isGround is not true. So after I added if statement about isGround, the problem's been solved. Hope this comment helps those who have the same problem!
      Thanks for the video!

  • @zaprodaju1661
    @zaprodaju1661 7 หลายเดือนก่อน

    This all good for the beginning. However the platform generator depends on a single object which must be instantiated within the bounds of a screen in order for it to be generated again and again. Not sure if the math will work once you randomize the length of platforms!? For example, Canabalt has many running platform objects, some of them stretching 2 or even 3 sizes of screen.
    I do love how you handled acceleration, and reference to the jump height in relation to platforms etc.., but this solution has a constant predictive rhythm for the entire duration of gameplay time.
    Why didn't you decide to pull the objects from the array?

  • @jarus4903
    @jarus4903 2 ปีที่แล้ว

    Wow such a beautiful tutorial series I would definitely try to make a game based on your base thanks

    • @superjustin5000
      @superjustin5000  2 ปีที่แล้ว +1

      Do it! Send updates. Thanks for the kind words. 🍻

  • @la_prima
    @la_prima 2 ปีที่แล้ว +1

    Thank you very much man!

  • @dailymuseum
    @dailymuseum 2 ปีที่แล้ว

    Very good, thanks for the video series

    • @dailymuseum
      @dailymuseum 2 ปีที่แล้ว

      The only thing is, the buildings are get destroyed before they are out from the screen, should be easy to fix though

    • @dailymuseum
      @dailymuseum 2 ปีที่แล้ว

      Sometimes, the player still suddenly falls when the ground is falling

  • @rohitnangare1655
    @rohitnangare1655 2 ปีที่แล้ว

    Thank you so much such ... Cant express in words 😁

    • @superjustin5000
      @superjustin5000  2 ปีที่แล้ว

      I think you just did 🤔

    • @rohitnangare1655
      @rohitnangare1655 2 ปีที่แล้ว

      @@superjustin5000 but you got my feelings right? That's what I mean...

  • @anthonylewis3804
    @anthonylewis3804 2 ปีที่แล้ว

    Nice video keep it up!

  • @SgtMacKerZ
    @SgtMacKerZ 2 ปีที่แล้ว +1

    Nice tutorials. I have a question please. This appears to work well on PC. But not so well on Android. You can seemingly hit ground and stop and fall through it for some reason. Is it somehow a timing issue on the FPS and the code? Pc Vs Mobile device perhaps? Thanks for any thoughts.

    • @superjustin5000
      @superjustin5000  2 ปีที่แล้ว +1

      That's what it seems like, however the the collision check is happening in fixedUpdate so the delta time should be consistent. I guess if the underlying unity physics simulation is running slow it could be a factor. One thing worth checking is that, all objects that have rigidbodies (which might only be the player), make sure the type is kinematic, and that the collision detection is set to 'continuous' and not 'discrete'. Let me know if you solve it.

    • @SgtMacKerZ
      @SgtMacKerZ 2 ปีที่แล้ว +1

      @@superjustin5000 Thanks for the reply. I will check that out and let you know. Cheers.

  • @jarus4903
    @jarus4903 2 ปีที่แล้ว +1

    How can we generate different types of buildings? Do we need to create array of game objects and randomize it?

    • @superjustin5000
      @superjustin5000  2 ปีที่แล้ว +1

      Yes that's for sure a good way to do it

  • @art3misj260
    @art3misj260 ปีที่แล้ว

    I did this for android and i have the issue that on phones is no spacebar but the jump is only called when pressed spacebar. How do you make the player jump on touchscreen? Please answer it would be veryyyy helpful.

    • @superjustin5000
      @superjustin5000  ปีที่แล้ว

      Sorry to get back to you so late, but it's always a good idea to check out the unity documentation, here's one relating to getting touch input : docs.unity3d.com/ScriptReference/Input.GetTouch.html

  • @allthetime7985
    @allthetime7985 2 ปีที่แล้ว

    I have some issues in player distance display ing

    • @superjustin5000
      @superjustin5000  2 ปีที่แล้ว

      I'll definitely need to know more information. Or you can send me your project.

  • @BerdloMLBB
    @BerdloMLBB 2 ปีที่แล้ว

    Put some animations pls we are here to learn 👍

    • @superjustin5000
      @superjustin5000  2 ปีที่แล้ว +1

      This could be a future video 🤔

    • @dailymuseum
      @dailymuseum 2 ปีที่แล้ว

      Plus one for this

  • @pock3t-f3t
    @pock3t-f3t 2 ปีที่แล้ว

    Hi there. Love this series. I know its kinda ended long time ago, but I have a question. Probably its just me missing something, but I have a critical gameplay bug in my version of the game from this tutorial. I can jump in the air non-stop using a ground threshold mechanic. If I press space just in right moment I can catch that treshold, even if there is no ground under player. Thats cause ground height updates only by touching platforms. I wonder do you have that bug too, or is it me missing some part of some video? Thanks :)

    • @superjustin5000
      @superjustin5000  2 ปีที่แล้ว +1

      Honestly my version probably has it as well. It has been a while since I looked at the code, but your explanation sounds very convincing and likely that there is a bug there. You can download my project from the ko-fi link and test it out yourself. Otherwise you can do something where, as soon as the player leaves the platform (their position is past the right edge) then set their ground height to some very low value like -100 or something.
      Thanks!