CS50
Уровень B2· 1641 слово
Hello world, this is CS 52D. This is week 3, and this week we're gonna take a look at a classic game that a lot of people are probably familiar with in recent times on their phones.
Uh, it's called Match 3. Well, the genre is called Match 3, and. The game probably originally in its most famous initial incarnation started with a game called Bejeweled.
It had a predecessor for DOS back in the 90s, but Bejeweled was a game that was very popular. I remember playing this in the 2010s circa 2012, 2013 quite a bit as a sort of addicting game uh that was kind of easy to play on, on phones or just on the computer.
what have you and it's a very simple formula really it's literally in the name which is kind of funny but essentially it is you have this grid of tiles that can be whatever you want in this particular case of bejeweled it's themed after jewelry and I think the sort of sort of the more glitzy or appetizing the
theme is the better typically for engagement. But in this case we have various jewels of different colors, they're very individually recognizable and they're all arranged such that, you know, essentially they're orthogonal to one another.
You can, you can swap any two that are directly adjacent to each other and what you get from this is essentially once you have, let's say these examples here, these orange and blue gems, if you were to.
Swap these two together such that now you have 3 contiguous orange jams. Well now you've completed a match and then you'll get some points for that, at which point the tiles will replace to fill in the gap that gets created from those gems and there's all sorts of other effects.
More people probably nowadays are familiar with Candy Crush and I've even played this relatively recently, um, and it's also the same.
Exact idea. In fact, if you were to go between the two of these, they're almost indistinguishable at a glance, uh, except, you know, this one being a little bit more candy themed but you know, if we think about last week we talked about Sprite sheets, we talked about breaking a texture apart
into these individual tiles and this in some ways is a continuation of the same ideas that we looked at last week, but we'll also be looking at a lot of other very interesting ideas.
In particular, tweening and timers are the two biggest ones, this lecture iteration. We looked at anonymous functions in Flappy Bird when we introduced the state machine and the ability to have anonymous functions instantiate the states within that.
But in this week's lecture we'll look at that a little bit in a different use case in conjunction with tweening, which is essentially just interpolating a value between two points, timers which will allow us to perform that but allow us to do lots of other very interesting things to