Coding Questions from a 4th Grade Gifted and Talented Student for End-of-Year Design Project

Hello! I am posting these questions for my 4th grade student who needs help as he is building a platformer game:

Name: Miles

1. What is the best height for a character when making a platform game?

2. Are you able to make hidden blocks?

3. If so, how do you make hidden blocks?

4. What is the best piece of code to use when making a platform game?

1 Like
  1. It depends on your level design. If there will be single block gaps that the player has to travel through, you will want a player about 60% - 80% the height of a single tile. With each tile being 16 x 16 pixels, that’s about 9 - 12 pixels tall. However, if your gaps are much taller, you can have a taller character. In general, I usually go for a separate hitbox sprite and display sprite, so that the hitbox can be smaller and the character taller without looking weird or getting in the way.
    This may be quite advanced, but can be done with one sprite that does all the moving and stuff but has the “invisible” flag turned on, and another sprite that is teleported to the invisible sprite in an On Game Update loop but has the “Ghost through walls” flag turned on.

  2. Yes

  3. This can be super annoying or easy depending on the game. For example, if you have a solid background color, you can simply make the tile the same color as the background, then maybe have it change to a different visible tile when the player touches it. Even this is easier said than done, as detecting if the player is touching the block involves checking which block the player is hitting. In comparison, however, a hidden block on a dynamic background that isn’t just one color can be much more difficult, but is still possible. If I were to go about it, I would just put a wall there with no tile and then detect when the player hits a wall but the tile is a transparent one, though that would limit you to only one type of hidden tile. If you wanted more types you would need some other way of keeping track of which invisible tile wall is which type.

  4. I really think that using separate hitbox and display sprites is a very good idea. It lets you animate your display sprite without worrying about the hitbox changing and causing issues.

Here is an example project with some of these ideas shown:

4 Likes

It really depends! Generally, 16x16 is a perfect size but if the game is bigger, 32x32 is equally as great. As for hidden blocks, I use sprites that I then label as “Hidden” So the player can’t see them but the game still interacts with it. Best piece of code for a platform game? Anything that makes life easier lol. For example @RizeUpDev ‘s platform extension makes you sigh with relief that you don’t have to make any of the really annoying stuff (taking up tons of code space) I hope this answers your question! :grinning_face:

2 Likes

ermmmm actually 33 is slightly over its 32

Glad somebody finds it easy and life saving!