Small Basic monthly challenges - February 2019: irregular convex polygons, Banners, Buttons, & more!

By
Published 02-21-2019 02:03 PM 1,151 Views
Microsoft

Small Basic monthly challenges - February 2019: irregular convex polygons, Banners, Buttons, & more!

LitDev brings us another monthly challenge!

These challenges are intended for people who are learning to program for the first time or for those returning to programming who want to start using Small Basic.  Some will be easy, some will be hard - but they will all make you think, and more importantly be GREAT FUN!

Please post your solutions / partial solutions / questions / feedback etc. into this thread that will remain 'sticky' for the month.  The only rule is that your solution must use standard Small Basic methods (no extensions).

It would be good if people could post their problems with these challenges so that a discussion can start so that everyone can learn from each other.

Graphics Challenge

First write a program to draw a line on the GraphicsWindow following the mouse.

Below is a starter:

`GraphicsWindow``.``Show``(``)`
`xLast ````= ````GraphicsWindow``.``MouseX`
`yLast ````= ````GraphicsWindow``.``MouseY`
` `
```While ````(``"True"``)`
`  ````x ````= ``GraphicsWindow``.``MouseX`
`  ````y ````= ``GraphicsWindow``.``MouseY`
`  ``GraphicsWindow``.``DrawLine``(``x``,``y``,``xLast``,``yLast``)`
`  ````xLast ````= ``x`
`  ````yLast ````= ``y`
`EndWhile`

Then make the program color the line depending on which quadrant the mouse is in.

Then make mirror images of the mouse movement to draw lines in each quadrant.

Maths Challenge

Write a program that will join up some random points to draw an irregular convex polygon (no side lines cross each other).

Banner Challenge

Make a smoothly scrolling text banner for the GraphicsWindow.

Try using different font styles, colours, transparency and other effects to make the scrolling effect as fun as possible.

Consider using Shapes or Controls, with Move or Animate.

Buttons Challenge

Make a button that moves randomly within the GraphicsWindow.

Try to make the movement smooth and pop up a message when the user manages to click the button.

Do you have an idea or a future challenge? Please post it here!

Small and Basically well,

- Ninja Ed

Version history
Last update:
‎Mar 13 2019 10:28 PM
Updated by: