Update: I have released this extension via GitHub. Refer to the announcement here: Grid extension
For the course that I’m writing, I’m thinking about a game similar to the Memory card game. I’m going to need to build a grid similar to that used in the Memory game found in Blocks Games or that John Park uses in his Re-MakeCode Racing Game. Since it might be a useful construct for others, I figured I’d create an extension.
The extension is basically done, but I’m looking for some input. You can find my current work here:
Use the arrow keys to move the taco around the grid. Pressing A will add columns to the grid; B will add rows.
Some thoughts that I’m pondering:
- I’ve created
moveUp()functions that you can bind to the appropriate keys. Is that a reasonable way to implement this, or should I go the route of
controller.moveSprite()? If the latter, what’s the best way of going about that?
The indexing for the rows and columns begins at 1. Is that reasonable, or should it start with zero?I’ve switched the indexing to begin at zero per the conversation below. If you feel strongly otherwise, feel free to comment.
- I’ve added the ability to animate the transition from one coordinate to the next as @peli suggested.
- In the demo, when you move right or down, the taco “slides” to the next location. When you move left or up, the taco “teleports.” In addition, in the demo, the grid “wraps around,” so moving the taco off of an edge will send it to the other side of the grid.
- The default action is to teleport. If you feel like it should be the other way around, feel free to comment.
- How do you feel about the “slide” from, say, the right side to the left?
- Do you think that it should jump to the opposite side instead, even if teleporting is turned off?
- Do you think this should be a global setting (all sprites either teleport or slide), a per-sprite setting (each sprite can either teleport or slide as it moves), or a per-direction setting as currently implemented?
I’m always happy to entertain other thoughts and ideas, so feel free to share them!