none
Challenge of the Month - June 2014

    General discussion

  • 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.

    Also post feedback on the kind of challenges that you want to see more of in the future.

    Small Challenges

    1. Write a program to input 5 numbers and then output them in ascending and descending order (sorted small to big and big to small).
    2. Write a program to replace all occurrences of vowels in a sentence with '*'.
    3. Write a program to draw a picture of a soccer stadium (think world cup in Brasil).  Then have a go at Game Challenge 2.
    4. Write a GraphicsWindow program with buttons to change the background colour of the window.  Perhaps add some texboxes to enter a colour by name or even values for red, green and blue.

    Maths Challenges

    1. Write a program to draw a pie chart
    2. Write a program to calculate the first 1000 prime numbers

    We have had some great game challenge entries recently, so here are 3 more...

    Game Challenge 1

    Write a 'frustration' board game.

    Game Challenge 2

    Write a soccer penalty shootout game for 2 players, the striker and the goalkeeper.  The graphics can be quite simple - the challenge is all about gameplay.

    Game Challenge 3

    Write a FPS (First Person Shooter).  A 3D version is unrealistic, but a simple 2D one is quite possible.

    I am thinking of enemies that come and go and may shoot at you.  The player has to react and aim with the mouse and fire with a button click to kill the enemies.

    Hint: Start with basics of game play (mouse events - variable arrays for enemies and game loop) before adding fancy sound or visual effects.

    Community Suggestions (by ProfessionalOfSmallBasic)

    1. Make a Escape Game and it have 3 rooms.
    2. Make a Adjustable Hourglass.
    3. Make a Screen keyboard.

    Community Suggestions (by Nonki)

    1. Create your program database.
    2. Create a ticker tape animation.
    3. Create a piano recorder using piano sound of Sound.PlayMusic().

    Community Suggestions (by Jibba Jabba)

    1. Write some code that works out how to center a Window between the top and bottom of the screen.
    2. Make a "flash screen" with or without using an extension.  Center it in the screen. (You can search the forum for how to do this).

    Community Suggestions (by Athasak)

    1. Click and drag an image.  A little sample here: Import ID: JXW401.

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

    Sunday, June 01, 2014 10:07 AM
    Moderator

All replies

  • Solution for Math challenge 1    pie chart:

    'pie chart      Math challenge 1  june 2014      WhTurner33
    '========================================
    NN=6
    For i=1 To NN
      num[i]=Math.GetRandomNumber(30)+5
      sum=sum+num[i]
    EndFor
    p2=Math.Pi/50
    GraphicsWindow.FontSize=20
    For i=1 To NN
      pct[i]=Math.Round(1000*num[i]/sum)/10
    EndFor
    alf=0
    For i=1 To NN
      alfh=alf+p2*pct[i]/2
      alfa=alf+p2*pct[i]
      color=GraphicsWindow.GetRandomColor()
      GraphicsWindow.BrushColor=color
      GraphicsWindow.PenColor=color
      For j=alf To alfa Step 0.01
        sline=Math.Sin(j)
        cline=Math.cos(j)
        GraphicsWindow.DrawLine(225,225,225+125*sline,225+125*cline)
      EndFor
      ss=Math.Sin(alf)
      cc=Math.Cos(alf)
      s2=Math.Sin(alfh)
      c2=Math.Cos(alfh)
      GraphicsWindow.PenColor="black"
      GraphicsWindow.DrawLine(225,225,225+125*ss,225+125*cc)
      
      GraphicsWindow.DrawText(450,30*i,i+":"+num[i]+" ("+pct[i]+"%)")
      GraphicsWindow.DrawText(225+150*s2,225+150*c2-10,i)
      alf=alfa
    EndFor
    GraphicsWindow.DrawLine(225,225,225,350)
    GraphicsWindow.DrawEllipse(100,100,250,250)
    


    Jan [ WhTurner ] The Netherlands

    Sunday, June 01, 2014 9:28 PM
    Answerer
  • You can do some really amazing things if you are clever with the tools you have. These are two 3D maze programs that could easily be the basis for a first person shooter.

    importCode: DWV967

    Black and white, Castle Wolfenstine-esk


    ImportCode: BRS931

    Full color, free roaming.

    Amazing use of the tools in small basic.

    FYI - Neither of these are mine by the way. Way beyond my ability.  :-)
    • Edited by Coding CatEditor Monday, June 02, 2014 4:57 PM credit where credit is due.
    Monday, June 02, 2014 4:54 PM
    Answerer
  • hi coding cat,

    I tought this but it has so lag and 

    can you give another idea for fps game

    like that.

    Monday, June 02, 2014 5:20 PM
  • Solution for Community Suggestions (by ProfessionalOfSmallBasic).

    2.  Make a Adjustable Hourglass.

    The program is published as  MNL048 

    A screenshot is given below:


    Jan [ WhTurner ] The Netherlands

    Monday, June 02, 2014 5:44 PM
    Answerer
  • Samples for
    Community Suggestions (by Athasak): Click and drag an image
    Ok, not .. an image, because this are snippets/excerpt used in an other program.
    But support dragging a shape while it moves.

    1. DragOnMove Constant (along y = const), ID: SHP377
    2. DragOnMove Linear (along diagonale y = k*x + d), ID: PHP464
    3a. DragOnMove Parameter coord x=r*cos(angle); y=r*sin(angle) or Polar r=const (Left2Right), ID: CNV054
    3b. DragOnMove Parameter coord (Polar), same as 3a. but for Jibba Jabba ;-) (on southern hemispere, R2L), ID: SMZ413
    Wednesday, June 04, 2014 9:36 PM
    Answerer
  • I created a thread about community suggestion by Nonki 1: Your Program Database.

    I think this story will become long.  So I separated it.


    Nonki Takahashi

    Thursday, June 05, 2014 7:53 AM
    Moderator
  • WhTurner33, great hourglass!

    Nonki Takahashi

    Thursday, June 05, 2014 7:56 AM
    Moderator
  • My solution for Athasak's Community Suggestion: (sorry I can't d/load images atm, I'm out of d/load allowance, Again!)

    An alternative to using GW Mouse Events. Only using the Mouse.IsLeftButtonDown property.

    With some effort it could be coded into a Game Structure: see link for a top intro to Game Loop Structure: http://social.technet.microsoft.com/wiki/contents/articles/20865.small-basic-dynamic-graphics.aspx

    'Drag & Drop something to a target or return home
    
    home = "X=20;Y=20"
    boxSize = 40
    
    box[1] = Shapes.AddRectangle(boxSize, boxSize)
    Shapes.Move(box[1], home["X"], home["Y"])
    
    boxTarget[1] = Shapes.AddRectangle(boxSize + 10, boxSize + 10)  'upSize Target for special fx
    Shapes.Move(boxTarget[1], 200, 150)
    Shapes.SetOpacity(boxTarget[1], 50)
    '===========================================================================
    
    While "True" And "North" <> "South"  
      mseX = GraphicsWindow.MouseX
      mseY = GraphicsWindow.MouseY  
      
      If Mouse.IsLeftButtonDown Then    'handle click and select
        If selected = "" And clicked = "False" Then  'can loop thru here for more than 1 box      
          If mseX >= home["X"] And mseX <= home["X"] + boxSize And mseY >= home["Y"] And mseY <= home["Y"] + boxSize Then      
            selected = 1  'box number      
          EndIf     
        EndIf
        clicked = "True"  'the mse has been clicked for this frame    
        Shapes.Move(box[selected], mseX, mseY)
      Else
        If Math.Round(mseX/50) = Math.Round(Shapes.GetLeft(boxTarget[selected])/50) Then
          If Math.Round(mseY/50) = Math.Round(Shapes.GetTop(boxTarget[selected])/50) Then
            Shapes.Remove(box[selected])
            Shapes.SetOpacity(boxTarget[selected], 100)
          EndIf
        EndIf    
        Shapes.Move(box[selected], home["X"], home["Y"])
        selected = ""      'deselect when finishised with the box
        clicked = "False"  'inits here, get ready for next click
      EndIf  
      
      Program.Delay(20)  
    EndWhile
    Hey PL, thanks for the Southern Hemisphere config. They are nice solutions.



    Friday, June 06, 2014 8:56 AM
    Moderator
  • This is my first step for game challenge 1: JPH449.

    Screen shot of a program Frustration 0.1a


    Nonki Takahashi

    Monday, June 09, 2014 10:50 AM
    Moderator
  • can anyone fix my game's start problem please?

    import id:BDM296

    Wednesday, June 11, 2014 6:43 PM
  • ProfessionalOfSmalBasic,

    What is your problem?
    I recommend you to debug your program yourself.  Following article may help you.

    http://social.technet.microsoft.com/wiki/contents/articles/14121.small-basic-how-to-debug.aspx

    After that you are welcomed to post question about your debugging with the detail.


    Nonki Takahashi

    Thursday, June 12, 2014 4:27 AM
    Moderator
  • This is my second step for game challenge 1: JPH449-0.

    Screen shot of a program Frustration 0.2a

    But this is still alpha version.


    Nonki Takahashi

    Thursday, June 12, 2014 4:32 AM
    Moderator
  • Jan,

    We blogged about your hourglass:

    WhTurner33's Small Basic Hourglass - Featured Program

     

    Thanks!


    Ed Price, Power BI & SQL Server Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)

    Answer an interesting question? Create a wiki article about it!

    Thursday, June 12, 2014 5:22 AM
    Owner
  • Thanks Ed!

    I fixed it some codes were wrong but I thought and I find a way:BDM296-0

    Thursday, June 12, 2014 9:06 AM
  • Game Challenges3

    Dead Mole:VRH508

    Thursday, June 12, 2014 12:36 PM
  • POSB,

    You mole killing program is a great start - perhaps the poor moles could fight back!

    Thursday, June 12, 2014 9:13 PM
    Moderator
  • This is my sample for community suggestion by Nonki 2: MCG292.

    Screen shot of a program Ticker Tape Animation 0.1


    Nonki Takahashi

    Friday, June 13, 2014 9:07 AM
    Moderator
  • This is my first try for community suggestion by Nonki 3: JVH699.

    Screen shot of a program Piano Recorder 0.3a

    Please run this program in local.  Play button is not implemented yet.


    Nonki Takahashi

    Sunday, June 15, 2014 7:56 AM
    Moderator
  • This is my challenge for community suggestion by Athasak: HHF879.

    Please run this program in local.

    Screen shot of a program Make-A-Face Game 0.1


    Nonki Takahashi


    Sunday, June 15, 2014 9:49 AM
    Moderator
  • Hi, all this time I've been working for college so I couldn't do programming so much. The finals are not done yet though. In my resting time I was programming a bit so here are some programs :)

    Small Challenges

    3. TCV678

    4. CHF852

    Community Suggestions (by Nonki)

    1. LJS543

    3. VNT629

    (Jibba's challenge "1" is included in the database and the piano :)

    Sunday, June 15, 2014 7:31 PM
  • This is my second sample for community suggestion by Nonki 3: JVH699-0.

    Screen shot of a program Piano Recorder 0.4b


    Nonki Takahashi

    Monday, June 16, 2014 12:20 AM
    Moderator
  • This is my challenge for community suggestion by Jibba Jabba 2: RBN002-0.

    Screen shot of a program Turtle Flash


    Nonki Takahashi

    Monday, June 16, 2014 3:52 AM
    Moderator
  • Hi, all this time I've been working for college so I couldn't do programming so much. The finals are not done yet though. In my resting time I was programming a bit so here are some programs :)

    Small Challenges

    3. TCV678

    4. CHF852

    Community Suggestions (by Nonki)

    1. LJS543

    3. VNT629

    (Jibba's challenge "1" is included in the database and the piano :)

    Good challenges!  I like your soccer stadium.

    Screen shot of a program Soccer Stadium


    Nonki Takahashi

    Monday, June 16, 2014 3:56 AM
    Moderator
  • Hi Nonki

    I don't think:  (dh - gh) / 2 centres the Window vertically on the desktop.  (dw - gw) / 2 does the horizontal.

    For vertical centre it needs to be offset by the size of the Title Bar (excluding the window border size).

    Monday, June 16, 2014 4:13 AM
    Moderator
  • re centre vertical:

    If you run this code with the taskbar docked on the side it shreds some light on the matter for win7.

    singleBoarderSize = 7.5               'single border size (my System)
    titleHeight = singleBoarderSize * 3   'excludes border size
    
    GraphicsWindow.Height = Desktop.Height - 1
    
    GraphicsWindow.Top = 0 - titleHeight
    Also I think it's might be possible to write some code that returns the Window border width.

    Monday, June 16, 2014 4:30 AM
    Moderator
  • Hi Nonki

    I don't think:  (dh - gh) / 2 centres the Window vertically on the desktop.  (dw - gw) / 2 does the horizontal.

    For vertical centre it needs to be offset by the size of the Title Bar (excluding the window border size).

    Jibba Jabba,

    Yes!  You are right.  Once maximizing the Small Basic program window, we can get the width of title bar and border, can't we?


    Nonki Takahashi

    Monday, June 16, 2014 7:53 AM
    Moderator
  • This is first step of my challenge for community suggestion by ProfessionalOfSmallBasic 3: MVK034.

    Screen shot of a program Software Keyboard 0.1a


    Nonki Takahashi

    Monday, June 16, 2014 8:50 AM
    Moderator
  • Good Start Nonki!

    Thanks!

    Monday, June 16, 2014 11:36 AM
  • This is my program for Math challenge 2: DJQ511-0.

    Nonki Takahashi

    Monday, June 16, 2014 1:32 PM
    Moderator
  • RE this Title Bar and Border business to centre the window precisely.

    I think there's a way to return an answer to centre precisely using SB native code. However I can't see that it's logical. Yet!

    The reason I can't see that it's logical is I suspect that when GW.CanResize is set OR reset SB may change the GW.Size

    I'll try and simplify some proof.

    Monday, June 16, 2014 1:36 PM
    Moderator
  • Ok, here's proof that GW.CanResize changes the GraphicsWindow width and height.

    When CanResize is set from True to False it ALSO increases the GW.size by the mysterious value of 10.

    GraphicsWindow.CanResize = "True"
    
    lastGwWidth = GraphicsWindow.Width
    lastGwHeight = GraphicsWindow.Height
    TextWindow.WriteLine(GraphicsWindow.Height)
    Program.Delay(2000)
    
    GraphicsWindow.CanResize = "False"
    
    currentGwWidth = GraphicsWindow.Width
    currentGwHeight = GraphicsWindow.Height
    TextWindow.WriteLine(GraphicsWindow.Height)
    
    relativeChangeInWidth = currentGwWidth - lastGwWidth
    changeInHeight = Math.Abs(lastGwHeight - currentGwHeight)
    
    TextWindow.WriteLine("change to GW height " + changeInHeight)
    TextWindow.WriteLine("relataive Change to Width " + relativeChangeInWidth)

    Bug or Feature?

    I don't know. The change is done covertly without the programmer instructing it to.

    Often is the case where we create a global dependency i.e GW = GraphicsWindow.Width

    If CanResize is reset then the global would breakdown.

    This is why I'm becoming an advocate for the eradication of globals. :)

    Monday, June 16, 2014 2:02 PM
    Moderator
  • I suspect it's a feature. The burden is reasonably placed on the developer to write robust code.

    Relying on globals is the issue.

    If you wish to know/return the value of GW.size at any point in a program then ask / check the property by getting it and not declaring it as a global.
    Monday, June 16, 2014 2:07 PM
    Moderator
  • I reckon this is another reason why SB is a fantastic introductory programming language.

    It allows us to explore / discover then resolve broader programming issues in a simplified environment.


    >>Wreckless reliance on Dependencies<<< arrrgh
    Monday, June 16, 2014 2:19 PM
    Moderator
  • Perhaps we need a "SB dev's Team Charter of Professional and Acceptable Coding Practices" .

    And give it a fancy acronym, I like SBD's COPACP.

    Monday, June 16, 2014 2:42 PM
    Moderator
  • POSB brought up the issue of lag in this excellent 3d maze.

    Original program: BRS931    Revised versionBRS931-2

    It seems the lagging was from doing a lot of calcs and redraws in the Async OnKeyDown thread.

    '========================================================================
    'Added This
    '========================================================================
    'Loop:
    'Goto loop
    GraphicsWindow.Keydown = OnKeydown2
    
    While "True"        'GAME LOOP in the UI Thread. Do all the calcs and redraws in this thread.
      If keyDown Then
        onkeydown()
      EndIf
      keyDown = ""
      
      Program.Delay(Math.Max(0, 20 - (Clock.ElapsedMilliseconds - start))) '50 fps Else Delay(0) & any lag
      start = Clock.ElapsedMilliseconds
    EndWhile
    
    Sub OnKeydown2        
      keyDown = "True"   'Only do Callback in the Async Thread.  Build up happens here if lots of calcs/redraws are done
    EndSub
    '=====================================================================================
    

    Monday, June 16, 2014 4:30 PM
    Moderator
  • Jibba Jabba, this is my sample about this issue.

    GraphicsWindow.DrawLine(0, 40, Desktop.Width, 40)
    GraphicsWindow.DrawLine(40, 0, 40, Desktop.Height)
    txtWidth = Shapes.AddText(GraphicsWindow.Width)
    Shapes.Move(txtWidth, 80, 44)
    txtHeight = Shapes.AddText(GraphicsWindow.Height)
    Shapes.Move(txtHeight, 44, 80)
    Timer.Interval = 500
    Timer.Tick = OnTick
    While "True"
      Program.Delay(3000)
      GraphicsWindow.CanResize = "True"
      GraphicsWindow.Title = "CanResize = True"
      Program.Delay(3000)
      GraphicsWindow.CanResize = "False"
      GraphicsWindow.Title = "CanResize = False"
    EndWhile
    Sub OnTick
      Shapes.SetText(txtWidth, GraphicsWindow.Width)
      Shapes.SetText(txtHeight, GraphicsWindow.Height)
    EndSub  
    Something is wrong...


    Nonki Takahashi

    Monday, June 16, 2014 10:52 PM
    Moderator
  • RE this Title Bar and Border business to centre the window precisely.

    I think there's a way to return an answer to centre precisely using SB native code. However I can't see that it's logical. Yet!

    The reason I can't see that it's logical is I suspect that when GW.CanResize is set OR reset SB may change the GW.Size

    I'll try and simplify some proof.

    How about this? RBN002-1 (run in local)

    Nonki Takahashi

    Monday, June 16, 2014 11:23 PM
    Moderator
  • I think, somehow like this:

    WindowSize = Constant = 640 x 480  (no matter how CanResize = ), so...

    640 x 480  =  (624(+2*7 +2*1) / 634(+2*2 + 2*1)  x  442(+22 +2*7 +2*1) / 452(+26 +2*1))

                      =  W: CanResize=Tr / False                     x  H: CanResize = True  /  False


    Monday, June 16, 2014 11:38 PM
    Answerer
  • This is my third step for game challenge 1: JPH449-1.

    Still alpha version.  Click dice for your (blue) turn. 

    P.S. This is my fourth step: JPH449-2 (Beta version).


    Nonki Takahashi


    Tuesday, June 17, 2014 12:05 PM
    Moderator
  • This is the first step for game challenge 2: JMS284.

    Kick the ball with mouse.


    Nonki Takahashi

    Tuesday, June 17, 2014 3:36 PM
    Moderator
  • Is anyone doing Small Challenge 1: Write a program to input 5 numbers and then output them in ascending and descending order (sorted small to big and big to small).?

    Would be nice to see how others do the sorting.:)

    Here's my solution: RPJ275

    I may have used poor judgement in handling the UI for Input....

    I wasn't totally satisfied with TW.ReadNumber() so I thought I'd enhance the UI by customising using TW.ReadKey()!

    I expected some coding would be needed BUT as usual with this sort thing (deviating from built in methods) it turned out to be more than I would've liked. Still needs more code - I should save it as reusable ReadNumber method.

    Thursday, June 19, 2014 1:35 PM
    Moderator
  • Community Suggestions (by ProfessionalOfSmallBasic)

    The finals are over now and I have my freedom back. I don't know if this is an escape game but here it is :)

    1. GPV107

    Thursday, June 19, 2014 5:01 PM
  • Idea for a future challenge:

    Make a unit converter. For example 1 kilogram is 1000 grams. So make a program to convert the kilogram to 1000 grams :)

    Some samples here:

    1. DSM712 (this program is old but i forgot to use temperature in the new one below, so i shared that one to)

    2. QKH042

    Sunday, June 22, 2014 3:32 PM
  • Is anyone doing Small Challenge 1: Write a program to input 5 numbers and then output them in ascending and descending order (sorted small to big and big to small).?

    Would be nice to see how others do the sorting.:)

    Here's my solution: RPJ275

    I may have used poor judgement in handling the UI for Input....

    I wasn't totally satisfied with TW.ReadNumber() so I thought I'd enhance the UI by customising using TW.ReadKey()!

    I expected some coding would be needed BUT as usual with this sort thing (deviating from built in methods) it turned out to be more than I would've liked. Still needs more code - I should save it as reusable ReadNumber method.

    This is my version for small challenge 1: DFB661.

    Nonki Takahashi

    Monday, June 23, 2014 9:34 AM
    Moderator
  • I created a thread about community suggestion by Nonki 1: Your Program Database.

    I think this story will become long.  So I separated it.


    Nonki Takahashi

    Latest versions for community suggestion by Nonki 1:

    1. Program Scanner 0.2b - PMG585-0
    2. Program Database 0.2a - HMK932-0
    3. Program Folder Manager 0.3 - CRK000-1


    Nonki Takahashi

    Tuesday, June 24, 2014 2:12 AM
    Moderator
  • These are my ideas for a future challenge.

    1. Create a international version of Hello World program.
    2. Create a program to show Small Basic source.  Comment lines must be shown as green.
    3. Draw a picture of a regular triangle.

    Nonki Takahashi

    Tuesday, June 24, 2014 6:02 AM
    Moderator
  • Idea for a future challenge:

    Make a basic chat program :)

    A sample here:

    JDT558

    Tuesday, June 24, 2014 4:54 PM
  • Thanks for that Nonki

    Before I did this challenge I checked out some different ways to do it.

    I found this tutorial: http://www.kirupa.com/developer/actionscript/array_max_min.htm

    It's a really nice and simple explanation on how to do it. I think I should wiki this in Small Basic.

    Maybe next month we do a sort of Alphabet. Sort names in a database.

    Tuesday, June 24, 2014 5:04 PM
    Moderator
  • Athasak

    That's a really neat program! Nice One.

    I love games that throw in a story line. Love your question and answer book.

    Very intuitive, no need for instructions to read - less work for user! Awesome.


    Then the doors and Shapes... it just obvious what the user has to do.
    Tuesday, June 24, 2014 5:47 PM
    Moderator
  • Athasak

    re if this an escape game... I reckon it is.  http://en.wikipedia.org/wiki/Escape_the_room

    And if you read a bit down in the Wikipedia link it says:

    "Room escapes usually have a minimalistic interface, ambient soundtrack, and no non-player characters; elements which can enhance the gamer's sense of isolation....."

    Based on that you nailed it!


    citation: Escape the room, http://en.wikipedia.org/w/index.php?title=Escape_the_room&oldid=614156555 (last visited June 24, 2014).
    Tuesday, June 24, 2014 5:57 PM
    Moderator
  • Idea for a future challenge:

    Make a basic chat program :)

    A sample here:

    JDT558


    Another classic!    Could use a MultilineTextbox for this.
    Tuesday, June 24, 2014 6:50 PM
    Moderator
  • Thank you very much Jibba :)

    Please I need your help :) Remember when you told me about the shapes, that I don't have to use "Shapes.HideShape(rectangle1)", "Shapes.HideShape(rectangle2)"... all the time? That I can do something with arrays and then like subroutines type "ShowMainMenu()" for example and show a menu so simply?

    (by the way, Coding Cat taught me about custom subroutines "thanks Coding Cat")

    I tried to add shapes with this:

    For ... To ...

    EndFor

    but when I was trying to hide the shapes, I couldn't. Actually only one of them would get hidden xD

    So how can I type a word (or something simple like that) and then hide or show a hole bunch of shapes?

    (because I am sure that this is possible)

    Could you please give me a basic example )

    Tuesday, June 24, 2014 9:15 PM
  • Athasak, yeah I remember

    Here's some help with the adding Shapes and storing their reference in an Array. Have a look and then you might be able to use the idea to create a Subroutine that, say removes next shape for example.

    The sample adds 120 shapes then removes every 2nd shape.

    Without using loops and arrays for this it would add about 150 lines of code (loc) and would make the program very difficult to write, manage and limit other things you might want to do with the shapes.

    PMH018-0


    Wednesday, June 25, 2014 1:44 AM
    Moderator
  • Thank you so much Jibba, you are the best!

    This means so much to me :)

    Wednesday, June 25, 2014 6:48 AM
  • Game Challenge 3

    Okay it's not "Call of Duty 4: Modern Warfare", actually it doesn't even have an image : )  but I suppose the logic is similar to a first person shooter game.

    Anyway here it is:

    QHN542

    Wednesday, June 25, 2014 6:06 PM
  • Athasak,

    Your event driven FPS program works well and is very well structured (and commented) - well done.

    Wednesday, June 25, 2014 6:31 PM
    Moderator
  • Thank you Jibba :) <3
    Wednesday, June 25, 2014 7:15 PM
  • Wait a minute... it must have been the hours of programming... hahahaha... I meant litdev :D

    Thank you litdev <3 ^_^

    Wednesday, June 25, 2014 9:23 PM
  • Community Suggestions (by ProfessionalOfSmallBasic)

    (please don't run this program online, it's terrible)

    (also this is not an hourglass, hahahaha....)

    2. Import ID: ZZW943

    Thursday, June 26, 2014 4:35 PM
  • Idea for a future challenge

    Make a RGB (red - green - blue) menu with sliding bars that changes the background color.

    A little sample here: NHJ269

    Thursday, June 26, 2014 10:52 PM
  • Idea for a future challenge

    Alright, I don't know what this is but you guys are gonna love it. I had so much fun making and using this program and I thought that it's a good idea to share this one as an idea for a future challenge :D

    Basically, this program zooms a shape when the cursor is moved, but enough talking :)

    Here it is: KTG267

    Friday, June 27, 2014 2:38 PM
  • Idea for a future challenge

    Make a "Scroll Down Bar", you know... a bar that scrolls down some text or shapes or images :)

    A sample here:

    ZDP541

    Saturday, June 28, 2014 10:37 PM
  • Idea for a future challenge

    Make a program to change pages of text when you click and drag the page to the left edge of the window (in order to see the next page) and when you click and drag the page to the right edge of the window (in order to see the previous page). It may sound kinda confusing so here is an example :D

    By the way... you can run this program online because it works okay

    SFR639

    (You see Jibba, I practiced arrays as I told you I would and now I use them in a program :D "thank you very much Jibba, you are the best!")



    • Edited by Athasak Sunday, June 29, 2014 6:11 PM wrong spelling
    Sunday, June 29, 2014 11:53 AM
  • Good on you Athasak!

    Nice to see people enjoying trying new stuff.

    Have you heard of camel case? It's a helpful convention for naming variables.

    e.g. getpageactive could read getActivePage.

    Here's a good article: http://social.technet.microsoft.com/wiki/contents/articles/15081.small-basic-programming-tips.aspx

    I like how your variables describe what they are doing.

    I've just been reading up about commenting code. Interesting stuff. I'll share some thoughts in next months challenge if relevant.

    I'm looking forward to doing your scroll bar challenge next month.

    Sunday, June 29, 2014 10:44 PM
    Moderator
  • Thank you for everything! <3 ^_^
    Monday, June 30, 2014 12:55 AM
  • wow thats amazing. im making a game right now and i thought that was hard. who ever built this is a genius.
    Friday, October 09, 2015 8:06 PM
  • That's great, JetFire!

    Vijaye built it. Yes, he's a genius. =^)

    We've got some other smart folks working on it now and our other CS educational tools (Touch Develop, Kodu, BBC micro:bit software, etc.).

     

    How old are you? Are you learning to program?

    Thanks!


    Ed Price, Azure & Power BI Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)

    Answer an interesting question? Create a wiki article about it!

    Sunday, October 11, 2015 2:14 AM
    Owner
  • Yeah im learning to program smallbasic. have 6 months maybe under my belt. I actually have a working game right now. its two parts a customizable part for the character and then the actual game itself. if you want to play the import is WLH742 and then NSV094. Im currently 17. 
    Wednesday, October 14, 2015 1:41 AM