Javascript a HTML Game - Ep 3 - Collision Hit Tests.
I'm making a series of videos to demonstrate programming in Javascript using a little HTML to create a simple game, using Notepad++ to code, you can always use notepad & achieve the same results.
Watch the playlist from the start = https://www.youtube.com/watch?v=n6-o6Ffpnd8&list=PLebvEFVOiFE-ftmTV8zc-ypmM0MPPK33V
In this episode I covered how to run a hit test between 2 rectangles & show you how you can block the objects like solid wall collisions, or how to go about scripting other events you might want to happen when objects collide!
==== Contents ====
0:00 - Waffling introduction!
0:52 - fixing lineWidth in square class.
==== Building a Hit Test Function ====
1:25 - building a skeleton hit_test function
3:07 - Adding halfWidths + centerX to the Rectangle Class.
3:58 - Introducing Getters & Setters
5:40 - measure x_distance vs combined_half_widths of rectangles
7:14 - find out if an overlap on the X axis is happening...
8:30 - measure y_distance + combined_half_heights
9:53 - a collisions happened, find the x y overlap
10:20 - Introducing Math.Abs()
11:42 - find out which side is the collision happening on & separate by overlap.
15:30 - Added hit_test into the update loop
==== Demonstrating the Hit_Test without Separation ====
15:59 - adding another rectangle
16:55 - adding 'collide' as an argument into the hit_test
17:35 - explaining the return statements purposes
18:12 - running hit_test in an if statement without the collision
==== Stay tuned for more videos! ====
Over the course of the weeks I intend to build upon this game & add to it, eventually including how to add graphics. From there I may improve further to build a more full functioning game.
Viewers are encouraged to watch, follow along & learn or add your own input.
Eventually this might build up into a game worth playing like Celeste! Or you'll see me crash and burn at the 6th or 7th hurdles! Who knows! At the very least I intend to stream every step of development I go through so that you can follow along every step of the way & learn how to (or how NOT to) go about building your own game all from scratch!
My Facebook - https://www.facebook.com/beta.ruler.9/
My Twitter - https://twitter.com/RahuBeta
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Javascript a HTML Game - Ep 3 - Collision Hit Tests.», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.