Unity 2D Platformer for Complete Beginners - #9 TRAPS

preview_player
Показать описание
In this episode we'll create 4 types of traps: simple spikes, firetraps with pressure plates, arrow traps and a spiked block similar to the crush block from Spelunky.

#pandemonium​ #unity2dplatformer​ #unitybeginner​

Tags: Unity 2D Platformer for Complete Beginners - #9 TRAPS,unity 2d platformer for complete beginners,unity 2d platformer,pandemonium games,platformer for complete beginners,unity 2d platformer episode 9,unity 2d traps,unity spelunky 2,unity 2d enemy,unity 2d firetrap,unity arrowtrap,unity 2d arrowtrap,unity 2d spikes,unity 2d pressure plate,unity 2d arrow,unity 2d platformer for complete beginners - #7 health system,unity health system,unity health,unity enemy

0:00​ Intro
0:12 Spikes
3:40 Firetrap
12:39 Arrowtrap
20:43 Inheritance
22:25 Enemy Arrows
28:23 Spikehead
37:03 Reseting The Rooms
41:03 Final Result
41:25 Patreon Shoutout
Рекомендации по теме
Комментарии
Автор

When my fire trap activates it doesn't hurt me, not until i leave the collision area and return to it. In the video when you test your fire trap you jump out of the collision area and then back into it and get hurt so I can't tell if this is how it's meant to be or if I have messed up. If this is how it is meant to be could you possibly tell me how to have it so it hurts the player if they wait within the collision area. Thanks in advance if you find the time to help me out

syris
Автор

Great Tutorial. One quick thing. I advise everyone to create two colliders for the firetrap. One is the box collider, for the trap itself, and the other is a capsule collider, for the fire. That way, you can activate and deactivate the capsule collider as the trap activates and deactivates, which allows you to recalculate if there's a trigger when the trap is triggered, and at the same time makes it so only the fire deals dmg, and not the trap itself. I made it like that and it works wonders.
I have nothing else to add. Your tutorials have been helping me out tons

gamingforthefun
Автор

These Tutorials are genuinely some of the best out there, you explain everything so well and concisely, with good pacing too. Can't wait for future videos!

andrewvan-heerden
Автор

Quick performance tip.

When checking if a collision hit the player using
`if (collision.tag == "Player")`,
Do:
`if
instead.

_u
Автор

I'll join the crowd in saying your tutorials are spot on ! I'm learning Game Development mainly for sound design purposes -as I have currently no clients as a sound designer, I'm planning on making my own game and your lessons provide an excellent template for making a more in-depth platforming game.

peterwojtek
Автор

This is a timestamp where I'm at 28:26 for a reminder later to carry on.

HuddledEragon
Автор

26:22 'if you would turn the trap around it would still work correctly' - If anyone couldn't get this to work, you have to make the rotation of the arrow trap -180, while the sprite remains at -90. Then it will work. You can also make it -90 and pop it in the ceiling too

ldmdesign
Автор

These are the absolute best tutorials I've come across! Thank you so much for taking the time to make these! Can't wait for more! 🍻

gurt
Автор

If you wanted the spike head to go only vertically up and down like i did:

1) comment out all directions in the directions array apart from -transform.up (now spike head can only travel up or down, so it's now an array with only one value)

private void CalculateDirection()
{
// directions[0] = transform.right * range; // right direction
// directions[1] = -transform.right * range; // left direction
// directions[2] = transform.up * range; // up direction
directions[0] = -transform.up * range; // down direction
}


2) create a new variable: Vector3 originalPos; (to send spikehead back to start)
3) create a start method, and add: originalPos = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y,

private void Start()
{
originalPos = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y,
}


4) create a new method (mine is named restart) and add: gameObject.transform.position = originalPos;

private void restart()
{
gameObject.transform.position = originalPos;
}

5) in the Stop() method, add: Invoke("restart", 2); // the restart method will happen after 2 seconds

private void Stop()
{
// stop the spike head, so it doesn't travel forever
destination = transform.position; // stop moving
attacking = false; // no longer attacking
Invoke("restart", 2);//this will happen after 2 seconds
}

kinda teleports back, but it works

andrewvan-heerden
Автор

I've always wondered how games like trap adventure 2 created traps, thank you!

tyrussell
Автор

this should be official 2d game repo thanks for making this

berkcan
Автор

I love how clear the explanations are! Instantly subbed from the very first one.

PianoGreenGaming
Автор

My favorite episode so far with all the trap interactions, thanks!

fallenIights
Автор

Wow! This is being really interesting now. Learning lots and lots from every video. Eagerly waiting for the coming episodes.

subharanjanghoshal
Автор

The spike head detects player and stops immediately when player moves away form that region.

YazhiniMalarPari
Автор

this video is the longest so far, so i am really excited!

panostriantafillidis
Автор

Been following this whole tutorial and learning a lot u r a legend really stepped up when brakeys left and the community needed a beginner friendly youtuber. Thank you! On another note when is the next episode coming out do you have an approximation of when?

BeastBoy
Автор

Hahaha jokes on me 22:32, I had not written the enemy damage code since I found it useless in the latest episodes but I think I should have :D

BloodCatters
Автор

Почему так мало лайков? Офигенное же видео
(Коммент для продвижения)

seregaplay
Автор

Cool! Thanks, ive been trying to make a game for a long time now!

leodeplayz