I was hoping to have some live session discussing the course content, but it looks like nobody has finished the first quiz, can that be right? I haven't seen anything from the art team, so we're going to have to work with primitives. If we can get a red cube that fights some blue cubes we can call this a win.
Programmatically, One Finger Death Punch can be described as such: Avatar stands in the middle. Enemies approach from the left and the right. If a button is pressed and an enemy is in range, avatar moves the distance of the range and dispatches the closest enemy. If a button is pressed and an enemy is not in range, avatar moves the maximum distance of its range and whiffs, leaving the avatar vulnerable to attack for a brief moment. Player has two buttons, one representing an attack to the left, and the other to the right.
It might be hard to tell at first glance, but the operative word here is "closest." The avatar only attacks the closest enemy on either side of him when the player pushes a button. First we want to gather a list of enemies and calculate which is closest. Any time you want to select from a list, you'll want to use an array.
An array is a data structure that stores a collection of elements of the same type. It provides a way to organize and access a fixed number of elements sequentially using an index or a key. Each element in an array is assigned a unique index, starting from zero, which represents its position in the array.
Before reinventing the wheel, we want to research what solutions exist for this sort of thing. Check the Playmaker library of addons and search the Playmaker forums. Search for "array" or an Action that solves this problem, e.g. "ClosestEnemy." Once we can calculate the closest enemy on either side, the rest is mostly OnButtonDown and MoveTo and Deactivate Actions.
Try to come up with something for Thursday and we'll meet up live at 8pm EST on youtube on the NickelCityPixels channel!