Fangames > Gameplay & Discussion
A good explanation about the logic behind aligns
(1/1)
lawatson:
Let's go over the basics. The player moves 3px per "step" when a directional button is pressed. Let's say the player is on align 0. This means they can go to X = 3,6,9,12,15, and so on. But if they wanted to change their align so they could go to X= 1, 2, 4, or 5, they would have to change their align to 1 or 2. How do you do this? By hitting a wall with that align. Let's see an image regarding the aligns.
Now let's ask our first question: Why do the aligns shift like this? This occurs because since there are 3 possible aligns and the grid is indivisible by 3 (32/3 ≠ integer).
What does this mean? Let's take a more in depth look.
With this, you should understand how you get each align. Now for an explanation regarding offset blocks. Note: this is pretty much an extended example of the first part, which explains how aligns work in the first place.
Chances, although low, are that one of the blocks is offset, with its position maybe 40 or 48. This isn't too complex, because all you're doing by grabbing the align is offsetting it.
Let's take a look at a regular block and an offset block's aligns.
'
There's an explanation for why these two aligns are the same. if the left align's X is 0, that means the far align's X is 24. 24 and 0, when divided by 3 (move speed), result in the decimal point .00, so this means that they are both on align 0.
Now let's look at an offset block which doesn't result in the same align.
The left align's position is 0, and the far align's position is 16. 0/3 is .00 and 16/3 is 5.33 or 1/3. 1/3 * 3 is 1, so it makes sense that the far align is shifted by one pixel.
You can use this guide to basically figure out anything align-related.
That basically covers the align explanation, so I hope you understand now what aligns are and how they work!
Now let's move on to a bonus explanation regarding walk-off aligns!
Walk-off aligns let you walk off a block which has a spike poking out from it. It's only possible with one of the three aligns. But why? The explanation for this is quite complex. The short answer is that it depends on the player's hitbox. If you want the long answer, you can learn about it from the next section.
Here's a failed attempt at a walk-off, where the kid got an align from the block next to them.
Now let's check out the successful attempt, where the kid got an align from the other side of the spike block.
You may or may not be wondering how the player does it with the align farther away from the spike instead of the align closer to the spike. Now we're going to get technical.
Let's see an image of that same thing, but with the align grid.
More specifically, the align which allowed the player to fall through:
The top of the spike where the player can hit is 2px wide.
Let's say that the correct align's X position is 0. That would mean the spike's position is 32. The two kill pixels are at position 32 and 33. With the align, you could go to X=27,30,33,36,39.
Now here's where it gets weird: Though the player's origin, or true position, follows the same 3 pixels as the align, the edge of the hitbox doesn't. The player's regular hitbox is 11px wide, which is not divisible by 3. It's 2px longer than the highest .00 division decimal result, 9. Simply, the edge of the hitbox is extended by two pixels.
Normally the align in the same block as the spike would be the correct one, but the two edge pixels would collide with the two kill pixels. With the 1px far align, the edge pixels would only collide with the far kill pixel. With the 2px far align, or the correct one, the two edge pixels go beyond the kill pixels, resulting in a successful walk-off! You can use the same logic as this explanation to determine walk-off aligns with different hitbox lengths. I hope this helps you understand!
EDIT: I'm bad at explaining things, so there are probably quite a few things in the post that don't make sense. Try to look past that, though :BloodTrail:
tehjman1993:
Good basic explanation, I think it would help more if you put more example pictures up, such as optimal aligns for specific jumps that you commonly find in needle games, like corner jumps!
lawatson:
I based this post more on the logic behind aligns, not the aligns for jumps. I'm sure someone will make a post on that, though. :SoonerLater:
thebmxbandit11:
--- Quote from: tehjman1993 on February 03, 2015, 11:22:23 PM ---Good basic explanation, I think it would help more if you put more example pictures up, such as optimal aligns for specific jumps that you commonly find in needle games, like corner jumps!
--- End quote ---
I made something like that a little while ago: (click to show/hide)
Navigation
[0] Message Index
Go to full version