SideScroller - Small Basic Featured Program

Last month's challenges had vertical scrollers and so this month I suggested a platform type game.

Here is the challenge:

Game Challenge

  1. We have had the vertical scrolling game last month, so now it's the platform game.  The challenge is to have some stationary platforms at varying heights that the player can move along (Left and Right) and jump (Space) up and down to.  If the player falls too far (misses a platform) then they die.
  2. If you get the player jumping to platforms, then create a game out of it with some objective or scoring.

I was very impressed with Zock77's entry.  This really is very good on many levels and budding game writers should have a look at how it all works.

  • It has just 165 lines of well structured code, many of the lines are blank.
  • It has a great 'hand drawn' animated man for moving and jumping.
  • The keyboard control is very simple, smooth and reactive.
  • The layout of the world can easily be changed for different levels.

The code comes with the images in a zip download.

Here is a snippet of the code showing a Subroutine that does the animated walking.

Sub ``WalkAni

  `` Animationnum `` = `` Animationnum `` + `` 1

  `` If `` Animationnum ``>`` = `` 4 ``Then

    `` Animationnum `` = ``1

  ``EndIf

  `` For `` i `` = `` 1 `` To ``3

    ``Shapes``.``HideShape``(``Walk``[``"R"``]``[``i``]``)

    ``Shapes``.``HideShape``(``Walk``[``"L"``]``[``i``]``)

    ``Shapes``.``HideShape``(``Walk``[``"SR"``]``[``i``]``)

    ``Shapes``.``HideShape``(``Walk``[``"SL"``]``[``i``]``)

  ``EndFor

  `` If `` Standing `` = `` "False" ``Then

    ``Shapes``.``ShowShape``(``Walk``[``Direction``]``[``Animationnum``]``)

  ``Else

    `` If `` StandAnimNum `` < `` 2 ``Then

      `` StandAnimNum `` = `` StandAnimNum `` + ``1

    ``EndIf

    ``Shapes``.``ShowShape``(``Walk``[`` "S" `` + ``Direction``]``[``StandAnimNum``]``)

  ``EndIf

EndSub

As a game it is not fully finished, but this is a fantastic start and could be used as a template to develop further into a very accomplished game.

Already, another Small Basic enthusiast ProfessionalOfSmallBasic added a new level.